SA-MP Forums Archive
Gametext for player, when GM exits - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Gametext for player, when GM exits (/showthread.php?tid=98048)



Gametext for player, when GM exits - Memoryz - 18.09.2009

I have a DM server, but when the GM exits, I want it to do this:

pawn Код:
GameTextForPlayer(playerid,"~r~Game Over~n~Loading next map...",11000,5);
VIA a filterscript, since my GMs rotate between eachother, and I don't want to add it to all of them, (too much work)

So I have a filterscript that will do it.

Now, on the gamemode exit, it looks like this

pawn Код:
public OnGameModeExit()
{
  GameTextForPlayer(playerid,"~r~Game Over~n~Loading next map...",11000,5);
    return 1;
}
And I get ---> error 017: undefined symbol "playerid"

So how can I get this working?


Re: Gametext for player, when GM exits - Correlli - 18.09.2009

As you can see, OnGameModeExit doesn't have a 'playerid' parameter, so you'll just have to do a loop for all connected players:

pawn Код:
public OnGameModeExit()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      GameTextForPlayer(i, "~r~Game Over~n~Loading next map...", 11000, 5);
    }
  }
  return 1;
}



Re: Gametext for player, when GM exits - Memoryz - 18.09.2009

Quote:
Originally Posted by Don Correlli
As you can see, OnGameModeExit doesn't have a 'playerid' parameter, so you'll just have to do a loop for all connected players:

pawn Код:
public OnGameModeExit()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      GameTextForPlayer(i, "~r~Game Over~n~Loading next map...", 11000, 5);
    }
  }
  return 1;
}
Thanks, works like a charm!

=)


Re: Gametext for player, when GM exits - Danny_Costelo - 19.09.2009

Quote:
Originally Posted by Don Correlli
As you can see, OnGameModeExit doesn't have a 'playerid' parameter, so you'll just have to do a loop for all connected players:

pawn Код:
public OnGameModeExit()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      GameTextForPlayer(i, "~r~Game Over~n~Loading next map...", 11000, 5);
    }
  }
  return 1;
}
Why not use GameTextForAll instead of looping?..


Re: Gametext for player, when GM exits - Memoryz - 19.09.2009

Quote:
Originally Posted by 0xF29323
Quote:
Originally Posted by Don Correlli
As you can see, OnGameModeExit doesn't have a 'playerid' parameter, so you'll just have to do a loop for all connected players:

pawn Код:
public OnGameModeExit()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      GameTextForPlayer(i, "~r~Game Over~n~Loading next map...", 11000, 5);
    }
  }
  return 1;
}
Why not use GameTextForAll instead of looping?..
Is it faster...?


Re: Gametext for player, when GM exits - KevKo95 - 19.09.2009

Instead of doing all that work just do

GameTextForAll("~r~Game Over~n~Loading next map...", 11000, 5);