How to kick a player?

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to kick a player?

Chinchila
2013-03-05 21:30:01

how can i make a owner of the room kick the player? i just want to kick not to close the connection, like leave the room.

[code2=csharp]if(TEXTO.Contains("/kick")){ string[] Args = TEXTO.Split(' '); if(PhotonNetwork.room.customProperties["Owner"] == PhotonNetwork.player.name){

			}else{
				status = "you are not the owner!";
			}[/code2]

sorry for my bad english;

Comments

Tobias
2013-03-06 09:23:13

PhotonNetwork.CloseConnection( PhotonPlayer kickPlayer ) It essentially sends an event to the target player and that client quits the game.

Chinchila
2013-03-09 21:42:11

i didnt understand, how can i quet the PhotonPlayer with a string for the name?

Nachtmahr
2013-03-10 13:07:05

PhotonNetwork.CloseConnection( PhotonPlayer kickPlayer )

in this case I asume PhotonPlayer is a connectet peer ( PhotonPlayer : PeerBase ) your peer class has a different name. However this will complettly disconnect him I think... just Connect him again to the Lobby.

Sarath
2022-08-08 06:38:45

Hi,

How to logout the same user when he is trying to login with different devices. Is there any solution can any one please.....

Back to top