diff --git a/SQF/dayz_code/compile/player_lockVault.sqf b/SQF/dayz_code/compile/player_lockVault.sqf index aa7ae66f3..890d8d8c4 100644 --- a/SQF/dayz_code/compile/player_lockVault.sqf +++ b/SQF/dayz_code/compile/player_lockVault.sqf @@ -58,24 +58,9 @@ if(!isNull _obj) then { _holder setVariable["ObjectUID",_objectUID,true]; _holder setVariable ["OEMPos", _pos, true]; - _weapons = getWeaponCargo _obj; - _magazines = getMagazineCargo _obj; - _backpacks = getBackpackCargo _obj; - - // remove vault - deleteVehicle _obj; + PVDZE_obj_setlocalVars = [_obj,_holder]; + publicVariableServer "PVDZE_obj_setlocalVars"; - // Fill variables with loot - if (count _weapons > 0) then { - _holder setVariable ["WeaponCargo", _weapons, true]; - }; - if (count _magazines > 0) then { - _holder setVariable ["MagazineCargo", _magazines, true]; - }; - if (count _backpacks > 0) then { - _holder setVariable ["BackpackCargo", _backpacks, true]; - }; - cutText [format[(localize "str_epoch_player_117"),_text], "PLAIN DOWN"]; }; s_player_lockvault = -1; diff --git a/SQF/dayz_code/init/publicEH.sqf b/SQF/dayz_code/init/publicEH.sqf index 88f9a9ab1..b9f59192c 100644 --- a/SQF/dayz_code/init/publicEH.sqf +++ b/SQF/dayz_code/init/publicEH.sqf @@ -63,7 +63,8 @@ if (isServer) then { "PVDZE_plr_TradeMenu" addPublicVariableEventHandler {(_this select 1) spawn server_traders}; "PVDZE_plr_DeathB" addPublicVariableEventHandler {(_this select 1) spawn server_deaths}; - "PVDZE_obj_localVars" addPublicVariableEventHandler {(_this select 1) spawn server_getLocalObjVars}; + "PVDZE_obj_getlocalVars" addPublicVariableEventHandler {(_this select 1) spawn server_getLocalObjVars}; + "PVDZE_obj_setlocalVars" addPublicVariableEventHandler {(_this select 1) spawn server_setLocalObjVars}; }; //Client only diff --git a/SQF/dayz_server/init/server_functions.sqf b/SQF/dayz_server/init/server_functions.sqf index 4d58087e8..8558acbd1 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -914,4 +914,27 @@ server_getLocalObjVars = { PVDZE_localVarsResult = _vals; (owner _player) publicVariableClient "PVDZE_localVarsResult"; +}; + +server_setLocalObjVars = { + private ["_obj", "_holder", "_weapons", "_magazines", "_backpacks"]; + + _obj = _this select 0; + _holder = _this select 1; + + _weapons = getWeaponCargo _obj; + _magazines = getMagazineCargo _obj; + _backpacks = getBackpackCargo _obj; + + deleteVehicle _obj; + + if (count _weapons > 0) then { + _holder setVariable ["WeaponCargo", _weapons]; + }; + if (count _magazines > 0) then { + _holder setVariable ["MagazineCargo", _magazines]; + }; + if (count _backpacks > 0) then { + _holder setVariable ["BackpackCargo", _backpacks]; + }; }; \ No newline at end of file