SA-MP Forums Archive
User data resets on disconnect, y_Ini - 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: User data resets on disconnect, y_Ini (/showthread.php?tid=425834)



User data resets on disconnect, y_Ini - lean1337 - 26.03.2013

Hello, I have a wierd problem, evrytime I disconnect on my linux host, (HostSpree) the user data gets deleted, which means the user file is empty. But when I run it on my computer (Windows) it works fine, it used to work just fine on my Linux host but it desided to just stop working for some reason.

Btw, it reads it when I connect it and evrything its just when I disconnect the data gets deleted.


My onplayerdisconnect
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(fexist(UserPath(playerid)))
    {
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
    INI_WriteInt(File,"Logs",PlayerInfo[playerid][pLogs]);
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_WriteInt(File,"Crim",PlayerInfo[playerid][pCrim]);
    INI_Close(File);
    }
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "** %s (Timed out)", pname);
        case 1: format(string, sizeof(string), "** %s (Quit)", pname);
        case 2: format(string, sizeof(string), "** %s (Kicked)", pname);
    }
    SendClientMessageToAll(COLOR_WHITE, string);
    PlayerInfo[playerid][pSdeath] = 1;
    format(string,sizeof(string),"[%d-%d-%d] %s has Quit/Timed out/Kicked",GetDay(),GetMonth(),GetYear(),pname);
    PlayerInfo[playerid][pBanned] = 0;
    Log("/logs/generall.txt",string);

    if(IsBeingSpeced[playerid] == 1)//If the player being spectated, disconnects, then turn off the spec mode for the spectator.
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i,false);
            }
        }
    }
    return 1;
}



Re: User data resets on disconnect, y_Ini - lean1337 - 27.03.2013

bump