Questions - 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: Questions (
/showthread.php?tid=112672)
Questions -
Lajko1 - 09.12.2009
I have some questions about giving money to all team etc ...
i try when player complete the mission it type gametextforplayer to all of COP_TEAM and and other Gametextforplayer to all of GROVE_TEAM
here is the code what i want and ask if this will work , cuz i have felling it wont work
Код:
GameTextForPlayer(TEAM_GROVE,"Mission Passed!~n~~g~+7500$",5000,0);
GivePlayerMoney(TEAM_GROVE,7500);
will this give the money to all team and send game text to all team ? can you help ? if not what should i fix and do
ty
Re: Questions -
Correlli - 09.12.2009
It's something like this if you're using GetPlayerTeam-function:
pawn Код:
foreach(Player, u)
{
if(GetPlayerTeam(u) == TEAM_GROVE)
{
GameTextForPlayer(u, "Mission Passed!~n~~g~+7500$", 5000, 0);
GivePlayerMoney(u, 7500);
}
}
or like this if you're using gTeam or any other variable:
pawn Код:
foreach(Player, u)
{
if(gTeam[u] == TEAM_GROVE)
{
GameTextForPlayer(u, "Mission Passed!~n~~g~+7500$", 5000, 0);
GivePlayerMoney(u, 7500);
}
}
You'll also need ******'s
foreach-function.
Re: Questions -
Lajko1 - 09.12.2009
Quote:
Originally Posted by Don Correlli
It's something like this if you're using GetPlayerTeam-function:
pawn Код:
foreach(Player, u) { if(GetPlayerTeam(u) == TEAM_GROVE) { GameTextForPlayer(u, "Mission Passed!~n~~g~+7500$", 5000, 0); GivePlayerMoney(u, 7500); } }
or like this if you're using gTeam or any other variable:
pawn Код:
foreach(Player, u) { if(gTeam[u] == TEAM_GROVE) { GameTextForPlayer(u, "Mission Passed!~n~~g~+7500$", 5000, 0); GivePlayerMoney(u, 7500); } }
You'll also need ******'s foreach-function.
|
hvala, i just want to ask you coreli is this as include ? or what i think its include
let me try
Re: Questions -
Correlli - 09.12.2009
Quote:
Originally Posted by Lajko1
hvala, i just want to ask you coreli is this as include ? or what i think its include let me try
|
Yes, it is - you need to include it in your script:
Re: Questions -
Lajko1 - 09.12.2009
ammm
Код:
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\Jefferson.pwn(5) : fatal error 100: cannot read from file: "foreach"
Top of my script
and i copy and past from link what u post me coreli i past in notepad name it ''foreach'' and palce in pawno include , and i get this error that i post what should be wrong ?
Re: Questions -
Correlli - 09.12.2009
Make sure you have
foreach.inc in the
\pawno\include\ folder
of the PAWNO IDE you're using.
Re: Questions -
Lajko1 - 09.12.2009
ok i place now this function and works OK no errors for now now i must just get a friend to say him if we can test if it works and i will tell
anyway ty
Re: Questions -
Correlli - 09.12.2009
You're welcome.
I suggest you to use foreach from now on, it's faster than normal for-player-loop.