GMX Help
#1

I'm having a problem with my GMX Command when it restarts my player spawns in blueberry and dies. Any help would be great thanks. Here's the GMX Command.

pawn Код:
YCMD:gmx(playerid, params[])
{
    if(gPlayerLoggedIn[playerid] == 0) return 1;

    if(PlayerInfo[playerid][Admin] >= 5)
    {
        new string[126];
        format(string, sizeof(string), "Warning: %s has set the server to GMX in 10 seconds...", PlayerName(playerid));
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        SetTimer("GameModeExitFunc", 10000, false);
    }

    return 1;
}
Reply
#2

Show code of this GameModeExitFunc() function.
Reply
#3

pawn Код:
public GameModeExitFunc()
{
    foreach(Player, i)
    {
        if(gPlayerLoggedIn[i] == 1)
        {
            SavePlayer(i);
            gPlayerLoggedIn[i] = 0;
        }
    }
    GameModeExit();
}
Reply
#4

And i presume in you SavePlayer(i); you save a current x,y,z of player position.
Check in you records do you have a this value saved and check you load part do you set this to player.
Reply
#5

Put this on top of your script
pawn Код:
new GMX;
Then
pawn Код:
YCMD:gmx(playerid, params[])
{
    if(gPlayerLoggedIn[playerid] == 0) return 1;

    if(PlayerInfo[playerid][Admin] >= 5)
    {
        new string[126];
        format(string, sizeof(string), "Warning: %s has set the server to GMX in 10 seconds...", PlayerName(playerid));
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        SetTimer("GameModeExitFunc", 10000, false);
        GMX = 1;
    }

    return 1;
}
Okay, now on player disconnect
pawn Код:
if(GMX == 1) return 1;
And last but not least, put this under OnGameModeInit
pawn Код:
GMX = 0;
Should work! If not check this out https://sampforum.blast.hk/showthread.php?tid=319439
Reply
#6

Save the data, kick all the players and THEN restart the server.
Reply
#7

Lol, why would you kick? Just use what I made, and it should work(Works on my server).
Reply
#8

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Lol, why would you kick? Just use what I made, and it should work(Works on my server).
You should kick them so they have to restart their game in order to avoid technical difficulties that come with gmx's. Unless of course you are running a mini-games-like server, then you should kick the players.
Reply
#9

I run a RP server...I guess you could do it your way, but I'm pretty sure my way works fine too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)