Account is not saving
#1

The player's account is not saving properly. Sometime it saves their stats but sometime when they connect to the server, their stat's are gone.

pawn Code:
stock SaveStats(playerid)
{
    new file[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(file, sizeof(file), "Accounts/%s.ini", name);
    if(dini_Exists(file))
    {
        dini_IntSet(file,   "AdminLevel", pInfo[playerid][pAdmin]);
        dini_IntSet(file,   "VIPLevel", pInfo[playerid][pVIP]);
        dini_IntSet(file,   "Cash", GetPlayerCash(playerid));
        dini_IntSet(file,   "Score", GetPlayerScore(playerid));
        dini_IntSet(file,   "Kills", pInfo[playerid][pKills]);
        dini_IntSet(file,   "Death", pInfo[playerid][pDeaths]);
        dini_Set(file,      "IP", GetPlayerIP2(playerid));
        dini_IntSet(file,   "Banned", pInfo[playerid][pBanned]);
        dini_IntSet(file,   "Bank", pInfo[playerid][pBank]);
        dini_IntSet(file,   "Hours", pInfo[playerid][pHours]);
        dini_IntSet(file,   "Minutes", pInfo[playerid][pMinutes]);
        dini_IntSet(file,   "Second", pInfo[playerid][pSecond]);
       
    }
    return 1;
}
That is the stock i used everytime i need to save their accounts.
Reply
#2

Use MySQL!
Reply
#3

Yeah, and that's only a glimp of the many issues those saving systems from the stone age have. It's buggy and outdated and people avoid it for a reason. So what @v1k1nG said; Use MySQL, or if you don't have access to a phpmyadmin database, use SQLite.
Reply
#4

I agree with v1k1ng, you should use MySQL to save your data. It's way secure, and fast in retrieving data.
Reply
#5

I didn't understand MySQL at all, even after reading the tutorials.
Reply
#6

Save player's stats only if they are logged in.
Use a variable to check weather player is logged or not!
if someone quit without login.. this situation will occur (as you are directly saving stats without checking weather the player is logged in)

and Also use a repeating timer to save all data!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)