For Cycles Ending? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: For Cycles Ending? (
/showthread.php?tid=188974)
For Cycles Ending? -
almighty - 09.11.2010
Hey guys, me again, pretty nobbish question?...
The thing is..
i have a code like this
Код:
for(new I;I<10;I++)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,Thing[I][X],Thing[I][Y],Thing[I][Z]);
{
if(Somethihg)
{
Some stuff here
}
else return SendClientmessage(playerid,COLOR,TExt);
}
else return SendClientmessage(playerid,COLOR,TExt);
}
return 1;
Now, the thing is, i want to send a message IF the cycle ends without finding any match, i have tried checking if I = 10 but it bugs, so... i really dont kjnow what else to do, any ideas?
Re: For Cycles Ending? -
Bessensap - 09.11.2010
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid,5.0,Thing[I][X],Thing[I][Y],Thing[I][Z]) return SendClientMessage(playerid,/*COLOR*/,/*Text*/);
Re: For Cycles Ending? -
Mauzen - 09.11.2010
This should work:
pawn Код:
new inarea = false;
for(new I;I<10;I++)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,Thing[I][X],Thing[I][Y],Thing[I][Z]);
{
if(Somethihg)
{
Some stuff here
}
else return SendClientmessage(playerid,COLOR,TExt);
inarea = true;
}
else return SendClientmessage(playerid,COLOR,TExt);
}
if(!inarea) SendClientMessage(...);
return 1;
Respuesta: Re: For Cycles Ending? -
almighty - 09.11.2010
Quote:
Originally Posted by Bessensap
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid,5.0,Thing[I][X],Thing[I][Y],Thing[I][Z]) return SendClientMessage(playerid,/*COLOR*/,/*Text*/);
|
Thanks, but that wouldt work, it would return that message each time it was false (9 to 10 times since the cycle runs 10 times)
Quote:
Originally Posted by Mauzen
This should work:
pawn Код:
new inarea = false; for(new I;I<10;I++) { if(IsPlayerInRangeOfPoint(playerid,5.0,Thing[I][X],Thing[I][Y],Thing[I][Z]); { if(Somethihg) { Some stuff here } else return SendClientmessage(playerid,COLOR,TExt); inarea = true; } else return SendClientmessage(playerid,COLOR,TExt); } if(!inarea) SendClientMessage(...); return 1;
|
Thanks, it did work...