SA-MP Forums Archive
[SOLVED] Foreach loop not working - 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: [SOLVED] Foreach loop not working (/showthread.php?tid=611230)



[SOLVED] Foreach loop not working - corne - 03.07.2016

I've recently gone back to coding in PAWN and now I'm stuck with a rather strange issue with foreach that has absolutely driven me mental in the past hour. Basically, everything works perfectly except for the player loops that don't work at all and thus dont create 3D Texts. It does print 'testoutb' and also creates the pickup, but doesnt print 'testb' or create the 3D texts.

Here is the code, I am talking about the loops at line 33 and 44.
-cut-

Help would be appreciated!

By the way, there are no errors whatsoever, the other loops also all work fine, it's just the player ones in this particular script that don't work. In other callbacks the player loops work just fine aswell.


Re: Foreach loop not working - Vince - 03.07.2016

Foreach only operates on connected players. If this is in OnGameModeInit the loop won't run at all.


Re: Foreach loop not working - corne - 03.07.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
Foreach only operates on connected players. If this is in OnGameModeInit the loop won't run at all.
Oh wow, I feel absolutely stupid right now. Much appreciated!

( Would have given you reputation but I've already did so before and it doesn't allow me to give it again. )