Foreach Error - 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)
+--- Thread: Foreach Error (
/showthread.php?tid=478325)
Foreach Error -
dakata994 - 29.11.2013
SOLVED! Thanks!
Re: Foreach Error -
Threshold - 29.11.2013
pawn Код:
stock CounterRadio(const string[])
{
foreach(Player, i)
{
if(GetPlayerState(i) != PLAYER_STATE_NONE)
{
if(GetPlayerClass[i] == TEAM_COUNTER)
{
SendClientMessage(i, BLUE, string);
}
}
}
return 1;
}
Add the following line to the top of your script:
This requires you to download and place the foreach include file into your pawno/includes/ folder.
The foreach thread can be found here if you do not already have the include file:
https://sampforum.blast.hk/showthread.php?tid=92679
EDIT: StuartD, you were literally 1 or 2 seconds behind me, I couldn't believe that :P
Re: Foreach Error -
StuartD - 29.11.2013
Do you have Foreach included at the top of your script?
EDIT: Too Slow
Re: Foreach Error -
iZN - 29.11.2013
Do you have foreach include and it is defined before a_samp include? Also, the code must be like this:
pawn Код:
stock CounterRadio(const string[])
{
foreach(Player, i)
{
if(GetPlayerState(i) != PLAYER_STATE_NONE)
{
if(GetPlayerClass[i] == TEAM_COUNTER)
{
SendClientMessage(i, BLUE, string);
}
}
}
return true;
}
EDIT: I'm late too, only 60000 milliseconds.
Re: Foreach Error -
dakata994 - 29.11.2013
Yes i have include it and Thanks SOLVED!
Re: Foreach Error -
Sublime - 29.11.2013
Quote:
Originally Posted by iZN
Do you have foreach include and it is defined before a_samp include? Also, the code must be like this:
pawn Код:
stock CounterRadio(const string[]) { foreach(Player, i) { if(GetPlayerState(i) != PLAYER_STATE_NONE) { if(GetPlayerClass[i] == TEAM_COUNTER) { SendClientMessage(i, BLUE, string); } } } return true; }
EDIT: I'm late too, only 60000 milliseconds.
|
return true; and return 1; are all the same e_e
Re: Foreach Error -
Threshold - 29.11.2013
And... why did you post that?
Re: Foreach Error -
iZN - 29.11.2013
Quote:
Originally Posted by Sublime
return true; and return 1; are all the same e_e
|
I know, that's my habit you can say. Whenever I see return 1 or 0 I change it to true or false.