Need an event callback for inactive players?
I need an event be fired when a player become inactive and when he\she rejoin to the room. IPunCallbacks needs a callback like OnPhotonPlayerInactiveChanged!
0
Answers
-
Hi @ahoogol,
Thank you for your suggestion.
@jeanfabre already had a similar idea.
I think currently you can only get join and leave events, I have to check if it makes sense to check if a player is inactive or not in the leave event to make a distinction between new players or rejoining ones.0 -
Hi,
yes, it's on our Todo, it will get done.
Bye,
Jean0 -
Is this implemented?0
-
Hi @gulati,
Thank you for choosing Photon!
Yes, this was added to PUN1 but gone in PUN2.
Which version are you using?
In PUN1, there isOnPhotonPlayerActivityChanged(PhotonPlayer otherPlayer)
.
In PUN2, useIInRoomCallbacks.OnPlayerEnteredRoom(Player otherPlayer)
andIInRoomCallbacks.OnPlayerLeftRoom(Player otherPlayer)
.
Always checkotherPlayer.IsInactive
.
The only info missing in PUN2 is player rejoin: inOnPlayerLeftRoom
the player is never inactive.0 -
Hi John,
Actually I was referring to the plugin. Is there an event for plugin that is raised when a player gets deactivated, or is there a way to detect a player getting deactivated so that I can notify the opponent(s).
Thanks0 -
Hi @gulati,
If you are talking about server-side game server plugins, then to tell if a player got deactivated useILeaveGameCallInfo.IsInactive
andILeaveGameCallInfo.Reason
inOnLeave(ILeaveGameCallInfo info)
.
You should know that the server automatically sends an event to all joined actors when an actor becomes inactive or when removed from actors list after Player TTL expiration.0 -
Hi @JohnTube,
Another issue related to player disconnection.
I have set playerttl to 60 seconds, from what I can understand is that if the user remains disconnected for longer than playerttl then they will be removed from the room. However, I am not getting a Leave callback on webhook plugin incase one of the player gets disconnected (Wifi disabled, goes to background etc.) for more than 60 seconds.
I do get a timeoutdisconnected event on the plugin, after 6-7 seconds of a player getting disconnected, but post that I do not get a Leave callback even if the player remains disconnected for longer duration than 60 seconds (I have waited for more than 5 minutes, but still no Leave callback.
Thanks0 -
Hi @gulati,
First I want to make sure that by 60 seconds you mean 60000 milliseconds.
PlayerTTL is in milliseconds.
Even if it's 60 seconds it should still be triggered anyway.
If you are using plugins with self-hosted Photon Server version v4.0.29.11263 and also testing webhooks using that same version, there could be a bug preventing the callback to be triggered properly in this situation.
This is already fixed in Photon Cloud I think, you could try webhooks on Photon Cloud to make sure.
I could not find this fix in our code base's commits history.
Maybe @chvetsov knows better.0 -
hi, @gulati
OnLeave call should be there. but there is one difference between sdk you are using and current cloud version. In you case callInfo will contain null in Request property.
I assume that this may lead to NullRef somewhere. Please check server logs (deploy/log) maybe you may find something there
best,
ilya0 -
It will be difficult to provide fix right away
You may fix it your self. I think it fails in line 318 because we use info.Request.WebFlags when Request is null. You may fix this and rebuild WebHooks plugins
-best,
ilya0 -
Are you suggesting that I remove the line number 318, rebuild the plugin and check.
Thanks
Gulati0