f3cuk Posted November 6, 2014 Report Share Posted November 6, 2014 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! fr1nk, bFe, freakystyle and 4 others 7 Link to comment Share on other sites More sharing options...
PeterBeer Posted November 6, 2014 Report Share Posted November 6, 2014 Very Nice Link to comment Share on other sites More sharing options...
Tricks Posted November 6, 2014 Report Share Posted November 6, 2014 Very cool Link to comment Share on other sites More sharing options...
TNT Posted November 6, 2014 Report Share Posted November 6, 2014 =] very nice Link to comment Share on other sites More sharing options...
cen Posted November 6, 2014 Report Share Posted November 6, 2014 shouldn't you add _removebackpack to the private array at the top as well? Link to comment Share on other sites More sharing options...
Mugzy Posted November 6, 2014 Report Share Posted November 6, 2014 It would suck to get combat logged due to a glitch just before server restart. Link to comment Share on other sites More sharing options...
cen Posted November 6, 2014 Report Share Posted November 6, 2014 It would suck to get combat logged due to a glitch just before server restart. If that's truly the case, you provide evidence and the admin can easily restore gear lost. Link to comment Share on other sites More sharing options...
f3cuk Posted November 7, 2014 Author Report Share Posted November 7, 2014 shouldn't you add _removebackpack to the private array at the top as well? Ehm yes, good catch. OP edited. If that's truly the case, you provide evidence and the admin can easily restore gear lost. True, I made it so that when the combat log happens it writes a line to your RPT file with all of the information of that player. Link to comment Share on other sites More sharing options...
cen Posted November 7, 2014 Report Share Posted November 7, 2014 Ehm yes, good catch. OP edited. True, I actually made it so that when the combat log happens it actually writes a line to your RPT file with all of the information of that player. I noticed that, great add to easily see the gear that was lost! Link to comment Share on other sites More sharing options...
paddy1223 Posted November 7, 2014 Report Share Posted November 7, 2014 Thank you F3cuk as always, using this now on my server ;) Link to comment Share on other sites More sharing options...
calamity Posted November 7, 2014 Report Share Posted November 7, 2014 works great, thankz for this.. seems it duped my GPS have one in my inventory and one in the box.... other than that its working great Link to comment Share on other sites More sharing options...
calamity Posted November 7, 2014 Report Share Posted November 7, 2014 now howz about something similar for blown up vehicle gear... except loot scattered on ground ???? Link to comment Share on other sites More sharing options...
cen Posted November 7, 2014 Report Share Posted November 7, 2014 works great, thankz for this.. seems it duped my GPS have one in my inventory and one in the box.... other than that its working great Could be the skin you are wearing if it's an overwatch skin Link to comment Share on other sites More sharing options...
f3cuk Posted November 8, 2014 Author Report Share Posted November 8, 2014 Thank you F3cuk as always, using this now on my server ;) You're very welcome paddy :) works great, thankz for this.. seems it duped my GPS have one in my inventory and one in the box.... other than that its working great The duped GPS might be you activating your admin tools (which usually gives you a GPS). now howz about something similar for blown up vehicle gear... except loot scattered on ground ???? Hmm that might be doable, actually something i have thought about a number of times already but that was before i got into scripting. No promises but I'll look into it :) Tricks 1 Link to comment Share on other sites More sharing options...
f3cuk Posted November 10, 2014 Author Report Share Posted November 10, 2014 Hmm that might be doable, actually something i have thought about a number of times already but that was before i got into scripting. No promises but I'll look into it :) Okay so one major problem with this is that it would become rewarding to destroy vehicles from other players, which is something i definitely do not want to encourage. Link to comment Share on other sites More sharing options...
paddy1223 Posted November 10, 2014 Report Share Posted November 10, 2014 Im of the opinion its epoch and locked vehicles should be locked away in a garage or items stored safely. I'll glad except people destroying locked vehicles in the open for gear as its less vehicles in the database lol :P Link to comment Share on other sites More sharing options...
Nazgul Posted November 21, 2014 Report Share Posted November 21, 2014 Doesnt work for me guys. I have to put ]; after this private["_removebackpack","_pos","_backpack","_weapons","_weapons_backpack","_magazines","_current_magazine","_magazines_backpack","_loot_box"," ???? and like this if ((count _this) > 5) then { _removebackpack = _this select 5;}; 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]; }; }; <<<< have this guy and the up one in right place? Link to comment Share on other sites More sharing options...
TNT Posted December 20, 2014 Report Share Posted December 20, 2014 can you add coins (3.0)=] mayb commented out =] thanks again Link to comment Share on other sites More sharing options...
oSoDirty Posted December 20, 2014 Report Share Posted December 20, 2014 can you add coins (3.0)=] mayb commented out =] thanks again Well, Coins are more of a stat not an item, they dont have a classname. However, it may be possible to add a check wallet action to the crate it's self. The people with a definite answer to this would more than likely be the creators of the coin script. If you have scripting knowledge, you may just find the answer in the coin script it's self. Just look for the player death part and try to incorporate the 2 together. Link to comment Share on other sites More sharing options...
chucky_xxl Posted December 25, 2014 Report Share Posted December 25, 2014 Hey there, at first: great tut - thanks a lot. I just got the problem that I combat logged for a test and my dead corpse (a friend shot me once - but just to hit me and it doesnt killed me) and all my loot duplicated. I checked all files and lines and found no mistakes. My server runs at ZAP-Hosting with newest Overpoch Chernarus version. I hope you can help me to find a solution . 11:06:59 File z\addons\dayz_server\compile\server_onPlayerDisconnect.sqf, line 1 11:06:59 Error in expression <Disconnect.sqf" private [_removebackpack","_pos","_backpack","_weapons","_weapon> 11:06:59 Error position: <","_pos","_backpack","_weapons","_weapon> 11:06:59 Error Missing ] 11:06:59 File z\addons\dayz_s edit: private ["_removebackpack"," i have fixed Link to comment Share on other sites More sharing options...
Luna Posted January 3, 2015 Report Share Posted January 3, 2015 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: Link to comment Share on other sites More sharing options...
ProtossMaster Posted January 4, 2015 Report Share Posted January 4, 2015 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: If it is a big enough issue you could just create an if statement where if player is not in vehicle then it will execute the following code.. If a player is in a vehicle then it wouldn't exec this code.. Or play around with fnc_find safe position. Link to comment Share on other sites More sharing options...
Badduck Posted February 5, 2015 Report Share Posted February 5, 2015 Tested it and works good, but when you loot the box after you combat log you spawn at that location the next time you relog. Link to comment Share on other sites More sharing options...
J001 Posted February 22, 2015 Report Share Posted February 22, 2015 Question : private ["_removebackpack","_pos","_backpack","_weapons","_weapons_backpack","_magazines","_current_magazine","_magazines_backpack","_loot_box"," < is this complete as is in the instruction, or it this a typo? Link to comment Share on other sites More sharing options...
J001 Posted February 22, 2015 Report Share Posted February 22, 2015 nvm, i think he means Add to , not replace with! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now