SA-MP Forums Archive
Reseting 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: Reseting variables (/showthread.php?tid=522879)



Reseting variables - Wizzy951 - 29.06.2014

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;
}



Re: Reseting variables - AMouldyLemon - 29.06.2014

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



Re: Reseting variables - Dignity - 29.06.2014

Seems okay.


Re: Reseting variables - Stinged - 29.06.2014

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