Yini Saving Stats on every logout
#1

Can't figure out why.


This, is under OnPlayerDisconnect.
pawn Код:
stock SaveUser(playerid)
{
    PlayerInfo[playerid][Money] = GetPlayerMoney(playerid);
    PlayerInfo[playerid][Level] = GetPlayerScore(playerid);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"====[PLAYER INFORMATION]====");
    INI_WriteString(File,"Name",PlayerInfo[playerid][Name]);
    INI_WriteInt(File,"Password",PlayerInfo[playerid][Password]);
    INI_WriteInt(File,"Level",PlayerInfo[playerid][Level]);
    INI_WriteInt(File,"Money",PlayerInfo[playerid][Money]);
    INI_WriteInt(File,"AdminLevel",PlayerInfo[playerid][AdminLevel]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][Age]);
    INI_WriteInt(File,"Gender",PlayerInfo[playerid][Gender]);
    INI_WriteInt(File,"Skin",PlayerInfo[playerid][Skin]);
    INI_WriteInt(File,"RegDate",PlayerInfo[playerid][RegDate]);
    INI_WriteInt(File,"RegMonth",PlayerInfo[playerid][RegMonth]);
    INI_WriteInt(File,"RegYear",PlayerInfo[playerid][RegYear]);
    INI_WriteInt(File,"TimesKicked",PlayerInfo[playerid][TimesKicked]);
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][Banned]);
    INI_WriteString(File,"BannedBy",PlayerInfo[playerid][BannedBy]);
    INI_WriteString(File,"BanReason",PlayerInfo[playerid][BanReason]);
    INI_WriteInt(File,"TimesBanned",PlayerInfo[playerid][TimesBanned]);
    INI_Close(File);
    return 1;
}
Reply
#2

Anybody?
Reply
#3

Try removing the [ and ] from it.
Seems like the INI system adds them automatically at both ends of your tag and it might confuse the INI system.
Like:

INI_SetTag(File,"====PLAYER INFORMATION====");

Perhaps the INI system sees your tag in the file as

[====[PLAYER INFORMATION]

because it presumably stops at the first ] and therefore cannot find your tag and creates a new tag.
Reply
#4

I am wondering, if you set your tag like that, what would your loading function be? I am guessing thats the problem, cause you must use the same tag with your loading function that you used while saving user's stats.

Example, if you have [userdata] tag, your loading function should be something like LoadPlayer_userdata(id, name[], value[]);
Reply
#5

PowerPC603 & iOxide.
Love you.
Reply
#6

I also suggest that you Hash your passwords, having them as a plain text is a breach of user information (Regardless if you think it isn't)
Reply
#7

Quote:

I also suggest that you Hash your passwords, having them as a plain text is a breach of user information (Regardless if you think it isn't)

I do, hash. When they enter their password in 'Register Dialog', it hashes them and stores in PlayerInfo[playerid][Password]. On Disconnect, it automatically saves it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)