Anti Combat logging - DiscoBot

superlube

Member
Hey everyone.

During the 1.7.4.4 days, there was the anti combat logging tool available that spawned a bot in replacement of a person who combat logged. The bot would last about 40 secs and have all the players gear. The bot would also sync to the database and mark the player as dead if the bot died. https://github.com/Torndeco/discobot/tree/master/compile

Has anyone had a go implementing this in 1.7.6.1? I've personally given it a go but failed.

All I really did was:

server_playerLogin
Code:
if (_playerID in botPlayers) then {
    botPlayers = botPlayers - [_playerID];
};

server_onPlayerDisconnect.sqf
Code:
if ((_timeout - time) > 0) then {
    diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];
    if (alive _object) then {
        [_playerID, _characterID, typeof _object, _object] spawn server_botSetup;
    }
};

And copied all the bot files to compile folder.
 
Scratch that, I missed the following lines in server_functions.sqf

Code:
server_botSetup =        compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_botSetup.sqf";
server_botSync =        compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_botSync.sqf";
server_botDamage =            compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_botDamage.sqf";
server_botDied =        compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_botDied.sqf";
//Get instance name (e.g. dayz_1.chernarus)
fnc_instanceName = {
    "dayz_" + str(dayz_instance) + "." + worldName
};
 
if(isNil "botPlayers") then {
    botPlayers = []
};

Everything works perfectly.
 
Oh shit this actually works properly?! Anything to screw combat loggers I'm game.

Mind if you tell me if these are correct? - I added the bot files to the compiles folder as well.
 

Attachments

  • server_onPlayerDisconnect.sqf
    1.4 KB · Views: 102
  • server_playerLogin.sqf
    9.6 KB · Views: 91
  • server_functions.sqf
    15.7 KB · Views: 102
Yea, that should work. You didn't put the lines in the server_playerLogin.sqf file though I think that only deletes the bot if the player logs back in fast enough.

Right now, the bots work great in a test environment. I will be implementing them into my main server tonight.
 
Will it look something like this:

Code:
//Variables
_inventory =    [];
_backpack =    [];
_items =        [];
_magazines =    [];
_weapons =        [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =        [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
 
if (_playerID == "") then {
    _playerID = getPlayerUID _playerObj;
};
 
if ((_playerID == "") or (isNil "_playerID")) exitWith {
    diag_log ("LOGIN FAILED: Player [" + _playerName + "] has no login ID");
};
 
// Make Players Wait 60 if Alt F4 Bot detected
 
if (_playerID in botPlayers) then {
    botPlayers = botPlayers - [_playerID];
};
//??? endLoadingScreen;
diag_log ("LOGIN ATTEMPT: " + str(_playerID) + " " + _playerName);
 
//Do Connection Attempt
_doLoop = 0;
while {_doLoop < 5} do {
    _key = format["CHILD:101:%1:%2:%3:",_playerID,dayZ_instance,_playerName];
    _primary = _key call server_hiveReadWrite;
    if (count _primary > 0) then {
        if ((_primary select 0) != "ERROR") then {
            _doLoop = 9;
        };
    };
    _doLoop = _doLoop + 1;
};
 
Back
Top