Gametext for player, when GM exits
#1

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?
Reply
#2

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

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!

=)
Reply
#4

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?..
Reply
#5

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...?
Reply
#6

Instead of doing all that work just do

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


Forum Jump:


Users browsing this thread: 2 Guest(s)