array vs simple - 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: array vs simple (
/showthread.php?tid=650425)
array vs simple -
PepsiCola23 - 27.02.2018
so i got like 50-100 objects and i was wondering whats the best way to add them to gamemode.
should i simply add them createdynamicobject for each one or should i use an array?
like
PHP код:
{x1,z1,y1},
{x2,z2,y2}
and create a function that loops trough the array and creates the objects?
Re: array vs simple -
RogueDrifter - 27.02.2018
why'd you create a variable? are you going to use them later on? move/destroy them? or are they just gonna be there?
Re: array vs simple -
Sew_Sumi - 27.02.2018
If you're tracking them for later usage, then you could use an array. This would also be an idea if you are doing a 'reload map' function.
Re: array vs simple -
PepsiCola23 - 27.02.2018
i wanted to use the same coordinates to create a checkpoint at every object.
in this case,an array would be better right?
Re: array vs simple -
RogueDrifter - 27.02.2018
Quote:
Originally Posted by PepsiCola23
i wanted to use the same coordinates to create a checkpoint at every object.
in this case,an array would be better right?
|
What's the point in linking both anyways? that's not going to affect anything, if you're going to use the objects later then okay you can define variables to link them to it, otherwise nah just create it normally no point in creating useless variables.
Re: array vs simple -
PepsiCola23 - 27.02.2018
it would`ve been easier for me to loop trough the array to create the objects and also use the array afterward for a random cp..
Re: array vs simple -
RogueDrifter - 27.02.2018
Quote:
Originally Posted by PepsiCola23
it would`ve been easier for me to loop trough the array to create the objects and also use the array afterward for a random cp..
|
Why use an array for objects you'll never use later on hah?
Re: array vs simple -
PepsiCola23 - 27.02.2018
You dont get it.
I am going to use the array to generate a random cp(same coordinates as the objects). In this case,if the array is there why shouldnt i use it to generate the objects too?
Re: array vs simple -
RogueDrifter - 27.02.2018
Quote:
Originally Posted by PepsiCola23
You dont get it.
I am going to use the array to generate a random cp(same coordinates as the objects). In this case,if the array is there why shouldnt i use it to generate the objects too?
|
because i highly doubt this'll be accurate seeing as the spot of cps wouldn't be same as the exact building's coords, my point stands, you don't need to link them to anything unless if you use (move/destroy..etc) them.
Re: array vs simple -
PepsiCola23 - 27.02.2018
Quote:
Originally Posted by RogueDrifter
because i highly doubt this'll be accurate seeing as the spot of cps wouldn't be same as the exact building's coords, my point stands, you don't need to link them to anything unless if you use (move/destroy..etc) them.
|
i said,the coords of the cp will be the exact same as the objects cp`s..