Create array with default values - 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: Create array with default values (
/showthread.php?tid=109177)
Create array with default values -
xomka - 18.11.2009
I need to create an array, for example, with default values in it {-1, -1, FLOAT_NAN, FLOAT_NAN, FLOAT_NAN, -1}
how can I do that in easy way? Not loop through it to set those values
Re: Create array with default values -
LarzI - 18.11.2009
There was recently a topic about this...
Use an enum (search for 'array enum' with the forum search button, I'm sure you'll find the topic)
EDIT: Found it... :P
http://forum.sa-mp.com/index.php?topic=134200.0
Re: Create array with default values -
xomka - 18.11.2009
searching doesn't work for me
my array is
pawn Code:
enum E_PICKUPS
{
p_model,
p_type,
Float:p_x,
Float:p_y,
Float:p_z,
p_virtualworld
}
new Pickups[MAX_PICKUPS][E_PICKUPS];
so I can not initialise it like this:
pawn Code:
new Pickups[MAX_PICKUPS][E_PICKUPS] = {
{-1, -1, FLOAT_NAN, FLOAT_NAN, FLOAT_NAN, -1}, ...
};
Re: Create array with default values -
yom - 18.11.2009
As far as i know, it's not possible for multidimensional arrays.