SA-MP Forums Archive
GMX Bug. - 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: GMX Bug. (/showthread.php?tid=477722)



GMX Bug. - Spydah - 25.11.2013

whenever I use my /gmx command it doens't save my Player Files.

Command:
pawn Код:
COMMAND:gmx(playerid, targetid, params[])
{
    if(PlayerStat[playerid][AdminLevel] < 5) return SendClientMessage(playerid, GREY, "You are not authorized to use this command.");
    GMX(playerid);
    new string[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    format(string, sizeof(string), "%s %s has issued a server restart, it will occur in 30 seconds.", GetAdminRank(playerid), GetOOCName(playerid));
    SendClientMessageToAll(GOLD, string);
    SetTimer("gmxtimer", 30000, false);
    return 1;
}
GMX Variable
pawn Код:
stock GMX(playerid)
{
    SavePlayerData(playerid);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SavePlayerData(i);
    }
    for(new g = 1; g < MAX_GANGS; g++)
    {
        SaveGang(g);
    }
    return 1;
}



Re: GMX Bug. - Tanush123 - 25.11.2013

I see you did SavePlayerData(playerid); before you do it to everyone. Does it work for you?


Re: GMX Bug. - DobbysGamertag - 25.11.2013

Save the data OnGameModeExit. Works for me fine


Re: GMX Bug. - Spydah - 25.11.2013

pawn Код:
public OnGameModeExit()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SavePlayerData(i);
    }
    return 1;
}
This doesn't work man, I myself tried it on 10 different ways but it won't succeed...


Re: GMX Bug. - Loot - 26.11.2013

Try this:
pawn Код:
COMMAND:gmx(playerid, targetid, params[])
{
    if(PlayerStat[playerid][AdminLevel] < 5) return SendClientMessage(playerid, GREY, "You are not authorized to use this command.");
    GMX();
    new string[128];
    //for(new i = 0; i < MAX_PLAYERS; i++) - what are you using it for ? -> might be the issue.
    format(string, sizeof(string), "%s %s has issued a server restart, it will occur in 30 seconds.", GetAdminRank(playerid), GetOOCName(playerid));
    SendClientMessageToAll(GOLD, string);
    SetTimer("gmxtimer", 30000, false);
    return 1;
}
Also, why is it having the playerid parameter while all it does is to save all accounts and gangs?
pawn Код:
// stock GMX(playerid)
stock GMX()
{
    //SavePlayerData(playerid);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SavePlayerData(i);
    }
    for(new g = 1; g < MAX_GANGS; g++)
    {
        SaveGang(g);
    }
    return 1;
}



Re: GMX Bug. - Sublime - 26.11.2013

Aren't the codes which saves all the files supposed to be in the loop?


Re: GMX Bug. - Pottus - 26.11.2013

Quote:
Originally Posted by Spydah
Посмотреть сообщение
pawn Код:
public OnGameModeExit()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SavePlayerData(i);
    }
    return 1;
}
This doesn't work man, I myself tried it on 10 different ways but it won't succeed...
Are checking if the player is connected?
Are you using crash detect?


Re: GMX Bug. - Spydah - 26.11.2013

pawn Код:
#include <a_samp>
#include <sii>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#include <foreach>
I use these includes.


Re: GMX Bug. - Spydah - 26.11.2013

Could anyone please help me?