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



GMX Help - tiernantheman - 08.06.2012

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;
}



Re: GMX Help - Azazelo - 08.06.2012

Show code of this GameModeExitFunc() function.


Re: GMX Help - tiernantheman - 08.06.2012

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



Re: GMX Help - Azazelo - 08.06.2012

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.


Re: GMX Help - JhnzRep - 09.06.2012

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


Re: GMX Help - ReneG - 09.06.2012

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


Re: GMX Help - JhnzRep - 09.06.2012

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


Re: GMX Help - ReneG - 09.06.2012

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.


Re: GMX Help - JhnzRep - 09.06.2012

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