Call array from ROOT and make it a public variable?

Ok so i noticed my antihack calls a preprocesscommand on the user lists iv been trying to replicate this to add donators to a public variable with no success, seems i cant even get the file to be read. the file is placed in the ROOT of my server not the server.pbo for example superuser.sqf contains an array "["1234567","54534534"];" from the antihack it checks this array and places you in the super user list..
i create a new file called donators.sqf add the array then i try to run this from the server monitor in the server.pbo
"#include "donatorinit.sqf";"

inside donatorinit.ssqf contains:
"DonatorList = call compile preProcessFileLineNumbers "donators.sqf"; \\This is in the root folder"

i then try to run this code from the mission folder in particular select spawn points:

"if ((getPlayerUID player) in DonatorList) then {
systemChat ('Thanks for donating!');
};"

"if ((getPlayerUID player) in ["36760198","147365254"]) then {" works so where am i going wrong
my antihack can seem to access the files in the root of the server but when i try to make it do it i cant get it to work... any help would be hugely appreciated thanks cosa
 

CommanderRetra

Moderator
Staff member
Ok, so #include is if the file is in the folder that the file you are trying to use the call is in. example - I want to call a file with #include from the server_functions.sqf, at the bottom of my server functions I would want to put
Code:
#include "donaters.sqf";
then you have to have the "donaters.sqf" in the init folder. If I wanted to call a file that was in another folder or is not a subfolder of the init.sqf folder I would use either
Code:
 execVM "\z\addons\dayz_server\donaters.sqf";
or
Code:
 call preprocessfilelinenumbers "\z\addons\dayz_server\donaters.sqf";
tl;dr:
Code:
 #include
can only be used if the file you are calling is in the same folder you are trying to call from or a subfolder of the folder you are trying to call from.
Code:
 execVM
Can be used universally as well as
Code:
 call preprocessfilelinenumbers
I suggest you don't bother with having a "donaterinit.sqf" as that is just using unnecessary processing power. Also on that note of #include and execVM and call preprocessfilelinenumbers, #Include is like copying and pasting the file at the bottom of the file you are calling it from and execVM and call preproccesssfilelinenumbers are equivleent to running its own service independant from the rest.

If I had my own "donater.sqf" I would write it like this
Code:
 _donater_list = ["#######",#######"];
if ((getPlayerUID player) in _donater_list) then {
systemChat (Thanks for donating!);
};
 
thanks commanderretra but the problem im having is the antihack is calling its user lists from the root of the server where the arma 2 server exe is ect and in the command it only shows that it is calling preprocess as "super_list.sqf" not too sure how its doing it maybe theres something else in the code im missing, im doing this just so that i dont have to add a list of donators to every folder thats calling the list and dont have to binarize the files everytime i add a donators :) again thanks for the reply im pretty close to giving up lol
 
Top