From bc21f81f03fbc2f5ee21ebbe6f95e3b7ae935c64 Mon Sep 17 00:00:00 2001 From: Skaronator Date: Sun, 2 Feb 2014 20:15:34 +0100 Subject: [PATCH] Done is Done, make the rest of it to a localSetVariable --- SQF/dayz_code/compile/player_lockVault.sqf | 18 +++--------------- SQF/dayz_code/init/publicEH.sqf | 3 ++- SQF/dayz_server/init/server_functions.sqf | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/SQF/dayz_code/compile/player_lockVault.sqf b/SQF/dayz_code/compile/player_lockVault.sqf index aa7ae66f3..06aa1c1ae 100644 --- a/SQF/dayz_code/compile/player_lockVault.sqf +++ b/SQF/dayz_code/compile/player_lockVault.sqf @@ -58,23 +58,11 @@ if(!isNull _obj) then { _holder setVariable["ObjectUID",_objectUID,true]; _holder setVariable ["OEMPos", _pos, true]; - _weapons = getWeaponCargo _obj; - _magazines = getMagazineCargo _obj; - _backpacks = getBackpackCargo _obj; - + PVDZE_obj_setlocalVars = [_obj,_holder]; + publicVariableServer "PVDZE_obj_setlocalVars"; + // remove vault deleteVehicle _obj; - - // 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"]; }; 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..dea83dc0d 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -914,4 +914,25 @@ 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; + + 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