Jump to content
Sign in to follow this  
ohally

Draw Arguments from .txt file

Recommended Posts

Hello all,

I am attempting to establish a type of permissions system on my server. The goal here is to utilize a script similar to that used in MSO for ARMA 2 in the MP Rights function.

I have a .txt file located in my ARMA 3 Main directory on my server.

I want to draw that and have the script check the player's UID against the list in the .txt file to determine if the player is permitted to use those functions:

Here is the .txt file

///TCCC QUALIFIED///
[
"76561198xxxxxx657"  
]

This is the player_init.sqf run on each player when they enter the server:

_uid = getplayerUID player;

_tccc_file = "\1cpb\tccc_quals.txt";

[_tccc_file] spawn {
               private ["_tccc_file","_TCCC"];
               _tccc_file = _this select 0;
			_TCCC = call compile preprocessFile _tccc_file;

			if (_uid in _TCCC) then {

				Hint "You ARE TCCC";

				} else {

				Hint "You are not TCCC";

				};

		};

any assistance or direction would be much appreciated.

Edited by Ohally

Share this post


Link to post
Share on other sites

Why not just move the array of ID's into the script, so it can be directly accessed?

Share this post


Link to post
Share on other sites
Why not just move the array of ID's into the script, so it can be directly accessed?

so that it can be updated without have to re-upload the mission file.

Share this post


Link to post
Share on other sites
so that it can be updated without have to re-upload the mission file.

Ahh, read over the file located on the server part :p.

Could you make the .txt an .sqf that looks like the below:

_IDs = ["##", "##", "##"];

_IDs;//return the array of ID's

Then in your player_init.sqf:

_IDs = [] execVM "\1cpb\tccc_quals.sqf";

Sorry if this isn't what your looking for, I'm getting tired and brain dead :p.

EDIT: And actually, you've already done this, it's just a .txt instead of an .sqf.

Share this post


Link to post
Share on other sites
so that it can be updated without have to re-upload the mission file.

You will still have to restart the mission even if you get this to work though, which I hope you do. I'm searching for a way to do this too.

Share this post


Link to post
Share on other sites
Ahh, read over the file located on the server part :p.

Could you make the .txt an .sqf that looks like the below:

_IDs = ["##", "##", "##"];

_IDs;//return the array of ID's

Then in your player_init.sqf:

_IDs = [] execVM "\1cpb\tccc_quals.sqf";

Sorry if this isn't what your looking for, I'm getting tired and brain dead :p.

EDIT: And actually, you've already done this, it's just a .txt instead of an .sqf.

won't execVM only check within the mission folder?

Share this post


Link to post
Share on other sites
won't execVM only check within the mission folder?

I just typed that out, you can still use call compile preprocessFile, it still gets a return value, so just try out making it an sqf that returns the array of IDs, then call compile, then it should fill your "_TCCC" variable with the array, or at least I hope :p.

Share this post


Link to post
Share on other sites

No dice, doesn't appear to access the external file at all.

Share this post


Link to post
Share on other sites
Maybe you could have a server side script that checks UIDs? onuserconnected looks useful maybe? https://community.bistudio.com/wiki/ArmA:_Server_Side_Scripting

I think I see what you're suggesting, however im not sure how to implement this "onUserConnected" to run the script. I know it must go in the server_config file, my concern is this script will add certain items to the players inventory if they appear in the UID list. Will "onUserConnected" do that, or does that refer to entering the lobby?

Share this post


Link to post
Share on other sites

You know I'm not sure. But I do know people have been making server side -only- scripts that remain explicitly on their server (not mission directory), to bogart their missions. Where the mission is reliant on said script to function. Mainly for people not wanting other servers to utilize their mission(s) by simple snagging it from the MPmission cache.

There are some very knowledgeable people in this regard. I'm surprised no one has provided a solution for you. Well.. maybe they want to bogart the solution too? LOL. Cheers.

Share this post


Link to post
Share on other sites

Just loadFile or preprocessFile if you have comments and such, should do the job. Does not have to be a .sqf

myIDs.txt

//Members IDs
[ "123", "456" ];

some script

myIDArray = call compile preprocessfile "myIDs.txt";

Share this post


Link to post
Share on other sites
Just loadFile or preprocessFile if you have comments and such, should do the job. Does not have to be a .sqf

myIDs.txt

//Members IDs
[ "123", "456" ];

some script

myIDArray = call compile preprocessfile "myIDs.txt";

He already has that on line 8 of the OP, but it doesn't seem to be working, unless it's another issue?

Share this post


Link to post
Share on other sites

Sorry didnt read it properly.

You are not passing the UID into the spawned thread.

Share this post


Link to post
Share on other sites
He's not passing _uid to the spawned thread.

Wow...it was really that simple wasn't it...lol (well maybe :p)

_uid = getplayerUID player;

_tccc_file = "\1cpb\tccc_quals.txt";

[_tccc_file, _uid] spawn {
               private ["_tccc_file","_TCCC", "_uid"];
               _tccc_file = _this select 0;
               _uid = _this select 1;
			_TCCC = call compile preprocessFile _tccc_file;

			if (_uid in _TCCC) then {

				Hint "You ARE TCCC";

				} else {

				Hint "You are not TCCC";

				};

		};

Share this post


Link to post
Share on other sites

At first I was like; where the heck is _uid defined? Is player_init some BI event file? Is _uid a magic variable? LOL.

Share this post


Link to post
Share on other sites
won't execVM only check within the mission folder?

Just so you know this for future reference, using a \ in front of the folder name means go to the game directory for the folder e.g.

"\stuff\stuff.sqf" is inside the game install folder

"stuff\stuff.sqf" is inside the mission pbo

Share this post


Link to post
Share on other sites
Just so you know this for future reference, using a \ in front of the folder name means go to the game directory for the folder e.g.

"\stuff\stuff.sqf" is inside the game install folder

"stuff\stuff.sqf" is inside the mission pbo

And just to add some more from the BIKI on execVM command:

The Script is first searched for in the mission folder, then in the campaign scripts folder and finally in the global scripts folder.

Share this post


Link to post
Share on other sites

Works!! thanks,

Had 1 other issue for anyone else trying this. The folder name 1CPB was causing an issue, can't seem to start with a number, changed to Scripts_1CPB worked great!

Cheers

Share this post


Link to post
Share on other sites

Does anyone know if this still works?

EDIT: need to use -filePatching

Share this post


Link to post
Share on other sites

Hi there

 

Sorry to bring up an old post!

 

I'm trying to make a server where anyone who has been whitelisted can access zeus (however not slot based) I have seen this done on other servers!

(I know about the #adminLogged but that only allows for 1 zeus at a time)

 

Is this the way you are meant to do that?

 

Thanks

Jayden

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×