Dying when re-logging from a GMX.
#1

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)