TTL -1 , How to kick player?


Two Player. (PlayerA, PlayerB)

RoomSetting >> PhotonNetwork.CurrentRoom.PlayerTtl = -1;

Debug.Log(PhotonNetwork.CurrentRoom.Players.Count) Reseut >> Number '2'.

For Example >> One PlayerB is Network Accident Disconnect (Not use LeaveRoom)>>

public override void OnPlayerLeftRoom(Photon.Realtime.Player otherPlayer){

PhotonNetwork.DestroyPlayerObjects(otherPlayer);
}

Debug.Log(PhotonNetwork.CurrentRoom.Players.Count) Reseut >> Number '2'.

i want Number '1'.

i want PlayerB out of the room.

PlayerB disappeared from the screen, but it is alive inside.

Is there any other way?



Comments

  • Hi @J830930,

    Thank you for choosing Photon!

    Inactive actors can't be removed from the room using client side code only.
    You need custom server plugin for this.

    By the way:
    PlayerTTL can be changed (but it does not have a direct effect on already inactive actors).
    So you can have a PlayerTTL set to a value before the room is full then change it to a lower value when the game starts (so any leaving player will be given a few seconds to return otherwise the spot will be free).
    Ultimately you could ignore inactive actors and increase MaxPlayers (also set ExpectedUsers to the inactive actors' UserIDs to make sure you don't get extra players maybe?). Or you can have a fake bot logic for inactive actors (note: there is no bot support in Photon).
  • Thanks sir.

    if so can i Change SceneObjecte at PlayerB View?
  • Hi @J830930,

    I did not understand the question.
    but in general you can read about ownership & control changes when players disconnect here.
Sign In or Register to comment.