SA-MP Forums Archive
Foreach problem - 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 problem (/showthread.php?tid=592840)



Foreach problem - eclipses - 30.10.2015

Hello there, i'm getting 4 errors while compiling my gamemode,
This is the errors I am getting

Код:
C:\Users\Admin\Desktop\AMRP\gamemodes\AMRP.pwn(3900) : error 017: undefined symbol "foreach"
C:\Users\Admin\Desktop\AMRP\gamemodes\AMRP.pwn(3900) : error 029: invalid expression, assumed zero
C:\Users\Admin\Desktop\AMRP\gamemodes\AMRP.pwn(3900) : error 017: undefined symbol "Player"
C:\Users\Admin\Desktop\AMRP\gamemodes\AMRP.pwn(3900) : 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(new i: Player) if(GetPlayerVehicleID(i) != 0 && GetPlayerVehicleID(i) == GetPlayerVehicleID(index)) {
				PlayAudioStreamForPlayer(i, data);
Anyone got a solution?


Re: Foreach problem - Scottylad - 30.10.2015

Try adding
#include <foreach> at the top if you have not and add
foreach(Player, i)


Re: Foreach problem - eclipses - 30.10.2015

Quote:
Originally Posted by Scottylad
Посмотреть сообщение
Try adding
#include <foreach> at the top if you have not and add
foreach(Player, i)
I've added the #include <foreach> at all the includes,
Could i replace "foreach(new i: Player)" with "foreach(Player, i)"?


Re: Foreach problem - Scottylad - 30.10.2015

You could try, I use 'foreach(Player, i)' But the one you are using is more updated but your 'Foreach' could be an old one so try using mine else get a new <foreach> include.


Re: Foreach problem - eclipses - 30.10.2015

Quote:
Originally Posted by Scottylad
Посмотреть сообщение
You could try, I use 'foreach(Player, i)' But the one you are using is more updated but your 'Foreach' could be an old one so try using mine else get a new <foreach> include.
Alright, will try it out, Thanks <3 +1 rep


Re: Foreach problem - Scottylad - 30.10.2015

No problem, any time buddy <3