Create array with default values
#1

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
Reply
#2

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
Reply
#3

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}, ...
};
Reply
#4

As far as i know, it's not possible for multidimensional arrays.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)