Data Saving problem
#4

1. At OnPlayerDisconnect and OnGameModeExit just use SavePlayer(i); instead of pasting the whole code.

2. Make a stock just like 'SavePlayer', but named 'ResetPlayer' - where you set all variables of the player to 0;

2.1 Have in mind you should use ResetPlayer(playerid); once a player registers and when they leave the server, so their stats wont mix up with other players once they join!

2.2 My example of "ResetPlayer":
Code:
stock ResetPlayer(playerid)
{
    PlayerInfo[playerid][pCash] = 0;
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pWantedLevel] = 0;
    PlayerInfo[playerid][pVip] = 0;
    PlayerInfo[playerid][pScore] = 0;
    PlayerInfo[playerid][pCondoms] = 0;

    //... add more here and ALWAYS use this AFTER SavePlayer(playerid);
    return 1;
}
3. Replace your INI_ParseFile with this one:
Code:
INI_ParseFile(UserPath(playerid), "LoadUser_user", .bExtra = true, .extra = playerid, .bPassTag = true);
Reply


Messages In This Thread
Data Saving problem - by CarRamper - 15.06.2016, 08:55
Re: Data Saving problem - by 1nspire - 15.06.2016, 09:24
Re: Data Saving problem - by CarRamper - 15.06.2016, 09:36
Re: Data Saving problem - by 1nspire - 15.06.2016, 10:14
Re: Data Saving problem - by Dayrion - 15.06.2016, 10:44
Re: Data Saving problem - by 1nspire - 15.06.2016, 12:23
Re: Data Saving problem - by CarRamper - 15.06.2016, 12:44
Re: Data Saving problem - by CarRamper - 15.06.2016, 12:46

Forum Jump:


Users browsing this thread: 1 Guest(s)