Stats don't save on disconnect
#1

Hello,

The stats like position don't save on disconnect, and they don't to in a timer. I know that the callback gets called, cause a message with 'It gets called' just gets called.

pawn Код:
public StatsSave(playerid)
{
    if(PlayerInfo[playerid][IsLogged] == 1 && PlayerInfo[playerid][IsPlayerSpawned] == 1)
    {
        new Playername[MAX_PLAYER_NAME];
        GetPlayerRPName(playerid,Playername,sizeof(Playername));
        format(file,sizeof(file),"JoAdmin/Accounts/%s.ini",Playername);
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
        GetPlayerPos(playerid,X,Y,Z);
        Int = GetPlayerInterior(playerid);
        dini_FloatSet(file, "PosX", X);
        dini_FloatSet(file, "PosY", Y);
        dini_FloatSet(file, "PosZ", Z);
        dini_FloatSet(file, "Interior",Int);
        dini_IntSet(file, "InJail",PlayerInfo[playerid][IsJailed]);
        SendClientMessage(playerid,COLOR_WHITE," It gets called.");
    }
    return true;
}
So it doesnt save the stats.. Ain't that weird?

Regards, Jochem

Note: everything is allright. format of file is ok.
Reply
#2

Question: Have you created the folders you're saving it into?
Reply
#3

Yes. They are created. The stats load fine, but they dont save
Reply
#4

Do you have onplayerdisconnect
pawn Код:
StatsSave(playerid);
Reply
#5

No. But I got all those things into OnPlayerDisconnect. Like save
Reply
#6

Ok now I did what you said and it still bugs
Reply
#7

Same goes to me

i did
pawn Код:
forward save(playerid);
and on OnPlayerConnect
pawn Код:
SetTimer("save",5000,true);
and this
pawn Код:
public save(playerid)
{
new Float:x,Float:y,Float:z;
new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(isLogged[playerid] == 1 && Spawned[playerid] == 1)
    {
        dini_IntSet(file, "Score", PlayerInfo[playerid][Score]);
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel]);
         GetPlayerPos(playerid,x,y,z);
        dini_IntSet(file,"X",floatround(x));
        dini_IntSet(file,"Y",floatround(y));
        dini_IntSet(file,"Z",floatround(z));
        dini_IntSet(file,"haveacar",haveacar[playerid]);
        dini_IntSet(file,"Member",Member[playerid]);
dini_IntSet(file,"Leader",Leader[playerid]);
dini_IntSet(file,"InOrg",IsInOrg[playerid]);
dini_IntSet(file,"Requesting",request[playerid]);
dini_IntSet(file,"IsRequesting",IsRequesting[playerid]);
dini_IntSet(file,"Law",IsLaw[playerid]);
        dini_IntSet(file, "HoursPlayed", PlayerInfo[playerid][HoursPlayed]);
        dini_IntSet(file, "MinsPlayed", PlayerInfo[playerid][MinutesPlayed] );
        dini_IntSet(file, "DrivingLic", HaveDrivingLic[playerid] );
        dini_IntSet(file,"IsVip",PlayerInfo[playerid][IsVip]);
        dini_IntSet(file,"jail",jail[playerid]);
    }
}

and it didnt work :S
Reply
#8

Yes, but that is just cause you used SetTimer.. I use SetTimerEx.
Reply
#9

Maybe decrease the time? Or dont alt+tab.
Reply
#10

Actually I need to ALT TAB cause I need to upload the AMX to my server, and start it... But others have this problem to
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)