SA-MP Forums Archive
Help with foreach - 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: Help with foreach (/showthread.php?tid=197308)



Help with foreach - NewbBeginner - 08.12.2010

I have foreach include defined:
Код:
#include <foreach>
Then I have error on this:
Код:
foreach(Petla, i)
Код:
(24) : error 017: undefined symbol "YSI_gPetlaS"
(24) : error 017: undefined symbol "YSI_gPetlaA"
(24) : warning 215: expression has no effect
(24) : error 001: expected token: ";", but found "]"
(24) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Help with foreach - Biesmen - 08.12.2010

ForEach(Petla, i);

But I suggest ForEach(player, i); if you want to use it as a playerid.


Re: Help with foreach - Rizard - 08.12.2010

start by ending your line with... ';' as usual.

Might wanne add a link to this foreach include as well, and if released in a topic, start searching for errors there...


Re: Help with foreach - NewbBeginner - 08.12.2010

Still same error. I have ; there.


Re: Help with foreach - Ash. - 08.12.2010

What is 'Petla' ?


Re: Help with foreach - SkizzoTrick - 08.12.2010

YEs,what is petla?
The using of foreach is only
foreach(playerid, i)

you could also use petla if you do this

new petla = GetPlayerID(playerid);


Re: Help with foreach - armyoftwo - 08.12.2010

Quote:
Originally Posted by SkizzoTrick
Посмотреть сообщение
YEs,what is petla?
The using of foreach is only
foreach(playerid, i)

you could also use petla if you do this

new petla = GetPlayerID(playerid);
That's a false statement,
you can create your own iterators, if it would be only Player, i would say it would be useless


Код:
new Iterator:Petla<MAX>;
Do you have the iterator created?


Re: Help with foreach - SkizzoTrick - 08.12.2010

Quote:
Originally Posted by armyoftwo
Посмотреть сообщение
That's a false statement,
you can create your own iterators, if it would be only Player, i would say it would be useless


Код:
new Iterator:Petla<MAX>;
Do you have the iterator created?
My bad man,sorry,i just copied his post
I wanted to use write
foreach(playerid,i)

My bad


Re: Help with foreach - NewbBeginner - 08.12.2010

Код:
(24) : error 017: undefined symbol "YSI_gplayeridS"
(24) : error 017: undefined symbol "YSI_gplayeridA"
(24) : warning 215: expression has no effect
(24) : error 001: expected token: ";", but found "]"
(24) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
foreach(playerid, i);
uhm, I have so bad feeling that I have some old include


Re: Help with foreach - Biesmen - 08.12.2010

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
ForEach(Petla, i);

But I suggest ForEach(player, i); if you want to use it as a playerid.
^ that. Use it, for sake. Then post again.

if you use playerid at 'ForEach' it won't work, ofcourse -.-