y_ini not saving on /rcon gmx?
#1

Hello, my y_ini is writing the values as zero every time a player disconnects.

This is my OnPlayerDisConnect

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    SaveAccount(playerid);
    return 1;
}
pawn Код:
forward SaveAccount(playerid);
public SaveAccount(playerid)
{
    new
        Float:x = pInfo[playerid][pPosX],
        Float:y = pInfo[playerid][pPosY],
        Float:z = pInfo[playerid][pPosZ],
        Float:a = pInfo[playerid][pAngle],
        Float:h = pInfo[playerid][pHealth],
       Float:ar = pInfo[playerid][pArmour];

    GetPlayerPos(playerid,x,y,z);
    pInfo[playerid][pAngle] = GetPlayerFacingAngle(playerid,a);
    pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
    pInfo[playerid][pHealth] = GetPlayerHealth(playerid,h);
    pInfo[playerid][pArmour] = GetPlayerArmour(playerid,ar);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Bank",pInfo[playerid][pBank]);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Faction",pInfo[playerid][pFaction]);
    INI_WriteInt(File,"Rank",pInfo[playerid][pRank]);
    INI_WriteInt(File,"Leader",pInfo[playerid][pLeader]);
    INI_WriteInt(File,"Job",pInfo[playerid][pJob]);
    INI_WriteInt(File,"Mats",pInfo[playerid][pMats]);
    INI_WriteInt(File,"Crack",pInfo[playerid][pCrack]);
    INI_WriteInt(File,"HasInvite",pInfo[playerid][pHasInvite]);
    INI_WriteInt(File,"CanKill",pInfo[playerid][pCanKill]);
    INI_WriteInt(File,"Skin",pInfo[playerid][pSkin]);
    INI_WriteFloat(File,"LastX",x);
    INI_WriteFloat(File,"LastY",y);
    INI_WriteFloat(File,"LastZ",z);
    INI_WriteFloat(File,"Angle",a);
    INI_WriteFloat(File,"Health",h);
    INI_WriteFloat(File,"Armour",ar);
    INI_WriteInt(File,"AdminLevel",pInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Accent",pInfo[playerid][pAccent]);
    INI_WriteInt(File,"Jailed",pInfo[playerid][pJailed]);
    INI_WriteInt(File,"JailTime",pInfo[playerid][pJailTime]);
    INI_Close(File);
    return 1;
}
What in the world am I doing wrong?
Reply
#2

You gotta loop through all the players under OnGameModeExit

and SaveAccount(playerid); for all of players you looped.
Reply
#3

I fixed it. Thanks for replying. All I had to do was make an admin-based /gmx [seconds] command which looped through all the players. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)