Foreach doesn't work.
#1

I've problem.
I've used foreach for a long time. I discover this problem since 1 year ago.
I stopped using foreach because of this problem.

It doesn't work. I'm not sure. But i think it only works for my id.
Or for id 0.

i use

pawn Код:
foreach(Player, i)
Any ideas?
Reply
#2

Replace it with this
pawn Код:
foreach (new i : Player)
Reply
#3

^^

I've tried that but still the same.
It doesn't work.
Reply
#4

Well, my question is, do you get any errors? Do you have the following line at the top of your file?:

pawn Код:
#include <foreach>
Elaborate your situation, do not just say that you have problems with foreach. Hope you found a solution.
Reply
#5

Update all your YSI inc file to latest version.
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
Are you using the latest version from YSI? Are you sure the hooks are called?
Yes i'm using YSI 3.1.

Let me try to debug the code.
Reply
#7

sorry for double posting.
I've question. Since i saw it uses some YSI includes.
Does it means i need to load these used YSI includes first before foreach?
Because i put #include <foreach> below all YSI include that i use in the script.
Reply
#8

I recently discovered that if you don't load YSI with a game-mode that the system won't initialize. So, for example, loading bare.amx and a new FS you've coded with foreach won't work because YSI isn't "on."

To combat this problem, I load up all of the YSI includes I used in my testing GM (which is basically a modified version of bare.amx); now I can load, unload, and reload FS's with no problem.
Reply
#9

^^

That didn't work for me.
Reply
#10

i think i've discovered the problem.
did foreach counts NPC as player? If it isn't.
Then that is the reason why it is not listing up in /admins.

I've to make sure first if it is fixed yet.

Question: Did foreach counts NPC as player?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)