SA-MP Forums Archive
OnPlayerDisconnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDisconnect (/showthread.php?tid=577187)



OnPlayerDisconnect - BossArturKA - 09.06.2015

Welcome. I have a question related to "OnPlayerDisconnect".
In cases of withdrawal of a problem with the game "OnPlayerDisconnect" is triggered immediately, but within 5-10 seconds.
PHP код:
#include <a_samp>
main() { }
public 
OnGameModeInit() return true;
public 
OnPlayerConnect(playerid) return printf("OnPlayerConnect: %d"playerid);
public 
OnPlayerDisconnect(playeridreason) return printf("OnPlayerDisconnect: %d"playerid); 
When connecting "OnPlayerConnect ID" is displayed instantly.
When you exit the game [/q(uit)] similarly, in an instant.
But when removing the task is not a small delay, you can check for yourself.
I need to reset the variables, is it wise to update them in "OnPlayerConnect"?



Re: OnPlayerDisconnect - mamorunl - 10.06.2015

What is up with people posting questions like this? All weirdly styled and everything.

You can update variables in onPlayerDisconnect as it is called right before a player quits. However, if the reason is a crash or timeout, your variables might return wrong values.

Resetting variables to a starting value without saving it, is perfectly fine in OnPlayerConnect.


Re: OnPlayerDisconnect - BossArturKA - 10.06.2015

.Th.