SA-MP Forums Archive
Loop help - 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: Loop help (/showthread.php?tid=641108)



Loop help - Kraeror - 11.09.2017

Hello guys!
I have created a gang system where the gang vehicles are respawning with command, but I have a small problem.
I can't stop the loop
Quote:

for(new i = 0; i <= MAX_PLAYERS; i++)

In the loop I check if player is gang leader and respawn only the vehicles of the gang.
Can you help me, I want to stop the loop, because when I respawn the vehicles, they are successfully respawned, but it calls
Quote:

Unknow command.

Sorry for my bad english, I hope you understand me!


Re: Loop help - Kraeror - 11.09.2017

I forgot to say, the
Quote:

Unknow command.

appear, because MAX_VEHICLES are more than the vehicles, I want to respawn.


Re: Loop help - Kraeror - 11.09.2017

SOLVED!


Re: Loop help - JasonRiggs - 11.09.2017

you don't need to make much replies, Just edit your post, And the next time you make such a thread, either post a code, or we won't help..


Re: Loop help - iLearner - 11.09.2017

idk if i understood, however to break a loop you simply use 'break;'.

eg:
PHP код:
for(new =0i<max_playersi++)
// when u found what u wanted
break; 



Re: Loop help - JasonRiggs - 11.09.2017

Quote:
Originally Posted by iLearner
Посмотреть сообщение
idk if i understood, however to break a loop you simply use 'break;'.

eg:
PHP код:
for(new =0i<max_playersi++)
// when u found what u wanted
break; 
He already said that he solved it.