Loading problem (+rep)
#4

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:
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;
}
Then, to make sure their stats don't save if they crash before they log in.

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


Messages In This Thread
Loading problem (+rep) - by streetpeace - 23.09.2014, 12:30
Re: Loading problem (+rep) - by iSkate - 23.09.2014, 16:03
Re: Loading problem (+rep) - by XStormiest - 23.09.2014, 16:47
Re: Loading problem (+rep) - by DTV - 25.09.2014, 02:35
Re: Loading problem (+rep) - by The__ - 25.09.2014, 03:30
Re: Loading problem (+rep) - by TakeiT - 25.09.2014, 04:14
Re : Loading problem (+rep) - by streetpeace - 25.09.2014, 09:54

Forum Jump:


Users browsing this thread: 1 Guest(s)