for loop mucking up again
#4

I've got something like this:

pawn Код:
// On the very top:

// UN define MAX_PLAYERS
#undef MAX_PLAYERS

// RE define MAX_PLAYERS (to the amount of your server slots)
#define MAX_PLAYERS 32
pawn Код:
// Custom loop thingy:
#define loopPlayers(%1) for (new %1=0;%1<MAX_PLAYERS;%1++) if(IsPlayerConnected(%1))
pawn Код:
// OnGameModeInit:
if(GetMaxPlayers() > MAX_PLAYERS)
{
  printf("[error] Server slots (%d) is higher as MAX_PLAYERS (%d)",GetMaxPlayers,MAX_PLAYERS);
  SendRconCommand("exit");
  return 1;
}
pawn Код:
// Random public function
forward Sneaky();
public Sneaky()
{
  loopPlayers(i)
  {
    SetPlayerHealth(i, 0);
  }
  return 1;
}

Reply


Messages In This Thread
for loop mucking up again - by kazai - 30.07.2009, 05:19
Re: for loop mucking up again - by paytas - 30.07.2009, 05:22
Re: for loop mucking up again - by Joe Staff - 30.07.2009, 05:39
Re: for loop mucking up again - by -Sneaky- - 30.07.2009, 06:22

Forum Jump:


Users browsing this thread: 1 Guest(s)