onUserLeaveRoom and playerid
onUserLeaveRoom and playerid
How can i get the playerId from an onUserLeaveRoom event in a game room?
You can either cash that information upon a user entering a room on the client-side or you can use the userId provided by the onUserLeaveRoom() event and make a call to the extension.
If the user is not disconnected, you can have an extension API that finds the User instance of the given userId and returns you the corresponding player id.
For the extension API solution, you should find out about two things:
1- if that user is currently inside a non-game room, he/she may no longer have any playerId
2- if the user enters another game room, does his/her playerId change or not (my guess is that it may change)
If the user is not disconnected, you can have an extension API that finds the User instance of the given userId and returns you the corresponding player id.
For the extension API solution, you should find out about two things:
1- if that user is currently inside a non-game room, he/she may no longer have any playerId
2- if the user enters another game room, does his/her playerId change or not (my guess is that it may change)