Keep safe/lockbox vars server side until needed

The arrays for safes/lockboxes are kept on the server and when a client
goes to open the safe, a PV is sent to the server requesting the arrays.
Server sends info back.
This commit is contained in:
Matthew McConnell
2014-02-02 16:02:27 +00:00
parent bcc3d315ab
commit 2e08e53377
4 changed files with 46 additions and 7 deletions

View File

@@ -65,10 +65,16 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
[player,"tentpack",0,false] call dayz_zombieSpeak;
sleep 5;
_weapons = _obj getVariable["WeaponCargo",[]];
_magazines = _obj getVariable["MagazineCargo",[]];
_backpacks = _obj getVariable["BackpackCargo",[]];
PVDZE_obj_localVars = [player, _obj, ["WeaponCargo", "MagazineCargo", "BackpackCargo"]];
publicVariableServer "PVDZE_obj_localVars";
PVDZE_localVarsResult = nil;
waitUntil {sleep 1; !isNil "PVDZE_localVarsResult"};
_weapons = if (typeName (PVDZE_localVarsResult select 0) == "ARRAY") then { (PVDZE_localVarsResult select 0) } else { [] };
_magazines = if (typeName (PVDZE_localVarsResult select 1) == "ARRAY") then { (PVDZE_localVarsResult select 1) } else { [] };
_backpacks = if (typeName (PVDZE_localVarsResult select 2) == "ARRAY") then { (PVDZE_localVarsResult select 2) } else { [] };
_holder = createVehicle [_unlockedClass,_pos,[], 0, "CAN_COLLIDE"];
if ((isNull _holder) or (isNil "_holder")) then {
_holder = createVehicle [_unlockedClass,_pos,[], 0, "CAN_COLLIDE"];