mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
fixes and cleanup
This commit is contained in:
@@ -3,10 +3,6 @@ private ["_array","_type","_classname","_holder","_config","_isOk","_muzzles","_
|
|||||||
// Exit if player zombie
|
// Exit if player zombie
|
||||||
if(player isKindOf "PZombie_VB") exitWith {};
|
if(player isKindOf "PZombie_VB") exitWith {};
|
||||||
|
|
||||||
// Test cannot lock while another player is nearby
|
|
||||||
// _playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
|
|
||||||
// if(_playerNear) exitWith {cutText ["Cannot take item while another player is nearby." , "PLAIN DOWN"]; };
|
|
||||||
|
|
||||||
if (!DZE_CanPickup) exitWith { cutText [(localize "str_epoch_player_38") , "PLAIN DOWN"]; };
|
if (!DZE_CanPickup) exitWith { cutText [(localize "str_epoch_player_38") , "PLAIN DOWN"]; };
|
||||||
DZE_CanPickup = false;
|
DZE_CanPickup = false;
|
||||||
|
|
||||||
@@ -15,55 +11,40 @@ _type = _array select 0;
|
|||||||
_classname = _array select 1;
|
_classname = _array select 1;
|
||||||
_holder = _array select 2;
|
_holder = _array select 2;
|
||||||
|
|
||||||
_playerID = getPlayerUID player;
|
// if holder is null disallow pickup for 5 seconds
|
||||||
_text = getText (configFile >> _type >> _classname >> "displayName");
|
if(isNull _holder) exitWith {
|
||||||
|
[] spawn {
|
||||||
_claimedBy = _holder getVariable["claimed","0"];
|
sleep 5;
|
||||||
|
DZE_CanPickup = true;
|
||||||
// Check if any players are nearby if not allow player to claim item.
|
};
|
||||||
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
|
|
||||||
|
|
||||||
// Only allow if not already claimed.
|
|
||||||
if (_claimedBy == "0" or !_playerNear) then {
|
|
||||||
// Since item was not claimed proceed with claiming it.
|
|
||||||
_holder setVariable["claimed",_playerID,true];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if(_classname isKindOf "TrapBear") exitwith {DZE_CanPickup = true; deleteVehicle _holder;};
|
// Check if closest player
|
||||||
|
|
||||||
player playActionNow "PutDown";
|
|
||||||
|
|
||||||
_claimedBy = _holder getVariable["claimed","0"];
|
|
||||||
|
|
||||||
if (_claimedBy != _playerID) exitWith {sleep 1; DZE_CanPickup = true; cutText [format[(localize "str_player_beinglooted"),_text] , "PLAIN DOWN"]};
|
|
||||||
|
|
||||||
// test to see if item still exists just before adding and removing
|
|
||||||
if(isNull _holder) exitWith { sleep 1; DZE_CanPickup = true; };
|
|
||||||
|
|
||||||
if(_classname isKindOf "Bag_Base_EP1") then {
|
|
||||||
|
|
||||||
_PlayerNear = _holder call dze_isnearest_player;
|
_PlayerNear = _holder call dze_isnearest_player;
|
||||||
if (_PlayerNear) exitWith {cutText [localize "str_pickup_limit_4", "PLAIN DOWN"]};
|
if (_PlayerNear) exitWith {cutText [localize "str_pickup_limit_4", "PLAIN DOWN"]};
|
||||||
|
|
||||||
diag_log("Picked up a bag: " + _classname);
|
_text = getText (configFile >> _type >> _classname >> "displayName");
|
||||||
|
|
||||||
|
player playActionNow "PutDown";
|
||||||
|
|
||||||
|
if(_classname isKindOf "TrapBear") exitwith {DZE_CanPickup = true; deleteVehicle _holder;};
|
||||||
|
|
||||||
|
if(_classname isKindOf "Bag_Base_EP1") exitwith {
|
||||||
|
// diag_log("Picked up a bag: " + _classname);
|
||||||
|
if(_classname == typeOf _holder) then {
|
||||||
player action ["TakeBag", _holder];
|
player action ["TakeBag", _holder];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_obj = nearestObjects [(getPosATL player), [(typeOf _holder)], 5];
|
_obj = nearestObjects [(getPosATL player), [(typeOf _holder)], 5];
|
||||||
_qty = count _obj;
|
_qty = count _obj;
|
||||||
|
|
||||||
if(_qty >= 1) then {
|
if(_qty >= 1) then {
|
||||||
|
|
||||||
//Remove melee magazines (BIS_fnc_invAdd fix) (add new melee ammo to array if needed)
|
|
||||||
{player removeMagazines _x} forEach ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Fishing_Swing","sledge_swing"];
|
|
||||||
|
|
||||||
_config = (configFile >> _type >> _classname);
|
_config = (configFile >> _type >> _classname);
|
||||||
_isOk = [player,_config] call BIS_fnc_invAdd;
|
_isOk = [player,_config] call BIS_fnc_invAdd;
|
||||||
if (_isOk) then {
|
if (_isOk) then {
|
||||||
|
|
||||||
deleteVehicle _holder;
|
deleteVehicle _holder;
|
||||||
if (_classname in ["MeleeHatchet","MeleeCrowbar","MeleeMachete","MeleeFishingPole","MeleeSledge"]) then {
|
if (_classname in ["MeleeHatchet","MeleeCrowbar","MeleeMachete","MeleeFishingPole","MeleeSledge"]) then {
|
||||||
|
|
||||||
if (_type == "cfgWeapons") then {
|
if (_type == "cfgWeapons") then {
|
||||||
_muzzles = getArray(configFile >> "cfgWeapons" >> _classname >> "muzzles");
|
_muzzles = getArray(configFile >> "cfgWeapons" >> _classname >> "muzzles");
|
||||||
//_wtype = ((weapons player) select 0);
|
//_wtype = ((weapons player) select 0);
|
||||||
@@ -74,19 +55,11 @@ if(_qty >= 1) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//adding melee mags back if needed
|
|
||||||
switch (primaryWeapon player) do
|
|
||||||
{
|
|
||||||
case "MeleeHatchet": {player addMagazine 'Hatchet_Swing';};
|
|
||||||
case "MeleeCrowbar": {player addMagazine 'Crowbar_Swing';};
|
|
||||||
case "MeleeMachete": {player addMagazine 'Machete_Swing';};
|
|
||||||
case "MeleeFishingPole": {player addMagazine 'Fishing_Swing';};
|
|
||||||
case "MeleeSledge": {player addMagazine 'sledge_swing';};
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sleep 1;
|
// disallow another pickup action for 5 seconds.
|
||||||
|
[] spawn {
|
||||||
|
sleep 5;
|
||||||
DZE_CanPickup = true;
|
DZE_CanPickup = true;
|
||||||
|
};
|
||||||
@@ -3,29 +3,28 @@
|
|||||||
Usage: [_obj] spawn player_unlockVault;
|
Usage: [_obj] spawn player_unlockVault;
|
||||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
||||||
*/
|
*/
|
||||||
private ["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_holder","_weapons","_magazines","_backpacks","_objWpnTypes","_objWpnQty","_countr","_alreadyPacking","_playerNear","_playerID","_claimedBy","_unlockedClass","_text"];
|
private ["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_holder","_weapons","_magazines","_backpacks","_objWpnTypes","_objWpnQty","_countr","_alreadyPacking","_playerNear","_playerID","_claimedBy","_unlockedClass","_text","_nul","_objType"];
|
||||||
|
|
||||||
if(TradeInprogress) exitWith { cutText [(localize "str_epoch_player_21") , "PLAIN DOWN"]; };
|
if(TradeInprogress) exitWith { cutText [(localize "str_epoch_player_21") , "PLAIN DOWN"]; };
|
||||||
TradeInprogress = true;
|
TradeInprogress = true;
|
||||||
|
|
||||||
_obj = _this;
|
|
||||||
|
|
||||||
_playerNear = _obj call dze_isnearest_player;
|
|
||||||
|
|
||||||
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_20") , "PLAIN DOWN"]; };
|
|
||||||
|
|
||||||
_unlockedClass = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "unlockedClass");
|
|
||||||
_text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
|
|
||||||
|
|
||||||
_alreadyPacking = _obj getVariable["packing",0];
|
|
||||||
_claimedBy = _obj getVariable["claimed","0"];
|
|
||||||
|
|
||||||
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
|
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
|
||||||
s_player_unlockvault = 1;
|
s_player_unlockvault = 1;
|
||||||
|
|
||||||
|
_obj = _this;
|
||||||
|
_objType = typeOf _obj;
|
||||||
|
|
||||||
|
_playerNear = _obj call dze_isnearest_player;
|
||||||
|
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_20") , "PLAIN DOWN"]; };
|
||||||
|
|
||||||
// Silently exit if object no longer exists or alive
|
// Silently exit if object no longer exists or alive
|
||||||
if(isNull _obj or !(alive _obj)) exitWith { TradeInprogress = false; };
|
if(isNull _obj or !(alive _obj)) exitWith { TradeInprogress = false; };
|
||||||
|
|
||||||
|
_unlockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "unlockedClass");
|
||||||
|
_text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
|
||||||
|
|
||||||
|
_alreadyPacking = _obj getVariable["packing",0];
|
||||||
|
_claimedBy = _obj getVariable["claimed","0"];
|
||||||
_ownerID = _obj getVariable["CharacterID","0"];
|
_ownerID = _obj getVariable["CharacterID","0"];
|
||||||
|
|
||||||
if (_alreadyPacking == 1) exitWith {TradeInprogress = false; cutText [format[(localize "str_epoch_player_124"),_text], "PLAIN DOWN"]};
|
if (_alreadyPacking == 1) exitWith {TradeInprogress = false; cutText [format[(localize "str_epoch_player_124"),_text], "PLAIN DOWN"]};
|
||||||
@@ -35,7 +34,6 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
|
|||||||
|
|
||||||
// Check if any players are nearby if not allow player to claim item.
|
// Check if any players are nearby if not allow player to claim item.
|
||||||
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
|
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
|
||||||
|
|
||||||
_playerID = getPlayerUID player;
|
_playerID = getPlayerUID player;
|
||||||
|
|
||||||
// Only allow if not already claimed.
|
// Only allow if not already claimed.
|
||||||
@@ -57,15 +55,15 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
|
|||||||
|
|
||||||
_obj setVariable["packing",1];
|
_obj setVariable["packing",1];
|
||||||
|
|
||||||
_weapons = _obj getVariable["WeaponCargo",[]];
|
|
||||||
_magazines = _obj getVariable["MagazineCargo",[]];
|
|
||||||
_backpacks = _obj getVariable["BackpackCargo",[]];
|
|
||||||
|
|
||||||
player playActionNow "Medic";
|
player playActionNow "Medic";
|
||||||
sleep 1;
|
sleep 1;
|
||||||
[player,"tentpack",0,false] call dayz_zombieSpeak;
|
[player,"tentpack",0,false] call dayz_zombieSpeak;
|
||||||
sleep 5;
|
sleep 5;
|
||||||
|
|
||||||
|
_weapons = _obj getVariable["WeaponCargo",[]];
|
||||||
|
_magazines = _obj getVariable["MagazineCargo",[]];
|
||||||
|
_backpacks = _obj getVariable["BackpackCargo",[]];
|
||||||
|
|
||||||
_holder = createVehicle [_unlockedClass,_pos,[], 0, "CAN_COLLIDE"];
|
_holder = createVehicle [_unlockedClass,_pos,[], 0, "CAN_COLLIDE"];
|
||||||
// Remove locked vault
|
// Remove locked vault
|
||||||
deleteVehicle _obj;
|
deleteVehicle _obj;
|
||||||
@@ -121,7 +119,7 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
|
|||||||
player playActionNow "Medic";
|
player playActionNow "Medic";
|
||||||
sleep 1;
|
sleep 1;
|
||||||
[player,"repair",0,false] call dayz_zombieSpeak;
|
[player,"repair",0,false] call dayz_zombieSpeak;
|
||||||
null = [player,25,true,(getPosATL player)] spawn player_alertZombies;
|
_nul = [player,25,true,(getPosATL player)] spawn player_alertZombies;
|
||||||
sleep 5;
|
sleep 5;
|
||||||
cutText [format[(localize "str_epoch_player_126"),_text], "PLAIN DOWN"];
|
cutText [format[(localize "str_epoch_player_126"),_text], "PLAIN DOWN"];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
|
private ["_holder","_type","_classname","_name","_actionSet"];
|
||||||
_holder = _this select 0;
|
_holder = _this select 0;
|
||||||
_type = _this select 1;
|
_type = _this select 1;
|
||||||
_classname = _this select 2;
|
_classname = _this select 2;
|
||||||
|
|
||||||
|
// Exit if player zombie
|
||||||
|
if(player isKindOf "PZombie_VB") exitWith {};
|
||||||
|
|
||||||
_name = getText (configFile >> _type >> _classname >> "displayName");
|
_name = getText (configFile >> _type >> _classname >> "displayName");
|
||||||
|
|
||||||
_actionSet = _holder getVariable["actionSet", false];
|
_actionSet = _holder getVariable["actionSet", false];
|
||||||
@@ -10,5 +14,4 @@ if (!_actionSet) then {
|
|||||||
s_player_holderPickup = _holder addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
|
s_player_holderPickup = _holder addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
|
||||||
player reveal _holder;
|
player reveal _holder;
|
||||||
_holder setVariable["actionSet", true];
|
_holder setVariable["actionSet", true];
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
private["_holder","_type","_classname","_name"];
|
private["_holder","_type","_classname","_name","_null"];
|
||||||
_holder = _this select 0;
|
_holder = _this select 0;
|
||||||
_type = _this select 1;
|
_type = _this select 1;
|
||||||
_classname = _this select 2;
|
_classname = _this select 2;
|
||||||
_name = getText (configFile >> _type >> _classname >> "displayName");
|
_name = getText (configFile >> _type >> _classname >> "displayName");
|
||||||
null = _holder addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
|
_null = _holder addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
|
||||||
player reveal _holder;
|
player reveal _holder;
|
||||||
@@ -9,7 +9,7 @@ _name = getText (configFile >> _type >> _classname >> "displayName");
|
|||||||
if(player isKindOf "PZombie_VB") exitWith {};
|
if(player isKindOf "PZombie_VB") exitWith {};
|
||||||
|
|
||||||
actionMonitor = {
|
actionMonitor = {
|
||||||
private["_holder","_type","_classname","_name","_action","_distance","_run","_timeout"];
|
private ["_holder","_type","_classname","_name","_action","_distance","_run","_timeout","_null"];
|
||||||
_holder = _this select 0;
|
_holder = _this select 0;
|
||||||
_type = _this select 1;
|
_type = _this select 1;
|
||||||
_classname = _this select 2;
|
_classname = _this select 2;
|
||||||
@@ -37,7 +37,7 @@ actionMonitor = {
|
|||||||
};
|
};
|
||||||
// Stop the loop and fall back to old code
|
// Stop the loop and fall back to old code
|
||||||
if (_distance > 100) then {
|
if (_distance > 100) then {
|
||||||
null = _holder addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
|
_null = _holder addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
|
||||||
player reveal _holder;
|
player reveal _holder;
|
||||||
_run = false;
|
_run = false;
|
||||||
_timeout = 0;
|
_timeout = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user