diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf index 1d06936e8..5214b1ae0 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf @@ -58,7 +58,7 @@ if ((count _VehKey2) > 0) then { if (isNil "_localResult2") then { _localResult2 = 0; } else { - PVDZ_obj_Destroy = [(_VehKey2 select 2),(_VehKey2 select 3),player,(_VehKey2 select 1),dayz_authKey]; + PVDZ_obj_Destroy = [netID player,netID (_VehKey2 select 1),dayz_authKey]; publicVariableServer "PVDZ_obj_Destroy"; //deleteVehicle (_VehKey2 select 1); }; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf index 12ccb1af7..131b00620 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf @@ -18,7 +18,7 @@ _itemsCheckArray = []; _itemsToLog = [[],[],[],"sell"]; _sellVehicle = { - private ["_damage","_tireDmg","_tires","_okToSell","_returnInfo","_hitpoints","_objectID","_objectUID","_objectCharacterId","_notSetup","_vehicle","_sellType"]; + private ["_damage","_tireDmg","_tires","_okToSell","_returnInfo","_hitpoints","_objectCharacterId","_notSetup","_vehicle","_sellType"]; _vehicle = _this select 0; _sellType = _this select 1; _returnInfo = []; @@ -42,14 +42,12 @@ _sellVehicle = { }; }; }; - _objectID = DZE_myVehicle getVariable ["ObjectID","0"]; - _objectUID = DZE_myVehicle getVariable ["ObjectUID","0"]; _objectCharacterId = DZE_myVehicle getVariable ["CharacterID","0"]; - _notSetup = (_objectID == "0" && _objectUID == "0"); + _notSetup = _objectCharacterId == "-1"; if (local DZE_myVehicle && !isNull DZE_myVehicle && alive DZE_myVehicle && !_notSetup) then { if (_okToSell) then { - _returnInfo = [_objectCharacterId, DZE_myVehicle, _objectID, _objectUID, _sellType]; + _returnInfo = [_objectCharacterId, DZE_myVehicle, _sellType]; } else { systemChat format[localize "str_epoch_player_182",typeOf DZE_myVehicle]; _returnInfo = []; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf index 6d0fac18b..a16b6a60a 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf @@ -55,7 +55,7 @@ _normalWeaps = _normalWeaps - ["soldItem"]; } count _normalWeaps; if (count _vehInfo > 0) then { - _sell = [_vehInfo, ((_vehInfo select 0) select 4), _object] call DZE_deleteTradedVehicle; + _sell = [_vehInfo, ((_vehInfo select 0) select 2), _object] call DZE_deleteTradedVehicle; if (_sell > 0) then { _returnVar set [3,[1]]; }; diff --git a/SQF/dayz_code/actions/pickupActions/object_pickup.sqf b/SQF/dayz_code/actions/pickupActions/object_pickup.sqf index 49657e19a..e7f42cd99 100644 --- a/SQF/dayz_code/actions/pickupActions/object_pickup.sqf +++ b/SQF/dayz_code/actions/pickupActions/object_pickup.sqf @@ -72,7 +72,7 @@ if (_isOk) then { ["PartWoodPile",1,1] call fn_dropItem; ["equip_duct_tape",1,1] call fn_dropItem; }; - PVDZ_obj_Destroy = [(_holder getVariable["ObjectID","0"]),(_holder getVariable["ObjectUID","0"]),player,_holder,dayz_authKey]; + PVDZ_obj_Destroy = [netID player,netID _holder,dayz_authKey]; publicVariableServer "PVDZ_obj_Destroy"; } else { deleteVehicle _holder; diff --git a/SQF/dayz_code/actions/player_destroyTent.sqf b/SQF/dayz_code/actions/player_destroyTent.sqf index 506bb07d8..a84f13885 100644 --- a/SQF/dayz_code/actions/player_destroyTent.sqf +++ b/SQF/dayz_code/actions/player_destroyTent.sqf @@ -61,7 +61,7 @@ player addMagazine _emptycan; // Added Nutrition-Factor for work ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; -PVDZ_obj_Destroy = [_objectID,_objectUID,player,_obj,dayz_authKey,false]; +PVDZ_obj_Destroy = [netID player,netID _obj,dayz_authKey,false]; publicVariableServer "PVDZ_obj_Destroy"; PVDZ_veh_Save = [_obj,"killed",false,false,dayz_playerUID,dayz_authKey]; diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index d232d3276..e398ecad9 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -70,11 +70,6 @@ s_player_maint_build = 1; local _objOwnerID = _obj getVariable["ownerPUID","0"]; local _isOwnerOfObj = (_objOwnerID == dayz_playerUID); - -local _objectID = _obj getVariable ["ObjectID","0"]; -local _objectUID = _obj getVariable ["ObjectUID","0"]; -local _hasNoID = (_objectID == "0" && _objectUID == "0"); - local _isDestructable = _obj isKindOf "BuiltItems"; local _isWreck = _objType in DZE_isWreck; local _isRemovable = _objType in DZE_isRemovable; @@ -259,7 +254,6 @@ if (_proceed && _success) then { local _iPos = _objectPos; // default refund position local _iDir = getDir _obj; // default refund direction local _selectedRemoveOutput = []; // initialize refund array - local _preventRefund = false; // in case object has no id local _bpTotal = 0; // total number of backpacks to refund call { @@ -332,7 +326,6 @@ if (_proceed && _success) then { if (_modularRefund) exitWith { {_selectedRemoveOutput set [count _selectedRemoveOutput, _x]} forEach _refund; - _preventRefund = _hasNoID; }; /////////////////////////////////////////////////////////////////////////// @@ -342,9 +335,7 @@ if (_proceed && _success) then { /////////////////////////////////////////////////////////////////////////// if (_isStorageItem) exitWith { - if (!_hasNoID) then { - _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); // refund config array - }; + _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); // refund config array local _weapons = getWeaponCargo _obj; local _magazines = getMagazineCargo _obj; @@ -380,7 +371,6 @@ if (_proceed && _success) then { /////////////////////////////////////////////////////////////////////////// _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); // refund config array - _preventRefund = _hasNoID; }; call { @@ -419,7 +409,7 @@ if (_proceed && _success) then { if (!_isWreck && !_isWreckBuilding) then { // Server performs deleteVehicle - PVDZ_obj_Destroy = [_objectID, _objectUID, player, _obj, dayz_authKey]; + PVDZ_obj_Destroy = [netID player,netID _obj, dayz_authKey]; publicVariableServer "PVDZ_obj_Destroy"; } else { deleteVehicle _obj; @@ -439,7 +429,7 @@ if (_proceed && _success) then { // /////////////////////////////////////////////////////////////////////////////////// - if (!_preventRefund && {count _selectedRemoveOutput > 0}) then { + if (count _selectedRemoveOutput > 0) then { local _item = "WeaponHolder" createVehicle [0,0,0]; _item setDir _iDir; diff --git a/SQF/dayz_code/actions/virtualGarage/player_removePad.sqf b/SQF/dayz_code/actions/virtualGarage/player_removePad.sqf index fd0e54247..33f22ce8b 100644 --- a/SQF/dayz_code/actions/virtualGarage/player_removePad.sqf +++ b/SQF/dayz_code/actions/virtualGarage/player_removePad.sqf @@ -1,22 +1,16 @@ // Written by salival (https://github.com/oiad) -private ["_hasAccess","_objectID","_objectUID","_plotCheck"]; - closeDialog 0; -_plotCheck = [player, false] call FNC_find_plots; -_hasAccess = [player,_plotCheck select 2] call FNC_check_access; +local _plotCheck = [player, false] call FNC_find_plots; +local _hasAccess = [player,_plotCheck select 2] call FNC_check_access; if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4)) then { { - _objectID = _x getVariable ["ObjectID","0"]; - _objectUID = _x getVariable ["ObjectUID","0"]; - - PVDZ_obj_Destroy = [_objectID,_objectUID,player,_x,dayz_authKey]; + PVDZ_obj_Destroy = [netID player,netID _x,dayz_authKey]; publicVariableServer "PVDZ_obj_Destroy"; - deleteVehicle _x; systemChat format[localize "STR_CL_VG_HELIPAD_REMOVED",typeOf _x]; } count (nearestObjects [_plotCheck select 2,vg_heliPads,Z_VehicleDistance]); } else { diff --git a/SQF/dayz_code/compile/player_packTent.sqf b/SQF/dayz_code/compile/player_packTent.sqf index 693dc0b74..270e60af8 100644 --- a/SQF/dayz_code/compile/player_packTent.sqf +++ b/SQF/dayz_code/compile/player_packTent.sqf @@ -77,9 +77,8 @@ if ((_ownerID == dayz_playerUID) || {_objType in ["IC_DomeTent","IC_Tent"]}) the local _magazines = getMagazineCargo _obj; local _backpacks = getBackpackCargo _obj; - PVDZ_obj_Destroy = [_objectID, _objectUID, player, _pos, dayz_authKey, false]; // delete original tent + PVDZ_obj_Destroy = [netID player,netID _obj, dayz_authKey]; // delete original tent publicVariableServer "PVDZ_obj_Destroy"; - deleteVehicle _obj; [_weapons, _magazines, _backpacks, _holder] call fn_addCargo; // pile everything onto the ground diff --git a/SQF/dayz_code/traps/functions/remove.sqf b/SQF/dayz_code/traps/functions/remove.sqf index 687c3aae3..d191e3672 100644 --- a/SQF/dayz_code/traps/functions/remove.sqf +++ b/SQF/dayz_code/traps/functions/remove.sqf @@ -1,16 +1,15 @@ -private ["_obj","_objectID","_objectUID"]; - -_obj = _this select 0; -_objectID = _obj getVariable ["ObjectID","0"]; -_objectUID = _obj getVariable ["ObjectUID","0"]; +local _obj = _this select 0; if (isServer) then { + local _objectID = _obj getVariable ["ObjectID","0"]; + local _objectUID = _obj getVariable ["ObjectUID","0"]; + [_objectID,_objectUID,_obj] call server_deleteObjDirect; } else { if (count _this == 2) then { //single use trap triggered, remove with no animation //For normal remove let object_pickup.sqf perform deletion to ensure player has room in gear first, no others remove at same time and animation runs - PVDZ_obj_Destroy = [_objectID,_objectUID,player,_obj,dayz_authKey]; + PVDZ_obj_Destroy = [netID player,netID _obj,dayz_authKey]; publicVariableServer "PVDZ_obj_Destroy"; //deleteVehicle _obj; }; diff --git a/SQF/dayz_code/traps/functions/setup.sqf b/SQF/dayz_code/traps/functions/setup.sqf index ae7ba0d35..453dafe65 100644 --- a/SQF/dayz_code/traps/functions/setup.sqf +++ b/SQF/dayz_code/traps/functions/setup.sqf @@ -1,15 +1,13 @@ -private ["_id", "_uid", "_armed"]; -_trap = _this select 0; +local _trap = _this select 0; if (!isNull _trap) then { while { true } do { - _id = _trap getVariable ["ObjectID", "0"]; - _uid = _trap getVariable ["ObjectUID", "0"]; - _armed = _trap getVariable "armed"; + + local _armed = _trap getVariable "armed"; if (isNull _trap) exitWith { /* break from loop */ }; - if (((parseNumber _id > 0) || (parseNumber _uid > 0)) && !isNil "_armed") exitWith { + if (!isNil "_armed") exitWith { if (isServer) then { dayz_traps set [count dayz_traps, _trap]; }; diff --git a/SQF/dayz_code/traps/functions/trigger.sqf b/SQF/dayz_code/traps/functions/trigger.sqf index d7c71dce9..905172e22 100644 --- a/SQF/dayz_code/traps/functions/trigger.sqf +++ b/SQF/dayz_code/traps/functions/trigger.sqf @@ -1,4 +1,4 @@ -_trap = _this select 0; +local _trap = _this select 0; if (getNumber (configFile >> "CfgVehicles" >> typeOf _trap >> "singleUse") > 0) then { [_trap,true] call remove_trap; diff --git a/SQF/dayz_server/compile/server_deleteObj.sqf b/SQF/dayz_server/compile/server_deleteObj.sqf index a5f08d6ba..cd4b1d311 100644 --- a/SQF/dayz_server/compile/server_deleteObj.sqf +++ b/SQF/dayz_server/compile/server_deleteObj.sqf @@ -1,38 +1,33 @@ /* -[_objectID,_objectUID,_activatingPlayer,_objPos,dayz_authKey] call server_deleteObj; +[netID _activatingPlayer,netID _obj,dayz_authKey] call server_deleteObj; For PV calls from the client use this function, otherwise if calling directly from the server use server_deleteObjDirect */ -private["_id","_uid","_key","_activatingPlayer","_objPos","_clientKey","_exitReason","_PlayerUID","_processDelete"]; +if (count _this < 3) exitWith {diag_log "Server_DeleteObj error: Improper parameter format";}; -if (count _this < 5) exitWith {diag_log "Server_DeleteObj error: Improper parameter format";}; -_id = _this select 0; -_uid = _this select 1; -_activatingPlayer = _this select 2; -_objPos = _this select 3; //Can be object or position if _processDelete is false -_clientKey = _this select 4; -_processDelete = [true,_this select 5] select (count _this > 5); -_PlayerUID = getPlayerUID _activatingPlayer; +local _activatingPlayer = objectFromNetID(_this select 0); +local _obj = objectFromNetID(_this select 1); +local _clientKey = _this select 2; +local _playerUID = getPlayerUID _activatingPlayer; -_exitReason = [_this,"DeleteObj",_objPos,_clientKey,_PlayerUID,_activatingPlayer] call server_verifySender; +local _exitReason = [_this,"DeleteObj",_obj,_clientKey,_playerUID,_activatingPlayer] call server_verifySender; if (_exitReason != "") exitWith {diag_log _exitReason}; -if (isServer) then { - if (_processDelete) then {deleteVehicle _objPos}; +local _id = _obj getVariable ["ObjectID","0"]; +local _uid = _obj getVariable ["ObjectUID","0"]; +_type = typeOf _obj; - if (typeName _objPos != "ARRAY") then { - _objPos = typeof _objPos; - }; - - //remove from database - if (parseNumber _id > 0) then { - //Send request - _key = format["CHILD:304:%1:",_id]; - _key call server_hiveWrite; - diag_log format["DELETE: Player %1(%2) deleted %4 with ID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _id, _objPos]; - } else { - //Send request - _key = format["CHILD:310:%1:",_uid]; - _key call server_hiveWrite; - diag_log format["DELETE: Player %1(%2) deleted %4 with UID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _uid, _objPos]; - }; +local _processDelete = [true,_this select 3] select (count _this > 3); +if (_processDelete) then {deleteVehicle _obj}; + +//remove from database +if (parseNumber _id > 0) then { + //Send request + _key = format["CHILD:304:%1:",_id]; + _key call server_hiveWrite; + diag_log format["DELETE: Player %1(%2) deleted %4 with ID: %3",(_activatingPlayer call fa_plr2str), _playerUID, _id, _type]; +} else { + //Send request + _key = format["CHILD:310:%1:",_uid]; + _key call server_hiveWrite; + diag_log format["DELETE: Player %1(%2) deleted %4 with UID: %3",(_activatingPlayer call fa_plr2str), _playerUID, _uid, _type]; };