Jump to content

Recommended Posts

Hi to all!
For my server, it was necessary to perform a whitelist for players who connect to the server.
To do this, I created a separate mod that works almost perfectly, but the problem is that checking for all given parameters occurs only after a briefing.
How to run a script in an addon loop for example when starting the server itself or when connecting the player to the server (not in the game - possibly in the lobby or simply connecting the mission selection screen).
Here is my example implementation:

config.cpp

Spoiler

class CfgPatches
{
	class Security
	{
		name = "Security";
		author = "IGL";
		requiredAddons[] = {"A3_Functions_F"};
		units[] = {};
		weapons[] = {};
	};
};

class CfgFunctions
{
	class Security
	{
		class preInit
		{
			file = "Security\functions";
			class init {preInit = 1;};
		};
	};
};

 

In config, we create a Security class and set the preInit parameter (I understand that it executes before loading the mission, and I need it when connecting to the server)

fn_init.sqf

Spoiler

// include two vars 
// IDplayers = [["IGL", "77777777777777777", "false"], ["SAD", "22222222222222222", "false"], ["MAD", "111111111111111111", "false"]]; - where name, GUID, "false" - it is not banned
// ps = "password";

#include "\userconfig\Security\config.hpp"; 

onPlayerConnected {
			
_INFplayer = [];
   {
        if !(_uid == _x select 1) then { 
        systemChat format ["%1 - no registration in witeList!", _name];  
        ps serverCommand format ["#kick %1 %2 - no registration in witeList!", _uid, _name];
        diag_log text ("Security: " + format ["#kick %1 %2 - no registration in witeList! (Checked on GUID)", _uid, _name]);		
        } else { 
                 _INFplayer append [_x];		
               }; 
   } foreach IDplayers;
waitUntil {count _INFplayer > 0};
 {
    if !("false" == _x select 2) then { 
                systemChat format ["%1 - Banned!", _name]; 
                ps serverCommand format ["#kick %1 %2 - Banned!", _uid, _name];
                diag_log text ("Security: " + format ["#kick %1 %2 - Banned! (Banned)", _uid, _name]);				
                } else { 
                        if !(_name == _x select 0) then { 
                        systemChat format ["%1 - the name not valid! (Registered in WiteList as %2)", _name, _x select 0]; 
                        ps serverCommand format ["#kick %1 %2 - the name not valid! (Registered in WiteList as %3)", _uid, _name, _x select 0];
                        diag_log text ("BG_Security: " + format ["#kick %1 %2 - the name not valid! (Registered in WiteList as - %3)", _uid, _name, _x select 0]);						
                        } else {systemChat format ["Security: %1 - Accepted.", _name];}; 
                        }; 
  } foreach _INFplayer; 
};

 

And it works as follows:

the server has a config containing an array of player data (name, guid, ban status) and an access password (required in the server configuration using the command serverCommandPassword = "010101"; specify the same password which is also in the "Security \ functions \ config.ccp").

Then after the start of the game (after the briefing) the script makes a check:
1) The presence of GUID in whiteList, if not - kick, if so then step two
2) Checking player on banned:  if paremetr false - then next step if parametr true - so does the kick.
3) Checking the registered name if it does not match what is indicated in the whiteList - kick
4) If the player passes all three checks, he successfully connected the game and receives a notification in the chat "Accepted".

 

And now my main question to the specialists (if they are still here is):
How to make this script work not when the mission starts, but when the server starts?

Any variations are accepted (When connecting the player, when starting in the lobby (but not further than the lobby), it can be a cycle or something). Maybe something smarter than this nonsense.

 

Share this post


Link to post
Share on other sites

This would generally need to be done through BattlEye itself, rather than a server-side or even client side mod, although it may be possible through a client-sided modification.

 

The method you're describing would allow you to kick them once they've joined the server and loaded in a specific slot, but not when they load into the lobby.

Share this post


Link to post
Share on other sites

Thanks for the answer. Apparently there are no adequat specialists left here who could assist in this matter.
Yes you are right. This method is works like you writed .
And my question just was to find a method to do this task.
One problem its  - run scripts in lobby.

Share this post


Link to post
Share on other sites

Hi,

 

You can use BEC, which is a BattlEye extended tools program which allows white listing of a server.

 

You can download BEC here: https://github.com/TheGamingChief/BattlEye-Extended-Controls

 

Please bear in mind that BEC is no longer updated / was discontinued a number of years ago, but BEC allows you to white-list a server as required.

 

You can also use MBCon by Maca134, which is more up to date and the readme specifies that it covers your requirements.

 

You can download MBCon here: https://github.com/maca134/MBCon

 

Please note that both can be used on both Vanilla servers, but I think there's some limitations on both regarding use on 64 bit servers but I haven't personally tested for this, so is something to just look out for.

 

You won't be able to run scripts from the mission file in the lobby upon joining, as the client hasn't actually downloaded any scripts yet. Whitelisting can on,y be done via BattlEye.

 

Please let me know if you have any questions

 

Best regards

 

Chewz

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

×