General > Developers Corner
PlayerDisconnected hook, when is it called?
iViscosity:
So clearly the PlayerDisconnected hook is called when someone disconnects from the server, but I was wondering if it's only called when they manually leave. In the recent release I made it's function relies on the PlayerDisconnected hook, but I don't want it to cause issues when people leave because they were karma kicked or kicked by an admin for some other reason. Is there a way to make it so that it is only caused if someone manually leaves the server and not if they are kicked by either an admin or karma?
MrPresident:
It gets called when a player disconnects, for any reason.
kicked, banned, timed out, quits of their own accord. Any reason.
Essentially, as their player object is about to be deleted, it's called.
iViscosity:
That is what I thought, thanks. Is there a hook or something that calls only when a player manually disconnects?
iViscosity:
I have a related question, is there a way to capture when a person is about to leave, before they actually do? Like when they actually hit disconnect (or disconnect in the console), before they actually leave.
MrPresident:
The PlayerDisconnect hook is called right before they actually disconnect I believe. Assuming they are not timing out that is.
It is called while the player object is still valid.
If you hook directly into the game event for disconnect, you might be able to tell the difference in the types of disconnects.
Navigation
[0] Message Index
[#] Next page
Go to full version