SA-MP Forums Archive
Redefine array ? - 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: Redefine array ? (/showthread.php?tid=81608)



Redefine array ? - Zmbl - 12.06.2009

Hello,

Is there a way to quickly redefine whole parts of an array, without redefining all its items?

For instance :

Global array:
new Race[MAX_PLAYERS][255][3];

Then, in a function :

Race[playerid][0] = {1, 2, 3};

I tried it but it didn't work ("Array has to be indexed" error), so I was thinking if there were a workaround ^^

Thanks


Re: Redefine array ? - Luca Dimonte - 12.06.2009

In my knowledge, it's not possible.

When you write

new Race[playerid][0] = {1, 2, 3};

you can do that because you create and fill the variables at the same time, but it works only because the compiler arrange the vars and values for the compiled file in the space for initialization, so when you execute the program first of all it reads vars and stores values before the program starts to run.

On realtime execution you can't do that, just store values in vars, one by one.


Re: Redefine array ? - Zmbl - 12.06.2009

Thanks for your answer I will do it manually, so...