GMX Bug.
#1

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;
}
Reply
#2

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

Save the data OnGameModeExit. Works for me fine
Reply
#4

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...
Reply
#5

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;
}
Reply
#6

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

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?
Reply
#8

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

Could anyone please help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)