SA-MP Forums Archive
Creating an array at the bottom of script - 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: Creating an array at the bottom of script (/showthread.php?tid=550123)



Creating an array at the bottom of script - Schneider - 10.12.2014

Hello,

I am currently working on a new filterscript which uses an multidimensional array of about 10.000 coordinates:

Example:
pawn Код:
new Float:Example[][5] =
{
    {1682.0, 739.0, -2780.0, 116.0, 2.0},
    {1387.0, 182.0, -860.0, 142.0, 2.0},
    {-2116.0, 1312.0, 304.0, 234.0, 2.0},
    {-2436.0, 719.0, -681.0, 45.0, 2.0},
    {2936.0, -986.0, -2468.0, 226.0, 2.0},
    {462.0, 2159.0, -2953.0, 102.0, 2.0},
    {-2808.0, 1295.0, -2112.0, 197.0, 2.0},
    //10.000 more lines....
};
Since it's a huge amount of lines, you have to scroll a long way to reach my callbacks and other functions. Putting this array at the bottom of my script will give me errors ("Undefined symbol").

So I was wondering, is there some way so I can put this array at the bottom of the script?

Thank you!


Re: Creating an array at the bottom of script - Luis- - 10.12.2014

No, sadly. The script needs to read the array first, if it doesn't it'll say it's undefined.


Re: Creating an array at the bottom of script - Kimossab - 10.12.2014

put that in a include, simply create a new txt file put #include <a_samp> and write the array in there and save it as array.inc or something like that, save it to the folder pawno/includes. In your gm/fs put #include <array>


Re: Creating an array at the bottom of script - Schneider - 10.12.2014

Thank you very much!


Re: Creating an array at the bottom of script - Kimossab - 10.12.2014

you're welcome, btw, since it's an include you don't need it with the amx file when it's to put it in the server, just sayin' xD


Re: Creating an array at the bottom of script - Pottus - 11.12.2014

Definitely the way to go I do the same thing if the amount of data is going to be excessive it makes sense and if you want to change data sets for testing you only need to edit one line to select a different include.