SA-MP Forums Archive
for(new i;i<MAX_PLAYERS;i++){ - 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: for(new i;i<MAX_PLAYERS;i++){ (/showthread.php?tid=379658)



for(new i;i<MAX_PLAYERS;i++){ - Why - 22.09.2012

Hello. I am making a world event command, and I am making it so a bridge will fall appart, and LSFMD and News Faction will be notified. This is part of my command:

pawn Код:
for(new i;i<MAX_PLAYERS;i++)
    {
        if(strval(params) == 1)
        {
            /* Broken Bridge */
            RemoveBuildingForPlayer(i, 3991, 1608.1953, -1721.8047, 26.0000, 0.25);
            RemoveBuildingForPlayer(i, 4043, 1608.1953, -1721.8047, 26.0000, 0.25);
However, it only removes the bridge for player id 0.

What's wrong?


Re: for(new i;i<MAX_PLAYERS;i++){ - Vince - 22.09.2012

Don't know, show more. Probably some misplaced return.


Re: for(new i;i<MAX_PLAYERS;i++){ - [MG]Dimi - 22.09.2012

Are you maybe returning inside a loop?


Re: for(new i;i<MAX_PLAYERS;i++){ - Why - 22.09.2012

Yes, I used return. Removed it and now it works fine. Thanks.