[Help!] Saving stats
#1

Well, I've scripted a levelup system (Which works) and just noticed that there's an issue..Each time I'd spend money, /levelup or whatever, it'll reset when I login. Houses save, admin level saves, but not the level and experience.
Reply
#2

Have you tried to save the data after /levelup and disconnect ?
Reply
#3

How do I do that ? (I am very very very new to scripting.)
Reply
#4

Like this with a timer


Example ? do not use this unless you have the same saving system or formating
pawn Код:
function SaveAccountStats(playerid)
{
    if(Logged[playerid] == 1)
    {
    new
        INI:File = INI_Open(UserPath(playerid))
    ;
    INI_SetTag(File,"data");
   
    PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
    PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
    new
        Float:x,
        Float:y,
        Float:z
    ;
    GetPlayerPos(playerid,x,y,z);
    PlayerInfo[playerid][pPos_x] = x;
    PlayerInfo[playerid][pPos_y] = y;
    PlayerInfo[playerid][pPos_z] = z;
   
    INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
    INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
    INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
    INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
    INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
    INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);
    INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
    INI_WriteInt(File,"Gold",PlayerInfo[playerid][pGold]);
    INI_WriteInt(File,"Level",PlayerInfo[playerid][Level]);
    INI_WriteInt(File,"Exp",PlayerInfo[playerid][Exp]);
   
    INI_Close(File);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)