Array indexes - 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: Array indexes (
/showthread.php?tid=261052)
Array indexes -
The Woody - 11.06.2011
Hello, Im creating a bunch of vehicles and im using array indexes but i don't really understand why thats better?
because its not really easier to make so i was wondering why is it better to use array indexes? ( IF its even better ).
Thanks.
Re: Array indexes -
Bmxerlmao5288 - 11.06.2011
Persoally I Think AddStaticVehicle Is So Much Easier Because theres So many things that cannot go wrong unless self stupidiness
Re: Array indexes -
The Woody - 11.06.2011
Quote:
Originally Posted by Bmxerlmao5288
Persoally I Think AddStaticVehicle Is So Much Easier Because theres So many things that cannot go wrong unless self stupidiness
|
Yes its not that i mean.. Like this:
With:
pawn Code:
Vehicle[0] = AddStaticVehicle(..........);
Vehicle[1] = AddStaticVehicle(..........);
Vehicle[2] = AddStaticVehicle(..........);
Vehicle[3] = AddStaticVehicle(..........);
Without:
pawn Code:
Vehicle1 = AddStaticVehicle(..........);
Vehicle2 = AddStaticVehicle(..........);
Vehicle3 = AddStaticVehicle(..........);
Vehicle4 = AddStaticVehicle(..........);
Which one is best and why?
Re: Array indexes -
linuxthefish - 11.06.2011
Array indexes, they are faster and use up less memory. (Someone told me that a while ago, idk if it will be true in your context.)
Re: Array indexes -
The Woody - 11.06.2011
Quote:
Originally Posted by linuxthefish
Array indexes, they are faster and use up less memory. (Someone told me that a while ago, idk if it will be true in your context.)
|
Okay thanks. But is it possible to switch between array indexes?
Example:
pawn Code:
switch (vehicle[2]) // this won't work for some reason.. only case 2 will be called :/.
{
case 0:
{
//??
}
case 1:
{
//??
}
// and so on..
}