Saving when GMX
#1

Hello,

I want to make a /gmx command for the admin, but
with saving the stats of the players. I mean, on my server,
I use dini to save the variables, when I do gmx from the
RCON box it doesn't save the current status and all the
skins are setting to skin ID: 0. I want to make a /gmx command,
but that it saved all accounts before it restarts..

I started like this:

Код:
if(strcmp(cmd, "/gmx", true)
{
     // I want to let it save before the GMX so it doesn't mes up when it's restarted.
     SendRconCommand("gmx");
     return 1;
}
I made a savestat function to save them but it doesn't work.

Here it is:
Код:
public SaveStats(playerid)
{
	new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "pAdminLevel",PlayerInfo[playerid][pAdminLevel]);
        dini_IntSet(file, "pMoney", GetPlayerMoney(playerid));
        dini_IntSet(file, "pHours", GetPlayerScore(playerid));
        dini_IntSet(file, "pNew", PlayerInfo[playerid][pNew]);
        dini_IntSet(file, "pJob", PlayerInfo[playerid][pJob]);
        dini_IntSet(file, "pFaction", PlayerInfo[playerid][pFaction]);
        dini_IntSet(file, "pGuide", PlayerInfo[playerid][pGuide]);
        dini_IntSet(file, "pHasSpawnPlace", PlayerInfo[playerid][pHasSpawnPlace]);
        dini_FloatSet(file, "pOwnSpawnX", PlayerInfo[playerid][pOwnSpawnX]);
        dini_FloatSet(file, "pOwnSpawnY", PlayerInfo[playerid][pOwnSpawnY]);
        dini_FloatSet(file, "pOwnSpawnZ", PlayerInfo[playerid][pOwnSpawnZ]);
        dini_IntSet(file, "pSkin", GetPlayerSkin(playerid));
        dini_IntSet(file, "pWepLic",PlayerInfo[playerid][pWepLic]);
        dini_IntSet(file, "pPassport",PlayerInfo[playerid][pPassport]);
        dini_IntSet(file, "pCigars",PlayerInfo[playerid][pCigars]);
        dini_IntSet(file, "pLighter",PlayerInfo[playerid][pLighter]);
        dini_IntSet(file, "pMats",PlayerInfo[playerid][pMats]);
        dini_IntSet(file, "pAjailed",PlayerInfo[playerid][pAjailed]);
        dini_IntSet(file, "pAjailTime",AJailTime[playerid]);
        dini_IntSet(file, "pAge",PlayerInfo[playerid][pAge]);
        dini_IntSet(file, "pSex",PlayerInfo[playerid][pSex]);
        dini_IntSet(file, "pHasHouse",PlayerInfo[playerid][pHasHouse]);
        dini_IntSet(file, "pPackages",PlayerInfo[playerid][pPackages]);
        dini_IntSet(file, "pWeedSeeds",PlayerInfo[playerid][pWeedSeeds]);
        dini_IntSet(file, "pWeed",PlayerInfo[playerid][pWeed]);

        new weapons[13][2];
    	for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    	dini_IntSet(file, "weaponSlot0", weapons[0][0]);
    	dini_IntSet(file, "weaponSlot1", weapons[1][0]);
    	dini_IntSet(file, "weaponSlot2", weapons[2][0]);
    	dini_IntSet(file, "weaponSlot3", weapons[3][0]);
    	dini_IntSet(file, "weaponSlot4", weapons[4][0]);
    	dini_IntSet(file, "weaponSlot5", weapons[5][0]);
    	dini_IntSet(file, "weaponSlot6", weapons[6][0]);
    	dini_IntSet(file, "weaponSlot7", weapons[7][0]);
    	dini_IntSet(file, "weaponSlot8", weapons[8][0]);
    	dini_IntSet(file, "weaponSlot9", weapons[9][0]);
    	dini_IntSet(file, "weaponSlot10", weapons[10][0]);
    	dini_IntSet(file, "weaponSlot11", weapons[11][0]);
    	dini_IntSet(file, "weaponSlot12", weapons[12][0]);
    }
    SendClientMessage(playerid, COLOR_GREEN, "(( All account stats saved. ))");
}
I hope someone can help me soon..


Thanks!!
Reply
#2

Ugh... put it under OnGamemodeExit
Reply
#3

Quote:
Originally Posted by airsoft
Посмотреть сообщение
Ugh... put it under OnGamemodeExit
Hmm.. Thanks, I will Try..
Reply
#4

no problem lol
Reply
#5

Quote:
Originally Posted by airsoft
Посмотреть сообщение
no problem lol
Doesn't work, waiting for other reply.
Reply
#6

show us your #define SERVER_USER_FILE
Reply
#7

I've also had and having this problem. Unsure if this would work, but try this:

On the /gmx command, save the players stats, and run a 5 seconds timer. In that timer, put the "SendRcomCommand" for a GMX.

Probably would work.
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
OnPlayerDisconnect is called on GMX, use that as normal, not OnGameModeExit.
Well for example a position save saves up on position 0 0 0, when using OnPlayerDisconnect for GMX (for me).
Reply
#9

Yea, Jochmed is right. I used a save player stats on disconnect ... but tested it with /gmx command and didn`t save. Do as Jochmed said and it`ll work, at least for me it works. Do a /gmx command and set a timer for SendRconcommand and save stats.
Reply
#10

You're welcome. However, ******, I want to know why it won't bug for you. Since you're a top-scripter we are doing something wrong, I guess.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)