Resetting variables
#1

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;
}
Reply
#2

On player disconnect , it is safer ,server takes less resources
Reply
#3

Both for safety reason.
Reply
#4

OnPlayerConnect because you won't need to reset the variables if the playerid isn't taken later on.
Reply
#5

Thanks for the replies
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)