gmx saving problem
#1

As most of you probably know, sometimes gmx doesn't save properly in your userfile or resets all integers to 0. That's my problem, I'm trying to make skins save when you disconnect. It saves when you /q or close the server completely then connect again. It doesn't work when you /rcon gmx, what it does is sets the skin to default skin id 0 (CJ).

I've already tried making my own /gmx command and saving the skin before the server restarts, but it still gives me CJ's skin on connect.

I have other things that save when I gmx, like: drugs, bank account balance, life insurance, fight styles, etc... but some things don't save for some reason like the skin when I do gmx.

Does anyone know a solution ?
Reply
#2

You can save account info when it changes, or every few minutes in a timer.
Reply
#3

Make your own gmx command that saves data, then gmx's via SendRconCommand.
Reply
#4

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Make your own gmx command that saves data, then gmx's via SendRconCommand.
Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
I've already tried making my own /gmx command and saving the skin before the server restarts, but it still gives me CJ's skin on connect.
4char
Reply
#5

^^Because he's doing it wrong, and has shown no code.
Reply
#6

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
^^Because he's doing it wrong, and has shown no code.
I agree with this. I've made my own GMX command to save before restart and it has worked fine, maybe try again or look at other scripts.
Reply
#7

I made this gmx command so it loops through everyone and gets their skin. When I type /gmx, it sets off a timer for 10 seconds, between the 10 seconds I only made it so it will save the skin:

pawn Код:
dcmd_gmx(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
        new string[128];

        restartgm = SetTimer("RestartGM",10000,0);
        SendClientMessageToAll(COLOR_PINK,"***SERVER RESTART:  (ADMIN RESTART)  Server Restarting In 10 Seconds.");
        format(string,128,"Admin Server Restart (/gmx Refresh)"); print(string);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && PlayerInfo[i][LoggedIn] == 1)
            {
                new skinid = GetPlayerSkin(i);
                dUserSetINT(PlayerName2(i)).("savedskin",skinid);
                PlayerInfo[i][SavedSkin] = skinid;
            }
        }
        return 1;
    } else return SendClientMessage(playerid,red,"Invalid Command. Type   /cmds   For A List Of All Available Server Commands.");
}
Then when 10 seconds is up, this separate timer callback restarts the server:

pawn Код:
forward RestartGM();
public RestartGM()
{
    SendRconCommand("gmx");
    return 1;
}
Reply
#8

Set the timer after the loop, not before.
Reply
#9

Well I changed it to this but it still doesn't work:

pawn Код:
dcmd_gmx(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
        new string[128];

        SendClientMessageToAll(COLOR_PINK,"***SERVER RESTART:  (ADMIN RESTART)  Server Restarting In 10 Seconds.");
        format(string,128,"Admin Server Restart (/gmx Refresh)"); print(string);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && PlayerInfo[i][LoggedIn] == 1)
            {
                new skinid = GetPlayerSkin(i);
                dUserSetINT(PlayerName2(i)).("savedskin",skinid);
                PlayerInfo[i][SavedSkin] = skinid;
            }
        }
        restartgm = SetTimer("RestartGM",10000,0);
        return 1;
    } else return SendClientMessage(playerid,red,"Invalid Command. Type   /cmds   For A List Of All Available Server Commands.");
}
Did I do it right ?
Reply
#10

Kick the players in the loop, they would have to restart their game, avoiding problems.
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)