Resetting variables - 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: Resetting variables (
/showthread.php?tid=370700)
Resetting variables -
iTorran - 20.08.2012
Okay, resetting variables is something I tend to do differently each time..
I have never really looked into the best places to reset them..
Sometimes I will reset them on connect, sometimes on disconnect, and sometimes both..
So, the question is, where is the best place to reset player variables?
Example:
pawn Code:
new Example[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
Example[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Example[playerid] = 0;
return 1;
}
Re: Resetting variables -
detter - 20.08.2012
On player disconnect , it is safer ,server takes less resources
Re: Resetting variables -
Arca - 20.08.2012
Both for safety reason.
Re: Resetting variables -
SuperViper - 21.08.2012
OnPlayerConnect because you won't need to reset the variables if the playerid isn't taken later on.
Re: Resetting variables -
iTorran - 21.08.2012
Thanks for the replies