Jump to content
Nilia

Serverside Slot Whitelist

Recommended Posts

Hi,

I'm currently trying to write a script, which allows me to whitelist various Slots across Missions (Mainly Zeus), without using CBA or a Database (since I have no clue how to use them).

Ideally I want to be able to call my corresponding function, e.g. Nilia_fnc_Zeus in the corresponding unit's init.

I tried a lot, but every time I get the function working on my Local Multiplayer, it does not work on my dedicated Server.

I am able to call my function (in local MP) via onPreloadstarted '[this] call Nilia_fnc_Zeus'; in the Unit's init.

My Function I tested last looks like this:

if (!hasInterface) exitWith {};

waitUntil {alive player};

params ["_unit"];

if (! (local _unit)) exitWith {};

private _uid = getPlayerUID player;

private _WL = [ "ID 1",
                "ID 2"
                ];


if (!(_uid in _WL)) then {
titleText["This Slot requires you to be Whitelisted","BLACK",8];
endMission "END1";
} else {
    systemChat "You are Whitelisted!";
};

Thank you very much for your help!

Share this post


Link to post
Share on other sites

@pierremgi explains initialization order from Init fields on this topic.

I put some examples below his reply that expand a little bit.

I think that's what is going on in your case.

FYI I would skip on onPreloadstarted unless you really need it.

Cheers.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you very much! You lead me to a working solution 😄

For the Init i have:

0 = this spawn { 
		if !(hasInterface) exitWith{}; 
		waitUntil {!isNull findDisplay 46}; 
		if !(local _this) exitWith{}; 
		_this call Nilia_fnc_Zeus; //Whitelist Script 
		_this call Nilia_fnc_Loadout_Tropen_KpFhr; //Loadout
};
this setVariable ["f_languages",["en","gr","ru","ar"]]; 

My Whitelist Script looks like this:

if (!hasInterface) exitWith {};

private _unit = player;

if (! (local _unit)) exitWith {};

private _uid = getPlayerUID _unit;

private _WL = [ "ID1",	/* Player 1 */
                "ID2"	/* Player 2 */
                ];


if (!(_uid in _WL)) then {
titleText["This Slot requires you to be Whitelisted.","BLACK",8];
sleep 8;
endMission "END1";
} else {
    systemChat "You are Whitelisted!";
};

 

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, Nilia said:

You lead me to a working solution 😄

Sweet! I'm glad you got it working 😎

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

×