Looping functions - 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: Looping functions (
/showthread.php?tid=484203)
Looping functions -
HighFlyer - 29.12.2013
Is there anyway to loop functions to shorten the code? At the moment, I am destroying 241 objects from Object0 to Object241, which means 242 lines of code. Can it be shortened in anyway?
Код:
DestroyPlayerObject(playerid, Object0);
AW: Looping functions -
CutX - 29.12.2013
create the objects in an array, like:
PHP код:
new SomeArray[10];
//creating the objects
SomeArray[0] = Createobj.....
SomeArray[1] = cre.....
//and so on till
SomeArray[9] = Creat.....
//then you can use a loop to destroy them.
for(new i=0; i<10; i++)
{
DestroyObject(SomeArray[i]);
}