Reseting variables
#1

Hello everyone!
I was just wondering whether I'm properly reseting player variables in order to avoid new registered player getting previous player stats who had the same played ID . Also is there way to improve this code ?

pawn Code:
public OnPlayerConnect(playerid)
{
    ResVars(playerid);
    return 1;
}

stock ResVars(playerid)
{
   
    level[playerid] = 0.
    //and so on
    return 1;
}
Reply
#2

pawn Code:
stock ResVars(playerid)
{
   
    level[playerid] = 0;
    //and so on
    return 1;
}
Reply
#3

Seems okay.
Reply
#4

I'm not sure but I think using a plain function is better.
pawn Code:
ResVers(playerid)
{
    //....
    // No return
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)