SA-MP Forums Archive
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)
+--- Thread: foreach (/showthread.php?tid=532432)



foreach - Banditukas - 18.08.2014

Can i do that?

Код:
foreach(new i : Player)
{
// BLABLBA
for(new a = 0; a < MAX_PLAYERS; a ++)
{
//BLABLA
}
}



Re: foreach - MicroD - 18.08.2014

WHY WOULD YOU DO THAT? Please before using some code check documentation which explains how and why it is used.
foreach(new i : Player) will loop every single connected player and store id in i. The thing you're doing is nonsense you're doing exactly the same(inefficient) thing inside that loop?


Re: foreach - Banditukas - 18.08.2014

I don't care it'is have sense or no, but server no crash from it?


Re: foreach - MicroD - 18.08.2014

Server should not crash but it's absurd to have something like that.