Account is not saving - 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: Account is not saving (
/showthread.php?tid=675701)
Account is not saving -
ChandraLouis - 18.05.2020
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.
Re: Account is not saving -
v1k1nG - 19.05.2020
Use MySQL!
Re: Account is not saving -
jasperschellekens - 19.05.2020
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.
Re: Account is not saving -
KevTheJoker - 19.05.2020
I agree with v1k1ng, you should use MySQL to save your data. It's way secure, and fast in retrieving data.
Re: Account is not saving -
ChandraLouis - 19.05.2020
I didn't understand MySQL at all, even after reading the tutorials.
Re: Account is not saving -
GameOvr - 19.05.2020
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!