Giving the whole team something...
#1

For my gamemode I need to be able to give a whole team money. I know where to place the code I just don't know how to do it. Could someone give me an example?
Reply
#2

pawn Код:
foreach(Player, i)
{
 if(GetPlayerTeam(i) == TEAM_YOU_WANT) GivePlayerMoney(i, 5000);
}
or if you are using gTeam then it's

pawn Код:
foreach(Player, i)
{
 if(gTeam[i] == TEAM_YOU_WANT) GivePlayerMoney(i, 5000);
}
Reply
#3

warning 203: symbol is never used: "forach"
Reply
#4

pawn Код:
GiveTeamMoney(teamid, amount) {
      foreach(Player, i)
      {
             if(GetPlayerTeam(i) == teamid) GivePlayerMoney(i, amount);
      }
}
Reply
#5

EDIT: was too slow
Reply
#6

It's called foreach, not forach.
Reply
#7

pawn Код:
change forach(Player,i) to foreach(Player,i)
Sorry i mistyped. You will also need the foreach include if you don't have it already.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)