SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 21/02/2020, 08:01 PM   #1
Big Clucker
Bect's Avatar
Join Date: Apr 2011
Posts: 198
Reputation: 1
Default foreach help

for (new ax = 0; ax < 3; ax ++) { DestroyVehicle(a[ax]); }
How can I convert that to foreach without Iterator_Add...
Bect is offline   Reply With Quote
Old 22/02/2020, 02:51 AM   #2
SiaReyes's Avatar
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 622
Reputation: 57
Default Re: foreach help

foreach (new ax : Range(0, 4)) // 0-2

Last edited by SiaReyes; 23/02/2020 at 04:22 PM.
SiaReyes is offline   Reply With Quote
Old 23/02/2020, 09:36 AM   #3
Big Clucker
Robson04's Avatar
Join Date: Aug 2018
Location: Poland
Posts: 96
Reputation: 0
Default Re: foreach help

Originally Posted by SiaReyes View Post
foreach (new ax : Range(0, 4)) // 0-3
This loop is useless. Foreach is a advanced loop using iter. If your system does not need to have an iterator continent, use the default loop.

PHP Code:
for(new 03++)

//The loop have index: 0, 1, 2 
Robson04 is offline   Reply With Quote
Old 23/02/2020, 05:22 PM   #4
Beckett's Avatar
Join Date: Feb 2012
Posts: 1,794
Reputation: 104
Default Re: foreach help

What's the point of using foreach if you don't want to use an iterator? The idea of foreach is that it stores the equipped slots then loops through them, if you want to loop through all slots then why not use the default `for` loop?
Final Nights Roleplay
The first SA-MP server that is not regulated by administrators.
No OOC hierarchy. Strictly directed by players. Utopian vision.

El primer servidor SA-MP que no está regulado por los administradores.
Sin jerarquías OOC. Estrictamente dirigido por jugadores. Visión utópica.

Primul server de SA-MP care nu este regulat de administratori.
Fără ierarhie OOC. Strict dictat de jucători. Visiune utopică.

Yöneticiler tarafından düzenlenmeyen ilk SA-MP sunucusu.
OOC hiyerarşisi yok. Kesinlikle oyuncular tarafından yönetiliyor. Ütopik görme.

Become a Member of our Discord Channel
Beckett is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
the use of foreach?? XHunterZ Server Support 1 15/09/2016 01:44 PM
foreach for npc ax1 Scripting Help 1 13/08/2016 12:26 PM
Foreach.ini please jaydon Scripting Help 5 13/06/2012 09:07 AM
Foreach for 0.3e? BleverCastard Scripting Help 4 22/04/2012 01:48 AM
Foreach SamyRomafia Help Archive 3 16/07/2011 09:24 AM

All times are GMT. The time now is 12:22 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.