Giving the whole team something... - 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: Giving the whole team something... (
/showthread.php?tid=268515)
Giving the whole team something... -
cloudysky - 12.07.2011
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?
Re: Giving the whole team something... -
Cypress - 12.07.2011
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);
}
Re: Giving the whole team something... -
cloudysky - 12.07.2011
warning 203: symbol is never used: "forach"
Re: Giving the whole team something... -
jameskmonger - 12.07.2011
pawn Код:
GiveTeamMoney(teamid, amount) {
foreach(Player, i)
{
if(GetPlayerTeam(i) == teamid) GivePlayerMoney(i, amount);
}
}
Re: Giving the whole team something... -
Roko_foko - 12.07.2011
EDIT: was too slow
Re: Giving the whole team something... -
SchurmanCQC - 12.07.2011
It's called foreach, not forach.
Re: Giving the whole team something... -
Cypress - 12.07.2011
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.