SA-MP Forums Archive
Dying when re-logging from a GMX. - 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: Dying when re-logging from a GMX. (/showthread.php?tid=289348)



Dying when re-logging from a GMX. - Jack_Leslie - 11.10.2011

So, I can't get a proper 'GMX' working. When I GMX and log back in, my HP is 0 and my position is Blueberry Achers, underground by like 2 meters? However if I just log off and back in then it works fine so it's not my actual saving code.

Here's what I have:
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("AdminGMX", 10000, false);
    }

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

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



Re: Dying when re-logging from a GMX. - Dripac - 11.10.2011

GameModeExitFunc(playerid);

try to add this function at your command, because i have it too and it is working

And add this

pawn Код:
public OnRconCommand(cmd[])
{
  if(!strcmp(cmd,"gmx",true))
  {
    for(new playerid;playerid<MAX_PLAYERS;playerid++)OnPlayerDisconnect(playerid,-1);
    SendRconCommand("gmx");
  }

  return 1;
}



Re: Dying when re-logging from a GMX. - Jack_Leslie - 11.10.2011

Quote:
Originally Posted by Dripac
Посмотреть сообщение
GameModeExitFunc(playerid);

try to add this function at your command, because i have it too and it is working

And add this

pawn Код:
public OnRconCommand(cmd[])
{
  if(!strcmp(cmd,"gmx",true))
  {
    for(new playerid;playerid<MAX_PLAYERS;playerid++)OnPlayerDisconnect(playerid,-1);
    SendRconCommand("gmx");
  }

  return 1;
}
Tried, didn't work...