Confusing
#1

Like I have this code: http://pastebin.com/U4SypiGd
To check if the player is pressing LMB.
So, my problem is with this piece of code:
pawn Код:
new id;
id = GetClosestFire(playerid);
if(id == -1) return 1;
If the id is -1 then return 1; that means it will stop there, not checking others players.
If I put if(id == -1) continue it will say "break or continue is out of context" or something like that...
Then what can I do?
Reply
#2

Did you get any error while compiling?
Reply
#3

Better use
pawn Код:
if(id > -1) {
//All things in here...
}
You can use continue; or break; only if you are in a compound block of loop..

Example:
pawn Код:
//Loop:
for (new index = 0; index < 32; index++)
{
      if (index == 16) continue; //this will skip Index 16.
      if (index == 22) break; //this will stop the loop when it reaches 22.
}

//Other:
function test2()
{
      if (5 != 7) continue; //<-- continue won't work/illogical or w/e?.
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)