From d509c15c829b19b97685d747bbbd58f2cc6ea8dc Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Wed, 28 Dec 2016 16:16:39 -0500 Subject: [PATCH] Split player_death into scheduled and unscheduled #1833 Death message was sometimes showing incorrectly due to spawn delay. Also the sched_corpses two minute loop was occasionally deleting bodies right away because bodyName setVariable was delayed by the time it took PVDZ_plr_death to send (up to a few seconds). See #1825 --- CHANGE LOG 1.0.6.1.txt | 2 + SQF/dayz_code/compile/fn_damageHandler.sqf | 4 +- SQF/dayz_code/compile/player_antiWall.sqf | 6 +- SQF/dayz_code/compile/player_death.sqf | 235 +++++++++--------- SQF/dayz_code/medical/setup_functions_med.sqf | 2 +- SQF/dayz_code/system/BIS_Effects/init.sqf | 2 +- SQF/dayz_code/system/player_spawn_2.sqf | 2 +- .../system/scheduler/sched_medical.sqf | 10 +- .../compile/server_onPlayerDisconnect.sqf | 16 +- SQF/dayz_server/compile/server_playerDied.sqf | 1 + .../system/scheduler/sched_corpses.sqf | 14 +- Server Files/Battleye/scripts.txt | 2 +- 12 files changed, 147 insertions(+), 149 deletions(-) diff --git a/CHANGE LOG 1.0.6.1.txt b/CHANGE LOG 1.0.6.1.txt index 27ddbb761..56e705407 100644 --- a/CHANGE LOG 1.0.6.1.txt +++ b/CHANGE LOG 1.0.6.1.txt @@ -16,6 +16,8 @@ [FIXED] M24 ammo prices are now 1/4 of DMR ammo prices, so no profit can be made by combining M24 rounds. @looter809 @ebayShopper [FIXED] Full cinderblock walls now work properly with vector building #1813. @DeVloek @icomrade [FIXED] Death message showing incorrectly when players suicide under certain conditions. @oiad @ebayShopper +[FIXED] Death message sometimes showing incorrectly due to spawn delay. #1833 @schwanzkopfhegel @ebayShopper +[FIXED] Corpses occasionally being deleted right away due to delay between PVS and bodyName setVariable. #1825 @ebayShopper [FIXED] WoodenArrow and other WeaponHolderBase inherited objects catching fire when destroyed due to destrType. #1815 @DeVloek @ebayShopper [FIXED] Arrows floating in air when shot at same position against a wall multiple times. #1815 @DeVloek @ebayShopper [FIXED] Swimming in ground glitch when relogging at certain positions on certain maps like Napf and Tavi. @ebayShopper diff --git a/SQF/dayz_code/compile/fn_damageHandler.sqf b/SQF/dayz_code/compile/fn_damageHandler.sqf index 04bd6e9dc..96f76e5ce 100644 --- a/SQF/dayz_code/compile/fn_damageHandler.sqf +++ b/SQF/dayz_code/compile/fn_damageHandler.sqf @@ -409,7 +409,7 @@ if (_type == 1) then { if (_damage > 4) then { //serious ballistic damage if (_unit == player) then { - _id = [_source,"explosion",_ammo] spawn player_death; + [_source,"explosion",_ammo] call player_death; }; } else { if (_damage > 2) then { @@ -429,7 +429,7 @@ if (_type == 2) then { if (_damage > 4) then { //serious ballistic damage if (_unit == player) then { - _id = [_source,"shotheavy"] spawn player_death; + [_source,"shotheavy"] call player_death; }; } else { if (_damage > 2) then { diff --git a/SQF/dayz_code/compile/player_antiWall.sqf b/SQF/dayz_code/compile/player_antiWall.sqf index 38adb7fe6..b63707c34 100644 --- a/SQF/dayz_code/compile/player_antiWall.sqf +++ b/SQF/dayz_code/compile/player_antiWall.sqf @@ -2,7 +2,7 @@ DayZ Epoch anti wall Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ -private ["_vehicle","_vehiclePos","_playerPos","_activated","_id","_intersectsWith"]; +private ["_vehicle","_vehiclePos","_playerPos","_activated","_intersectsWith"]; _activated = false; _vehicle = _this; @@ -40,7 +40,7 @@ if(_activated) then { call { if (DZE_AntiWallCounter == DZE_AntiWallLimit) exitWith { localize "str_epoch_player_9" call dayz_rollingMessages; - _id = [player,"crushed"] spawn player_death; + [player,"crushed"] call player_death; }; if ((_vehicle emptyPositions "driver") > 0) exitWith { localize "STR_EPOCH_ACTIONS_15" call dayz_rollingMessages; @@ -64,7 +64,7 @@ if(_activated) then { }; // kill player if none of the above are matched localize "str_epoch_player_9" call dayz_rollingMessages; - _id = [player,"crushed"] spawn player_death; + [player,"crushed"] call player_death; }; } else { diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index d93dc31f3..1ebb166a2 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -1,57 +1,42 @@ -private ["_pos","_display","_body","_playerID","_array","_source","_method","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup","_model","_infected","_distance","_sourceVehicleType","_sourceWeapon","_sourceName","_ammo"]; -disableSerialization; -if (count _this == 0) then { - //Spawned from Killed EH (engine death), this should be rare - //Wait to see if sched_medical 1s loop spawns with _source and _method (blood<=0 death) - uiSleep 1; -}; +//SetDamage immediately so Arma registers the player as dead. if (deathHandled) exitWith {}; deathHandled = true; +player setDamage 1; -//Prevent client freezes -_display = findDisplay 49; -if (!isNull _display) then {_display closeDisplay 0;}; -if (dialog) then {closeDialog 0;}; -if (visibleMap) then {openMap false;}; +private ["_ammo","_body","_distance","_infected","_playerID","_sourceName","_sourceWeapon","_sourceVehicleType","_isBandit","_punishment","_humanityHit","_myKills","_kills","_killsV"]; _body = player; _playerID = getPlayerUID player; -disableUserInput true; -//add weapon on back to player if (dayz_onBack != "") then { - //Add weapon on back to body. _body addWeapon dayz_onBack; - /* - //Add weapon on back to the ground. - _pos = _body modeltoWorld [1,1,0]; - //_pos set [2, 0]; - _item = createVehicle ["WeaponHolder", _pos, [], 0.0, "CAN_COLLIDE"]; - _item setPosATL [_pos select 0, _pos select 1, ((_pos select 2) + 0.1)]; - _item addWeaponCargoGlobal [dayz_onBack,1]; - */ }; + +//Get killer information immediately. Weapon, distance or vehicle can change in seconds. _infected = if (r_player_infected && DZE_PlayerZed) then {1} else {0}; -_method = "unknown"; _sourceName = "unknown"; _sourceWeapon = ""; _distance = 0; -if (count _this > 0) then { - _source = _this select 0; - _method = _this select 1; - _ammo = if (count _this > 2) then {_this select 2} else {""}; - - if (!isNull _source) then { - if (!isNull _body) then {_distance = round (_body distance _source);}; - _sourceVehicleType = typeOf (vehicle _source); - _sourceWeapon = if (_sourceVehicleType isKindOf "LandVehicle" or _sourceVehicleType isKindOf "Air" or _sourceVehicleType isKindOf "Ship") then {_sourceVehicleType} else {currentWeapon _source}; - if (_sourceWeapon == "Throw") then {_sourceWeapon = (weaponState _source) select 3;}; - if (_ammo in ["PipeBomb","Mine","MineE"]) then {_sourceWeapon = _ammo;}; - if (alive _source) then { - _sourceName = if (isPlayer _source) then {name _source} else {localize "STR_PLAYER_AI"}; - }; - if (_source == _body) then {_sourceName = dayz_playerName;}; + +_source = if (typeName (_this select 0) == "ARRAY") then {(_this select 0) select 1} else {_this select 0}; +_method = switch true do { + case (_this select 1 != "find"): {_this select 1}; //Manually passed method + case (dayz_lastDamageSource != "none" && diag_tickTime - dayz_lastDamageTime < 30): {dayz_lastDamageSource}; //Major event takes priority for cause of death (shot, fell, crash, etc.) + case (dayz_lastMedicalSource != "none" && diag_tickTime - dayz_lastMedicalTime < 10): {dayz_lastMedicalSource}; //Starve, Dehyd, Sick + default {"bled"}; //No other damage sources in last 30 seconds +}; +_ammo = if (count _this > 2) then {_this select 2} else {""}; + +if (!isNull _source) then { + if (!isNull _body) then {_distance = round (_body distance _source);}; + _sourceVehicleType = typeOf (vehicle _source); + _sourceWeapon = if (_sourceVehicleType isKindOf "LandVehicle" or _sourceVehicleType isKindOf "Air" or _sourceVehicleType isKindOf "Ship") then {_sourceVehicleType} else {currentWeapon _source}; + if (_sourceWeapon == "Throw") then {_sourceWeapon = (weaponState _source) select 3;}; + if (_ammo in ["PipeBomb","Mine","MineE"]) then {_sourceWeapon = _ammo;}; + if (alive _source) then { + _sourceName = if (isPlayer _source) then {name _source} else {localize "STR_PLAYER_AI"}; }; + if (_source == _body) then {_sourceName = dayz_playerName;}; }; //Send Death Notice @@ -59,100 +44,108 @@ diag_log format["Player_Death: Body:%1 BodyName:%2 Infected:%3 SourceName:%4 Sou PVDZ_plr_Death = [dayz_characterID,0,_body,_playerID,toArray dayz_playerName,_infected,toArray _sourceName,toArray _sourceWeapon,_distance,toArray _method]; //Send name as array to avoid publicVariable value restrictions publicVariableServer "PVDZ_plr_Death"; -_id = [player,20,true,getPosATL player] call player_alertZombies; -uiSleep 0.5; -player setDamage 1; -if (dayz_soundMuted) then {call player_toggleSoundMute;}; // hide icon before fadeSound -0.1 fadeSound 0; +_body setVariable ["deathType",_method,true]; -player setVariable ["NORRN_unconscious", false, true]; -player setVariable ["unconsciousTime", 0, true]; -player setVariable ["USEC_isCardiac",false,true]; -player setVariable ["medForceUpdate",true,true]; -player setVariable ["bloodTaken", false, true]; -player setVariable ["startcombattimer", 0]; //remove combat timer on death -player setVariable ["inCombat", false, true]; -r_player_unconscious = false; -r_player_cardiac = false; -_model = typeOf player; -dayz_autoRun = false; +if (!local _source && isPlayer _source) then { + _isBandit = (player getVariable["humanity",0]) <= -2000; + //_isBandit = (typeOf player in ["Bandit1_DZ","BanditW1_DZ"]); + + //if you are a bandit or start first - player will not recieve humanity drop + _punishment = ((_isBandit or {player getVariable ["OpenTarget",false]}) && !(player isKindOf "PZombie_VB")); + _humanityHit = 0; -_array = _this; -if (count _array > 0) then { - _source = _array select 0; - _method = _array select 1; - if (!local _source && isPlayer _source) then { - _isBandit = (player getVariable["humanity",0]) <= -2000; - //_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]); - - //if you are a bandit or start first - player will not recieve humanity drop - _punishment = ((_isBandit or {player getVariable ["OpenTarget",false]}) && !(player isKindOf "PZombie_VB")); - _humanityHit = 0; - - if (!_punishment) then { - //I'm "not guilty" - kill me and be punished - _myKills = (player getVariable ["humanKills",0]) * 33.3; - // how many non bandit players have I (the dead player) killed? - // punish my killer 2000 for shooting a surivor - // but subtract 500 for each survivor I've murdered - _humanityHit = -(2000 - _myKills); - _kills = _source getVariable ["humanKills",0]; - _source setVariable ["humanKills",(_kills + 1),true]; - PVDZ_send = [_source,"Humanity",[_humanityHit,300]]; - publicVariableServer "PVDZ_send"; - } else { - //i'm "guilty" - kill me as bandit - _killsV = _source getVariable ["banditKills",0]; - _source setVariable ["banditKills",(_killsV + 1),true]; - }; - - //Setup for study bodys. - _body setVariable ["KillingBlow",[_source,_punishment],true]; + if (!_punishment) then { + //I'm "not guilty" - kill me and be punished + _myKills = (player getVariable ["humanKills",0]) * 33.3; + // how many non bandit players have I (the dead player) killed? + // punish my killer 2000 for shooting a surivor + // but subtract 500 for each survivor I've murdered + _humanityHit = -(2000 - _myKills); + _kills = _source getVariable ["humanKills",0]; + _source setVariable ["humanKills",(_kills + 1),true]; + PVDZ_send = [_source,"Humanity",[_humanityHit,300]]; + publicVariableServer "PVDZ_send"; + } else { + //i'm "guilty" - kill me as bandit + _killsV = _source getVariable ["banditKills",0]; + _source setVariable ["banditKills",(_killsV + 1),true]; }; - _body setVariable ["deathType",_method,true]; + + //Setup for study bodys. + _body setVariable ["KillingBlow",[_source,_punishment],true]; }; -terminate dayz_musicH; -terminate dayz_slowCheck; -terminate dayz_monitor1; +[] spawn { + private ["_display","_body","_myGroup"]; + disableSerialization; -//Reset (just in case) -//deleteVehicle dayz_playerTrigger; -//disableUserInput false; -r_player_dead = true; + //Prevent client freezes + _display = findDisplay 49; + if (!isNull _display) then {_display closeDisplay 0;}; + if (dialog) then {closeDialog 0;}; + if (visibleMap) then {openMap false;}; -//Player is dead! -3 fadeSound 0; -uiSleep 1; + _body = player; + disableUserInput true; -dayz_originalPlayer enableSimulation true; -addSwitchableUnit dayz_originalPlayer; -setPlayable dayz_originalPlayer; -selectPlayer dayz_originalPlayer; + _id = [player,20,true,getPosATL player] call player_alertZombies; + uiSleep 0.5; + if (dayz_soundMuted) then {call player_toggleSoundMute;}; // hide icon before fadeSound + 0.1 fadeSound 0; -_myGroup = group _body; -[_body] joinSilent dayz_firstGroup; -deleteGroup _myGroup; -80000 cutText ["","PLAIN"]; //Clear group icons + player setVariable ["NORRN_unconscious", false, true]; + player setVariable ["unconsciousTime", 0, true]; + player setVariable ["USEC_isCardiac",false,true]; + player setVariable ["medForceUpdate",true,true]; + player setVariable ["bloodTaken", false, true]; + player setVariable ["startcombattimer", 0]; //remove combat timer on death + player setVariable ["inCombat", false, true]; + r_player_unconscious = false; + r_player_cardiac = false; + dayz_autoRun = false; -3 cutRsc ["default", "PLAIN",3]; -4 cutRsc ["default", "PLAIN",3]; + terminate dayz_musicH; + terminate dayz_slowCheck; + terminate dayz_monitor1; -_body setVariable["combattimeout", 0, true]; -//due to a cleanup issue with effects this has been disabled remember to look at the cleanup before adding it back. -//dayzFlies = player; -//publicVariable "dayzFlies"; -uiSleep 2; -1 cutRsc [if (DZE_DeathScreen) then {"DeathScreen_DZE"} else {"DeathScreen_DZ"},"BLACK OUT",3]; -playMusic "dayz_track_death_1"; -uiSleep 2; + //Reset (just in case) + //deleteVehicle dayz_playerTrigger; + //disableUserInput false; + r_player_dead = true; -for "_x" from 5 to 1 step -1 do { - titleText [format[localize "str_return_lobby", _x], "PLAIN DOWN", 1]; + //Player is dead! + 3 fadeSound 0; uiSleep 1; -}; -PVDZ_Server_Simulation = [_body, false]; -publicVariableServer "PVDZ_Server_Simulation"; + dayz_originalPlayer enableSimulation true; + addSwitchableUnit dayz_originalPlayer; + setPlayable dayz_originalPlayer; + selectPlayer dayz_originalPlayer; -endMission "END1"; \ No newline at end of file + _myGroup = group _body; + [_body] joinSilent dayz_firstGroup; + deleteGroup _myGroup; + 80000 cutText ["","PLAIN"]; //Clear group icons + + 3 cutRsc ["default", "PLAIN",3]; + 4 cutRsc ["default", "PLAIN",3]; + + _body setVariable["combattimeout", 0, true]; + //due to a cleanup issue with effects this has been disabled remember to look at the cleanup before adding it back. + //dayzFlies = player; + //publicVariable "dayzFlies"; + uiSleep 2; + 1 cutRsc [if (DZE_DeathScreen) then {"DeathScreen_DZE"} else {"DeathScreen_DZ"},"BLACK OUT",3]; + playMusic "dayz_track_death_1"; + uiSleep 2; + + for "_x" from 5 to 1 step -1 do { + titleText [format[localize "str_return_lobby", _x], "PLAIN DOWN", 1]; + uiSleep 1; + }; + + PVDZ_Server_Simulation = [_body, false]; + publicVariableServer "PVDZ_Server_Simulation"; + + endMission "END1"; +}; \ No newline at end of file diff --git a/SQF/dayz_code/medical/setup_functions_med.sqf b/SQF/dayz_code/medical/setup_functions_med.sqf index ff004c5c3..ac25c2770 100644 --- a/SQF/dayz_code/medical/setup_functions_med.sqf +++ b/SQF/dayz_code/medical/setup_functions_med.sqf @@ -8,7 +8,7 @@ fnc_usec_damageHandle = { _unit = _this select 0; mydamage_eh1 = _unit addeventhandler ["HandleDamage",{_this call fnc_usec_damageHandler;} ]; mydamage_eh2 = _unit addEventHandler ["Fired", {_this call player_fired;}]; - mydamage_eh3 = _unit addEventHandler ["Killed", {_id = [] spawn player_death;}]; + mydamage_eh3 = _unit addEventHandler ["Killed", {[_this,"find"] call player_death;}]; }; fnc_usec_pitchWhine = { diff --git a/SQF/dayz_code/system/BIS_Effects/init.sqf b/SQF/dayz_code/system/BIS_Effects/init.sqf index c594210b8..087de2f8f 100644 --- a/SQF/dayz_code/system/BIS_Effects/init.sqf +++ b/SQF/dayz_code/system/BIS_Effects/init.sqf @@ -33,7 +33,7 @@ BIS_Effects_startEvent = { } count DZE_SafeZonePosArray; player action ["getOut", (_this select 0)]; if (!_cancel && {!((_this select 0) iskindof "car")}) then { - [player, "explosion"] spawn player_death; + [player, "explosion"] call player_death; }; }; }; diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index ef3fd5f33..12d5c5029 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -230,7 +230,7 @@ while {1 == 1} do { }; _result = r_player_blood - _bloodloss; if (_result < 0) then { - _id = [player,"rad"] spawn player_death; + [player,"rad"] call player_death; } else { r_player_blood = _result; }; diff --git a/SQF/dayz_code/system/scheduler/sched_medical.sqf b/SQF/dayz_code/system/scheduler/sched_medical.sqf index a07129d82..7d1057955 100644 --- a/SQF/dayz_code/system/scheduler/sched_medical.sqf +++ b/SQF/dayz_code/system/scheduler/sched_medical.sqf @@ -18,7 +18,7 @@ sched_medical_slow = { // 10 seconds sched_medical_init = { [ []spawn{} ] }; sched_medical = { // 1 second HIDE_FSM_VARS - private ["_method","_unconHdlr"]; + private "_unconHdlr"; _unconHdlr = _this select 0; if (r_player_blood == 12000) then { @@ -27,14 +27,8 @@ sched_medical = { // 1 second //r_player_unconscious = getVariable ["NORRN_unconscious", true]; - _method = switch (true) do { - case (dayz_lastDamageSource != "none" && diag_tickTime - dayz_lastDamageTime < 30): {dayz_lastDamageSource}; //Major event takes priority for cause of death - case (dayz_lastMedicalSource != "none" && diag_tickTime - dayz_lastMedicalTime < 10): {dayz_lastMedicalSource}; //Starve, Dehyd, Sick - default {"bled"}; //No other damage sources in last 30 seconds - }; - if (r_player_blood <= 0) then { - [dayz_sourceBleeding, _method] spawn player_death; + [dayz_sourceBleeding,"find"] call player_death; }; if (!canStand player) then { // be consistant with player_updateGui.sqf diff --git a/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf b/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf index 741cf80ee..7208701bb 100644 --- a/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf +++ b/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf @@ -1,7 +1,6 @@ /* - WARNING: The player object is deleted by Arma shortly after onPlayerDisconnected fires - because DayZ uses disabledAI=true: - https://community.bistudio.com/wiki/Description.ext#disabledAI + WARNING: Alive player objects are deleted by Arma shortly after onPlayerDisconnected fires + because DayZ uses disabledAI=1 https://community.bistudio.com/wiki/Description.ext#disabledAI References to the player object after that point will return objNull, so this function and server_playerSync must be fast or the player will not save. @@ -12,14 +11,14 @@ _playerUID = _this select 0; _playerName = _this select 1; _playerObj = nil; -//Lets search all playerable units looking for the objects that matches our playerUID +//Lets search all players looking for the object that matches our UID { if ((getPlayerUID _x) == _playerUID) exitWith { _playerObj = _x; _playerPos = getPosATL _playerObj;}; } count playableUnits; -//If for some reason the playerOBj does not exist lets exit the disconnect system. +//If playerObj is not in playableUnits then lets exit the disconnect system. if (isNil "_playerObj") exitWith { - diag_log format["%1: nil player object, _this:%2", __FILE__, _this]; + diag_log format["%1: Player object is not in playableUnits. This is normal if the player just died. _this:%2", __FILE__, _this]; }; //diag_log format["get: %1 (%2), sent: %3 (%4)",typeName (getPlayerUID _playerObj), getPlayerUID _playerObj, typeName _playerUID, _playerUID]; @@ -31,7 +30,8 @@ _inCombat = _playerObj getVariable ["inCombat",false]; _Sepsis = _playerObj getVariable["USEC_Sepsis",false]; //Login processing do not sync -if (_playerUID in dayz_ghostPlayers) exitwith { +if (_playerUID in dayz_ghostPlayers) exitWith { + //Note player is alive (see set in dayz_ghostPlayers below) diag_log format["ERROR: Cannot Sync Character [%1,%2] Still processing login",_playerName,_playerUID]; //Lets remove the object. @@ -81,7 +81,7 @@ if (_characterID != "?") then { {[_x,"gear"] call server_updateObject} count (nearestObjects [_playerPos,DayZ_GearedObjects,10]); }; - [_playerUID,_characterID,3,_playerName,((getPosATL _playerObj) call fa_coor2str)] call dayz_recordLogin; + [_playerUID,_characterID,3,_playerName,(_playerPos call fa_coor2str)] call dayz_recordLogin; }; if (alive _playerObj) then { diff --git a/SQF/dayz_server/compile/server_playerDied.sqf b/SQF/dayz_server/compile/server_playerDied.sqf index 12ce711f4..0166f7619 100644 --- a/SQF/dayz_server/compile/server_playerDied.sqf +++ b/SQF/dayz_server/compile/server_playerDied.sqf @@ -63,6 +63,7 @@ if (_playerName != "unknown" or _sourceName != "unknown") then { if (toLower DZE_DeathMsgChat != "none" or DZE_DeathMsgRolling or DZE_DeathMsgDynamicText) then { PVDZE_deathMessage = _message; //Don't use regular PV here since JIP clients don't need it + owner _newObject publicVariableClient "PVDZE_deathMessage"; //Send to dead player (not in playableUnits) { if (isPlayer _x) then { owner _x publicVariableClient "PVDZE_deathMessage"; diff --git a/SQF/dayz_server/system/scheduler/sched_corpses.sqf b/SQF/dayz_server/system/scheduler/sched_corpses.sqf index 4a829974d..869a21ffd 100644 --- a/SQF/dayz_server/system/scheduler/sched_corpses.sqf +++ b/SQF/dayz_server/system/scheduler/sched_corpses.sqf @@ -41,8 +41,8 @@ sched_corpses = { } else { //Only spawn flies on actual dead player, otherwise delete the body (clean up left over ghost from relogging, sometimes it is not deleted automatically by Arma or onPlayerDisconnect) //AI mods will need to setVariable "bodyName" on their dead units to prevent them being cleaned up + _deathTime = _x getVariable ["sched_co_deathTime", -1]; if (_x getVariable["bodyName",""] != "") then { - _deathTime = _x getVariable ["sched_co_deathTime", -1]; if (_deathTime == -1) then { _deathPos = _x getVariable ["deathPos",respawn_west_original]; /*_cpos = getPosATL _x; @@ -101,8 +101,16 @@ sched_corpses = { publicVariable "PVCDZ_flies"; }; } else { - _x call sched_co_deleteVehicle; - _delQtyG = _delQtyG + 1; + if (_deathTime == -1) then { + _deathTime = diag_tickTime; + _x setVariable ["sched_co_deathTime", _deathTime]; + } else { + // Wait 30s to make sure the server had time to setVariable "bodyName". PVDZ_plr_Death can be delayed by a few seconds. + if (diag_tickTime - _deathTime > 30) then { + _x call sched_co_deleteVehicle; + _delQtyG = _delQtyG + 1; + }; + }; }; }; }; diff --git a/Server Files/Battleye/scripts.txt b/Server Files/Battleye/scripts.txt index caddcbeeb..af9c0b6b1 100644 --- a/Server Files/Battleye/scripts.txt +++ b/Server Files/Battleye/scripts.txt @@ -30,7 +30,7 @@ 5 playableUnits !"for [{_y=0},{_y < count(playableUnits)},{_y=_y+1}] do {" !"typeName player == \"OBJECT\")}) AND {((player in playableUnits) AND {(alive player)" !"(1 max count playableUnits)) min (dayz_maxAnimals - _count))) to 1 step -1 do {" !"AND {((alive _x) AND {((vehicle _x) distance _obj < 150)})}} count playableUnits)}) then {" !="_local = { _unit distance _x < _dis; } count playableUnits <= 1;" !"if (!_isOk) exitWith {false};\nuiSleep 0.001;\n} forEach playableUnits;" !"ManagementMustBeClose) then { player nearEntities [\"CAManBase\", 10] } else { playableUnits };" 5 selectPlayer !"dayz_originalPlayer enableSimulation true;\naddSwitchableUnit dayz_originalPlayer;\nsetPlayable dayz_originalPlayer;\nselectPlayer dayz_originalPlayer;" !"addSwitchableUnit _newUnit;\nsetPlayable _newUnit;\nselectPlayer _newUnit;" 5 serverCommand !="_character = if (serverCommandAvailable \"#kick\") then { call sched_tg_follow } else { player };" !"serverCommand (\"#kick \" + _selectedName);" -5 setDamage !"([4654,9595,0] nearestObject 145259) setDamage 1;\n([4654,9595,0] nearestObject 145260) setDamage 1;" !"if (_entity isKindOf \"Animal\") then {\n_entity setDamage 1;" !"_tree setDamage 1;\ndayz_choppedTrees set [count dayz_choppedTrees,_tree];" !="if ((alive player) && (r_fracture_legs or {player isKindOf 'PZombie_VB'})) then { player SetDamage 1;};" !"_id = [player,20,true,getPosATL player] call player_alertZombies;\nuiSleep 0.5;\nplayer setDamage 1;" !"\n_obj setDamage (damage _obj) + _damage;\n" !"if(\"\" == typeOf _tree) then {\n_tree setDamage 1;\n};" !"if (_ent isKindOf \"Animal\" || _ent isKindOf \"zZombie_base\") then {\n_ent setDamage 1;" +5 setDamage !"([4654,9595,0] nearestObject 145259) setDamage 1;\n([4654,9595,0] nearestObject 145260) setDamage 1;" !"if (_entity isKindOf \"Animal\") then {\n_entity setDamage 1;" !"_tree setDamage 1;\ndayz_choppedTrees set [count dayz_choppedTrees,_tree];" !="if ((alive player) && (r_fracture_legs or {player isKindOf 'PZombie_VB'})) then { player SetDamage 1;};" !"if (deathHandled) exitWith {};\ndeathHandled = true;\nplayer setDamage 1;" !"\n_obj setDamage (damage _obj) + _damage;\n" !"if(\"\" == typeOf _tree) then {\n_tree setDamage 1;\n};" !"if (_ent isKindOf \"Animal\" || _ent isKindOf \"zZombie_base\") then {\n_ent setDamage 1;" 5 setDammage 5 SetEventHandler !="_menu ctrlSetEventHandler [\"ButtonClick\",_compile];" !="inGameUISetEventHandler [\"PrevAction\",\"false\"];" !="inGameUISetEventHandler [\"NextAction\",\"false\"];" !="inGameUISetEventHandler [\"Action\",\"false\"];" 5 setMarkerAlpha