SA-MP Forums Archive
How to delete all objects onfsexit? - 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: How to delete all objects onfsexit? (/showthread.php?tid=165417)



How to delete all objects onfsexit? - Toni - 04.08.2010

How would you destroy all objects onfsexit?

I have an array with 115 objects assigned to it, how, possibly would i delete them with a loop?

I tried

pawn Код:
for(new i = 0; i < Rocket[115]; i++)
{
DestroyDynamicObject(Rocket[i]);
}
return1;
but it says the array is out of index bounds.


Re: How to delete all objects onfsexit? - PotH3Ad - 04.08.2010

pawn Код:
for(new i = 0; i < sizeof(Rocket)-1; i++)
{
    DestroyDynamicObject(Rocket[i]);
}
return 1;



Re: How to delete all objects onfsexit? - Toni - 04.08.2010

Quote:
Originally Posted by PotH3Ad
Посмотреть сообщение
pawn Код:
for(new i = 0; i < sizeof(Rocket)-1; i++)
{
    DestroyDynamicObject(Rocket[i]);
}
return 1;
Thanks. Wouldn't -1 on rocket make the loop only delete 0-114?

EDIT:

Code worked, still wondering about that question.


Re: How to delete all objects onfsexit? - Kar - 04.08.2010

-1 means all

like in incognito's streamer -1 for playerid -1 means all playerids


Re: How to delete all objects onfsexit? - Toni - 04.08.2010

Ah, didn't know that, thank you.


Re: How to delete all objects onfsexit? - PotH3Ad - 04.08.2010

Arrays start with 0. (Rocket[0-114])

Quote:
Originally Posted by The Toni
Посмотреть сообщение
Thanks. Wouldn't -1 on rocket make the loop only delete 0-114?
Yea...