Jump to content

[Release] Anti Combat Log


f3cuk

Recommended Posts

Hi thanks for making this – love it :)

 

We been having fun running it on our test server, works like a charm. Only had this small issue….

 

If a player is in combat in a chopper and combat logs then the box is in the sky, not on the ground

We decided to use it for target practice and it blow up  :lol:

 

 

Same problem, anyone can help to fix it? :)

Link to comment
Share on other sites

  • 1 year later...
On ‎06‎.‎11‎.‎2014 at 1:02 AM, f3cuk said:

Anti Combat Log
 
Grew tired with the combat logging on our server and felt like I had to do something about it. What I came up with was actually pretty easy - and as such - has probably already been done loads of times before but since i couldn't find it -> here goes.

What this does
 
Whenever a player combat logs from the server ALL of his gear will be taken from his body and put in a crate right where he logged off. This way, when it was a malicious log, the other side has the possibility to get the (well deserved) gear. When it was an accident log, there is a good chance the box will still be there when the player logs back in and he can safely take his stuff back.
 
Installation instructions
 
1.) Unpack your dayz_server.pbo

 

2.) Open compiles/server_onPlayerdisconnect.sqf

 

Find

 


private ["

 

Replace with

 


private ["_removebackpack","_pos","_backpack","_weapons","_weapons_backpack","_magazines","_current_magazine","_magazines_backpack","_loot_box","

 

Find


_playerPos = [];

Add below


_removebackpack = false;

 
Find


	_playerObj setVariable["NORRN_unconscious",true, true];
	_playerObj setVariable["unconsciousTime",300,true];
	
	diag_log format["COMBAT LOGGED: %1 (%2) at location %3", _playerName,_timeout,(getPosATL _playerObj)];
	//diag_log format["SET UNCONCIOUSNESS: %1", _playerName];
	
	// Message whole server when player combat logs
	_message = format["PLAYER COMBAT LOGGED: %1",_playerName];
	[nil, nil, rTitleText, _message, "PLAIN"] call RE;

Replace with


        _playerObj setVariable["NORRN_unconscious",true,true];
        _playerObj setVariable["unconsciousTime",120,true];

        _pos                 = getPosAtl _playerObj;
        _backpack            = unitBackpack _playerObj;
        _weapons            = weapons _playerObj;
        _weapons_backpack     = getWeaponCargo _backpack;
        _magazines            = magazines _playerObj;
        _current_magazine    = currentMagazine _playerObj;
        _magazines_backpack = getMagazineCargo _backpack;
        _loot_box             = createVehicle ["USBasicAmmunitionBox",_pos,[],0,"CAN_COLLIDE"];

        clearMagazineCargoGlobal _loot_box;
        clearWeaponCargoGlobal _loot_box;

        {
            _loot_box addWeaponCargoGlobal [_x,1];
        } count (_weapons);

        _magazines set [(count _magazines),_current_magazine];

        {
            _loot_box addMagazineCargoGlobal [_x,1];
        } count (_magazines);

        if (typename _weapons_backpack == "ARRAY") then {

            _i = 0;

            {
                _loot_box addWeaponCargoGlobal [_x,((_weapons_backpack select 1) select _i)];
                _i = _i + 1;
            } count (_weapons_backpack select 0);

        };

        if (typename _magazines_backpack == "ARRAY") then {

            _i = 0;

            {
                _loot_box addMagazineCargoGlobal [_x,((_magazines_backpack select 1) select _i)];
                _i = _i + 1;
            } count (_magazines_backpack select 0);

        };

        if(typeOf _backpack != "") then {
            _loot_box addBackpackCargoGlobal[(typeOf _backpack),1];
        };
    
        diag_log format["COMBAT LOGGED: %1 (%2) at location %3 - DEBUG: Weapons: (%4 - %5) / Magazines: (%6 - %7) / Backpack: (%8)",_playerName,_timeout,(getPosATL _playerObj),_weapons,_weapons_backpack,_magazines,_magazines_backpack,_backpack];

        _message = format["PLAYER COMBAT LOGGED: %1",_playerName];

        [nil, nil, rTitleText, _message, "PLAIN"] call RE;

        _removebackpack = true;

        {
            _playerObj removeMagazine _x;
        } count magazines _playerObj;

        {
            _playerObj removeWeapon _x;
        } count _weapons;

Find


[_playerObj,_magazines,true,true,_isplayernearby] call server_playerSync;

Replace with


[_playerObj,_magazines,true,true,_isplayernearby,_removebackpack] call server_playerSync;

 
3.) Open compiles/server_playersync.sqf

Find

 


private ["

 

Replace with

 


private ["_removebackpack","


Find


_playerwasNearby = false;

Add below


_removebackpack = false;

Find


if ((count _this) > 4) then {
    _playerwasNearby = _this select 4;
};

Add below


if ((count _this) > 5) then {
    _removebackpack = _this select 5;
};

Find


    if (_isNewGear || _forceGear) then {
        //diag_log ("gear..."); sleep 0.05;
        _playerGear = [weapons _character,_magazines];
        //diag_log ("playerGear: " +str(_playerGear));
        _backpack = unitBackpack _character;
        if(_playerwasNearby) then {
            _empty = [[],[]];
            _playerBackp = [typeOf _backpack,_empty,_empty];
        } else {
            _playerBackp = [typeOf _backpack,getWeaponCargo _backpack,getMagazineCargo _backpack];
        };
    };

Add below


    if(_removeBackpack) then {
        _playerBackp = ["",[[],[]],[[],[]]];
    };

 
3.) That's it, save, close, repack and you're all set!

It doesnt work for me. Does it work fine with the latest Version of infiSTAR?

I have no error logs. If I logg out in combat I dont see anything in the log though, only Infistar disconnect.

And is there a better way to edit this. Maybe a SQL file or writtin as a Code?

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...