25.09.2014, 02:35
Make a stock where it resets every player variable when they log into the server. Be sure to also make sure that if they crash before their account stats can load that it doesn't save, otherwise when they log into the server, all their stats will be 0.
Example:
Then, to make sure their stats don't save if they crash before they log in.
Example:
pawn Код:
stock ResetVars(playerid)
{
pInfo[playerid][Banned] = 0;
pInfo[playerid][Admin] = 0;
pInfo[playerid][Money] = 0;
return 1;
}
//Then apply this to OnPlayerConnect
public OnPlayerConnect(playerid)
{
ResetVars(playerid);
//Put whatever else you have here
return 1;
}
pawn Код:
//Make a PVar after they log in that looks something like:
SetPVarInt(playerid, "LoggedIn", 1);
//Then, under OnPlayerDisconnect (to make sure their stats don't save before they can load their stats after logging in)
public OnPlayerDisconnect(playerid, reason)
{
if(GetPVarInt(playerid, "LoggedIn") == 1 && reason != 0)
{
//Put whatever you use to save stats here
}
return 1;
}