Advertisement
ElDubya

fn_selfActions.sqf

Feb 20th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 46.93 KB | None | 0 0
  1. scriptName "Functions\misc\fn_selfActions.sqf";
  2. /***********************************************************
  3.     ADD ACTIONS FOR SELF
  4.     - Function
  5.     - [] call fnc_usec_selfActions;
  6. ************************************************************/
  7. private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered","_isModular","_isModularDoor","_ownerKeyName","_temp_keys_names","_hasAttached","_allowTow","_liftHeli","_found","_posL","_posC","_height","_liftHelis","_attached"];
  8.  
  9. if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
  10.  
  11. _vehicle = vehicle player;
  12. _isPZombie = player isKindOf "PZombie_VB";
  13. _inVehicle = (_vehicle != player);
  14.  
  15. _onLadder =     (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  16. _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
  17.  
  18. _adminsList= call compile preProcessFileLineNumbers "superadmins.sqf";
  19. if(("Cobalt_File" in items player) and ((getPlayerUID player) in _adminsList)) then {
  20.         if (s_player_run_events < 0) then {
  21.         s_player_run_events = player addaction [("<t color=""#0074E8"">" + ("Events Menu") +"</t>"),"custom\fixes\execute.sqf","",5,false,true,"",""];
  22.         };    
  23. } else {
  24.     player removeAction s_player_run_events;
  25.     s_player_run_events = -1;
  26. };
  27.  
  28. _nearLight =    nearestObject [player,"LitObject"];
  29. _canPickLight = false;
  30. if (!isNull _nearLight) then {
  31.     if (_nearLight distance player < 4) then {
  32.         _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  33.     };
  34. };
  35.  
  36. private["_playerPos","_nearVend"];
  37.  
  38. _playerPos = getPosATL player;
  39. _nearVend = count nearestObjects [_playerPos, ["MAP_vending_machine"], 4] > 0;
  40.  
  41. if (_nearVend) then {
  42.     if (s_player_buySoda < 0) then {
  43.         s_player_buySoda = player addaction[("<t color=""#00C732"">" + ("Buy Beer") +"</t>"),"Vending\vending_drinks.sqf"];
  44.     };
  45. } else {
  46.     player removeAction s_player_buySoda;
  47.     s_player_buySoda = -1;
  48. };
  49.  
  50. if ( typeof cursorTarget == "Infostand_2_EP1" && (player distance cursorTarget) < 2  ) then {
  51.     if (s_player_bunker < 0) then {
  52.         s_player_bunker = player addaction[("<t color=""#0000ff"">" + ("Enter The Trader") +"</t>"),"scripts\trader\bunkerin.sqf","",5,false,true,"", ""];
  53.     };
  54. } else {
  55.     player removeAction s_player_bunker;
  56.     s_player_bunker = -1;
  57. };
  58.  
  59. if ( typeof cursorTarget == "Infostand_1_EP1" && (player distance cursorTarget) < 2  ) then {
  60.     if (s_player_bunkero < 0) then {
  61.         s_player_bunkero = player addaction[("<t color=""#0000ff"">" + ("Leave the Trader") +"</t>"),"scripts\trader\bunkerout.sqf","",5,false,true,"", ""];
  62.     };
  63. } else {
  64.     player removeAction s_player_bunkero;
  65.     s_player_bunkero = -1;
  66. };
  67.  
  68. //Grab Flare
  69. if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
  70.     if (s_player_grabflare < 0) then {
  71.         _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  72.         s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  73.         s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  74.     };
  75. } else {
  76.     player removeAction s_player_grabflare;
  77.     player removeAction s_player_removeflare;
  78.     s_player_grabflare = -1;
  79.     s_player_removeflare = -1;
  80. };
  81.  
  82. #include "animatedVehicles.sqf"
  83.  
  84. if (DZE_HeliLift) then {
  85.     _hasAttached = _vehicle getVariable["hasAttached",false];
  86.     if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) < 30) && (speed _vehicle < 5) && (typeName _hasAttached == "OBJECT")) then {
  87.         if (s_player_heli_detach < 0) then {
  88.             dayz_myLiftVehicle = _vehicle;
  89.             s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""];
  90.         };
  91.     } else {
  92.         dayz_myLiftVehicle removeAction s_player_heli_detach;
  93.         s_player_heli_detach = -1;
  94.     };
  95. };
  96.  
  97. if (_inVehicle && (_vehicle isKindOf "AllVehicles") && (!Earplugs)) then {
  98.  
  99.     if (s_player_put_earplugs_on < 0) then {
  100.  
  101.         airvehicle = _vehicle;
  102.  
  103.         s_player_put_earplugs_on = airvehicle addAction ["Earplugs on","custom\earplugs_on.sqf","",5,false,true];
  104.  
  105.     };
  106.  
  107.         } else {
  108.  
  109.             if (!isNil "airvehicle") then {
  110.  
  111.                 airvehicle removeAction s_player_put_earplugs_on;
  112.  
  113.                 s_player_put_earplugs_on = -1;
  114.  
  115.             };
  116.  
  117.         };
  118.  
  119.        
  120.  
  121. if (_inVehicle && (_vehicle isKindOf "AllVehicles") && (Earplugs)) then {
  122.  
  123.     if (s_player_put_earplugs_off < 0) then {
  124.  
  125.         airvehicle = _vehicle;
  126.  
  127.         s_player_put_earplugs_off = airvehicle addAction ["Earplugs off","custom\earplugs_off.sqf","",5,false,true];
  128.  
  129.     };
  130.  
  131.         } else {
  132.  
  133.             if (!isNil "airvehicle") then {
  134.  
  135.                 airvehicle removeAction s_player_put_earplugs_off;
  136.  
  137.                 s_player_put_earplugs_off = -1;
  138.  
  139.             };
  140.  
  141.         };
  142.  
  143. if(DZE_HaloJump) then {
  144.     if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
  145.         if (s_halo_action < 0) then {
  146.             DZE_myHaloVehicle = _vehicle;
  147.             s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];
  148.         };
  149.     } else {
  150.         DZE_myHaloVehicle removeAction s_halo_action;
  151.         s_halo_action = -1;
  152.     };
  153. };
  154.  
  155. if (!DZE_ForceNameTagsOff) then {
  156.     if (s_player_showname < 0 && !_isPZombie) then {
  157.         if (DZE_ForceNameTags) then {
  158.             s_player_showname = 1;
  159.             player setVariable["DZE_display_name",true,true];
  160.         } else {
  161.             s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""];
  162.             s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""];
  163.         };
  164.     };
  165. };
  166.  
  167. if(_isPZombie) then {
  168.     if (s_player_callzombies < 0) then {
  169.         s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];
  170.     };
  171.     if (DZE_PZATTACK) then {
  172.         call pz_attack;
  173.         DZE_PZATTACK = false;
  174.     };
  175.     if (s_player_pzombiesvision < 0) then {
  176.         s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];
  177.     };
  178.     if (!isNull cursorTarget && (player distance cursorTarget < 3)) then {  //Has some kind of target
  179.         _isAnimal = cursorTarget isKindOf "Animal";
  180.         _isZombie = cursorTarget isKindOf "zZombie_base";
  181.         _isHarvested = cursorTarget getVariable["meatHarvested",false];
  182.         _isMan = cursorTarget isKindOf "Man";
  183.         // Pzombie Gut human corpse || animal
  184.         if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {
  185.             if (s_player_pzombiesfeed < 0) then {
  186.                 s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
  187.             };
  188.         } else {
  189.             player removeAction s_player_pzombiesfeed;
  190.             s_player_pzombiesfeed = -1;
  191.         };
  192.     } else {
  193.         player removeAction s_player_pzombiesfeed;
  194.         s_player_pzombiesfeed = -1;
  195.     };
  196. };
  197.  
  198. // Increase distance only if AIR || SHIP
  199. _allowedDistance = 4;
  200. _isAir = cursorTarget isKindOf "Air";
  201. _isShip = cursorTarget isKindOf "Ship";
  202. if(_isAir || _isShip) then {
  203.     _allowedDistance = 8;
  204. };
  205.  
  206. if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then {   //Has some kind of target
  207.  
  208.     // set cursortarget to variable
  209.     _cursorTarget = cursorTarget;
  210.  
  211.     // get typeof cursortarget once
  212.     _typeOfCursorTarget = typeOf _cursorTarget;
  213.  
  214.     // hintsilent _typeOfCursorTarget;
  215.  
  216.     _isVehicle = _cursorTarget isKindOf "AllVehicles";
  217.     _isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  218.     _isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;
  219.    
  220.     // get items && magazines only once
  221.     _magazinesPlayer = magazines player;
  222.  
  223.     //boiled Water
  224.     _hasbottleitem = "ItemWaterbottle" in _magazinesPlayer;
  225.     _hastinitem = false;
  226.     {
  227.         if (_x in _magazinesPlayer) then {
  228.             _hastinitem = true;
  229.         };
  230.     } count boil_tin_cans;
  231.     _hasFuelE =     "ItemJerrycanEmpty" in _magazinesPlayer;
  232.     _hasFuelBarrelE =   "ItemFuelBarrelEmpty" in _magazinesPlayer;
  233.     _hasHotwireKit =    "ItemHotwireKit" in _magazinesPlayer;
  234.  
  235.     _itemsPlayer = items player;
  236.    
  237.     _temp_keys = [];
  238.     _temp_keys_names = [];
  239.     // find available keys
  240.     _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
  241.     {
  242.         if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
  243.             _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
  244.             _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
  245.             _temp_keys_names set [_ownerKeyId,_ownerKeyName];
  246.             _temp_keys set [count _temp_keys,str(_ownerKeyId)];
  247.         };
  248.     } count _itemsPlayer;
  249.  
  250.     _hasKnife =     "ItemKnife" in _itemsPlayer;
  251.     _hasToolbox =   "ItemToolbox" in _itemsPlayer;
  252.  
  253.     _isMan = _cursorTarget isKindOf "Man";
  254.     _traderType = _typeOfCursorTarget;
  255.     _ownerID = _cursorTarget getVariable ["CharacterID","0"];
  256.     _isAnimal = _cursorTarget isKindOf "Animal";
  257.     _isDog =  (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
  258.     _isZombie = _cursorTarget isKindOf "zZombie_base";
  259.     _isDestructable = _cursorTarget isKindOf "BuiltItems";
  260.     _isWreck = _typeOfCursorTarget in DZE_isWreck;
  261.     _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding;
  262.     _isModular = _cursorTarget isKindOf "ModularItems";
  263.     _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];
  264.  
  265.     _isRemovable = _typeOfCursorTarget in DZE_isRemovable;
  266.     _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];
  267.  
  268.     _isTent = _cursorTarget isKindOf "TentStorage";
  269.    
  270.     _isAlive = alive _cursorTarget;
  271.    
  272.     _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
  273.    
  274.     _rawmeat = meatraw;
  275.     _hasRawMeat = false;
  276.     {
  277.         if (_x in _magazinesPlayer) then {
  278.             _hasRawMeat = true;
  279.         };
  280.     } count _rawmeat;
  281.    
  282.     _isFuel = false;
  283.     if (_hasFuelE || _hasFuelBarrelE) then {
  284.         {
  285.             if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
  286.         } count dayz_fuelsources;
  287.     };
  288.  
  289.     // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  290.    
  291.     // logic vars
  292.     _player_flipveh = false;
  293.     _player_deleteBuild = false;
  294.     _player_lockUnlock_crtl = false;
  295.  
  296.      if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
  297.      if (s_player_plotManagement < 0) then {
  298.         _adminList = ["76561197966087279","76561198014947337"]; // Add admins here if you admins to able to manage all plotpoles
  299.         _owner = _cursorTarget getVariable ["CharacterID","0"];
  300.         _friends = _cursorTarget getVariable ["plotfriends", []];
  301.         _fuid = [];
  302.         {
  303.         _friendUID = _x select 0;
  304.         _fuid = _fuid + [_friendUID];
  305.         } forEach _friends;
  306.         _allowed = [_owner];    
  307.         _allowed = [_owner] + _adminList + _fuid;
  308.         if(_owner == dayz_characterID || (getPlayerUID player) in _allowed)then{            
  309.         s_player_plotManagement = player addAction ["<t color='#0059FF'>Manage Plot</t>", "plotManagement\initPlotManagement.sqf", [], 5, false];
  310.         };
  311.     };
  312.          if (s_player_maintain_area < 0) then {
  313.             s_player_maintain_area = player addAction [format[], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false];
  314.             s_player_maintain_area_preview = player addAction [format[], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];
  315.          };
  316.      } else {
  317.             player removeAction s_player_plotManagement;
  318.             s_player_plotManagement = -1;
  319.             player removeAction s_player_maintain_area;
  320.             s_player_maintain_area = -1;
  321.             player removeAction s_player_maintain_area_preview;
  322.             s_player_maintain_area_preview = -1;
  323.      };
  324.  
  325.     // CURSOR TARGET ALIVE
  326.     if(_isAlive) then {
  327.        
  328.         //Allow player to delete objects
  329.         //if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
  330.         if((_isDestructable && _ownerID == dayz_characterID) or _isWreck or _isRemovable or _isWreckBuilding) then {
  331.             if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  332.                 _player_deleteBuild = true;
  333.             };
  334.         };
  335.        
  336. ///Allow owners to delete modulars
  337. if(_isModular) then {
  338.         if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  339.             _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
  340.             _IsNearPlot = count (_findNearestPoles);
  341.             _fuid  = [];
  342.             _allowed = [];
  343.             if(_IsNearPlot > 0)then{
  344.                 _thePlot = _findNearestPoles select 0;
  345.                 _owner =  _thePlot getVariable ["CharacterID","010"];
  346.                 _friends = _thePlot getVariable ["plotfriends", []];
  347.                 {
  348.                   _friendUID = _x select 0;
  349.                   _fuid  =  _fuid  + [_friendUID];
  350.                 } forEach _friends;
  351.                 _allowed = [_owner];    
  352.                 _allowed = [_owner] +  _fuid;  
  353.                 if (_owner == dayz_characterID || (getPlayerUID player) in _allowed) then {  // // If u want that the object also belongs to someone on the plotpole.
  354.                     _player_deleteBuild = true;
  355.                 };                  
  356.             }else{
  357.                 if(_owner == dayz_characterID)then{
  358.                     _player_deleteBuild = true;
  359.                 };
  360.             };                                        
  361.         };
  362. };
  363. //Allow owners to delete modular doors without locks
  364. if(_isModularDoor) then {
  365.         if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {        
  366.             _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
  367.             _IsNearPlot = count (_findNearestPoles);
  368.             _fuid  = [];
  369.             _allowed = [];
  370.             if(_IsNearPlot > 0)then{
  371.                 _thePlot = _findNearestPoles select 0;
  372.                 _owner =  _thePlot getVariable ["CharacterID","010"];
  373.                 _friends = _thePlot getVariable ["plotfriends", []];
  374.                 {
  375.                   _friendUID = _x select 0;
  376.                   _fuid  =  _fuid  + [_friendUID];
  377.                 } forEach _friends;
  378.                 _allowed = [_owner];    
  379.                 _allowed = [_owner] +  _fuid;  
  380.                 if (_owner == dayz_characterID || (getPlayerUID player) in _allowed) then { //  // If u want that the object also belongs to someone on the plotpole.
  381.                     _player_deleteBuild = true;
  382.                 };                  
  383.             }else{
  384.                 if(_owner == dayz_characterID)then{
  385.                     _player_deleteBuild = true;
  386.                 };
  387.             };                              
  388.         };      
  389. };
  390.         // CURSOR TARGET VEHICLE
  391.         if(_isVehicle) then {
  392.            
  393.             //flip vehicle small vehicles by your self && all other vehicles with help nearby
  394.             if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 2) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {
  395.                 _playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);
  396.                 if(_isVehicletype || (_playersNear >= 2)) then {
  397.                     _player_flipveh = true;
  398.                 };
  399.             };
  400.  
  401.  
  402.             if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {
  403.                 _player_lockUnlock_crtl = true;
  404.             };
  405.  
  406.         };
  407.    
  408.     };
  409.  
  410.     if(_player_deleteBuild) then {
  411.         if (s_player_deleteBuild < 0) then {
  412.             s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  413.         };
  414.     } else {
  415.         player removeAction s_player_deleteBuild;
  416.         s_player_deleteBuild = -1;
  417.     };
  418.    
  419.     if (DZE_HeliLift) then {
  420.         _liftHeli = objNull;
  421.         _found = false;
  422.    
  423.         _allowTow = false;
  424.         if ((count (crew _cursorTarget)) == 0) then {
  425.             {
  426.                 if(!_allowTow) then {
  427.                     _allowTow = _cursorTarget isKindOf _x;
  428.                 };
  429.             } count DZE_HeliAllowToTow;
  430.         };
  431.  
  432.         //diag_log format["CREW: %1 ALLOW: %2",(count (crew _cursorTarget)),_allowTow];
  433.  
  434.         if (_allowTow) then {
  435.             _liftHelis = nearestObjects [player, DZE_HeliAllowTowFrom, 15];
  436.             {
  437.                 if(!_found) then {
  438.                     _posL = [_x] call FNC_getPos;
  439.                     _posC = [_cursorTarget] call FNC_getPos;
  440.                     _height = (_posL select 2) - (_posC select 2);
  441.                     _hasAttached = _x getVariable["hasAttached",false];
  442.                     if(_height < 15 && _height > 5 && (typeName _hasAttached != "OBJECT")) then {
  443.                         if(((abs((_posL select 0) - (_posC select 0))) < 10) && ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
  444.                             _liftHeli = _x;
  445.                             _found = true;
  446.                         };
  447.                     };
  448.                 };
  449.             } count _liftHelis;
  450.         };
  451.  
  452.         //diag_log format["HELI: %1 TARGET: %2",_found,_cursorTarget];
  453.  
  454.         _attached = _cursorTarget getVariable["attached",false];
  455.         if(_found && _allowTow && _canDo && !locked _cursorTarget && !_isPZombie && (typeName _attached != "OBJECT")) then {
  456.             if (s_player_heli_lift < 0) then {
  457.                 s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""];
  458.             };
  459.         } else {
  460.             player removeAction s_player_heli_lift;
  461.             s_player_heli_lift = -1;
  462.         };
  463.     };
  464.    
  465.     // Allow Owner to lock && unlock vehicle  
  466.     if(_player_lockUnlock_crtl) then {
  467.         if (s_player_lockUnlock_crtl < 0) then {
  468.             _hasKey = _ownerID in _temp_keys;
  469.             _oldOwner = (_ownerID == dayz_playerUID);
  470.             if(locked _cursorTarget) then {
  471.                 if(_hasKey || _oldOwner) then {
  472.                     _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];
  473.                     s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  474.                     s_player_lockUnlock_crtl = 1;
  475.                 } else {
  476.                     if(_hasHotwireKit) then {
  477.                         _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];
  478.                     } else {
  479.                         _Unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""];
  480.                     };
  481.                     s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  482.                     s_player_lockUnlock_crtl = 1;
  483.                 };
  484.             } else {
  485.                 if(_hasKey || _oldOwner) then {
  486.                     _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
  487.                     s_player_lockunlock set [count s_player_lockunlock,_lock];
  488.                     if (_typeOfCursorTarget in ColourVehicles) then {
  489.                     private ["_paint"];
  490.                     _paint = player addAction ["Paint", "Paint\player_paint_init.sqf",_cursorTarget, 2, true, true, "", ""];
  491.                     s_player_lockunlock set [count s_player_lockunlock,_paint];
  492.                 };
  493.                     s_player_lockUnlock_crtl = 1;
  494.                 };
  495.             };
  496.         };
  497.          
  498.     } else {
  499.         {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  500.         s_player_lockUnlock_crtl = -1;
  501.     };
  502.  
  503.     if(DZE_AllowForceSave) then {
  504.         //Allow player to force save
  505.         if((_isVehicle || _isTent) && !_isMan) then {
  506.             if (s_player_forceSave < 0) then {
  507.                 s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
  508.             };
  509.         } else {
  510.             player removeAction s_player_forceSave;
  511.             s_player_forceSave = -1;
  512.         };
  513.     };
  514.  
  515.    
  516.    
  517.     If(DZE_AllowCargoCheck) then {
  518.         if((_isVehicle || _isTent || _isnewstorage) && _isAlive && !_isMan && !locked _cursorTarget) then {
  519.             if (s_player_checkGear < 0) then {
  520.                 s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
  521.             };
  522.         } else {
  523.             player removeAction s_player_checkGear;
  524.             s_player_checkGear = -1;
  525.         };
  526.     };
  527.    
  528.    
  529.     //flip vehicle small vehicles by your self && all other vehicles with help nearby
  530.     if(_player_flipveh) then {
  531.         if (s_player_flipveh  < 0) then {
  532.             s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];     
  533.         };
  534.     } else {
  535.         player removeAction s_player_flipveh;
  536.         s_player_flipveh = -1;
  537.     };
  538.    
  539.     //Allow player to fill jerrycan
  540.     if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {
  541.         if (s_player_fillfuel < 0) then {
  542.             s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  543.         };
  544.     } else {
  545.         player removeAction s_player_fillfuel;
  546.         s_player_fillfuel = -1;
  547.     };
  548.    
  549.     // logic vars for addactions
  550.     _player_butcher = false;
  551.     _player_studybody = false;
  552.     _player_SurrenderedGear = false;
  553.    
  554.     if ( cursorTarget isKindOf "GraveDZE") then {
  555.     _player_studybody = true;
  556.     };
  557.  
  558.     // CURSOR TARGET NOT ALIVE
  559.     if (!_isAlive) then {
  560.  
  561.         // Gut animal/zed
  562.         if((_isAnimal || _isZombie) && _hasKnife) then {
  563.             _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  564.             if (!_isHarvested) then {
  565.                 _player_butcher = true;
  566.             };
  567.         };
  568.  
  569.         // Study body
  570.         if (_isMan && !_isZombie && !_isAnimal) then {
  571.             _player_studybody = true;
  572.         }
  573.     } else {
  574.         // unit alive
  575.  
  576.         // gear access on surrendered player
  577.         if(_isMan && !_isZombie && !_isAnimal) then {
  578.             _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
  579.             if (_isSurrendered) then {
  580.                 _player_SurrenderedGear = true;
  581.             };
  582.         };
  583.     };
  584.  
  585.  
  586.     // Human Gut animal || zombie
  587.     if (_player_butcher) then {
  588.         if (s_player_butcher < 0) then {
  589.             if(_isZombie) then {
  590.                 s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];
  591.             } else {
  592.                 s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
  593.             };
  594.         };
  595.     } else {
  596.         player removeAction s_player_butcher;
  597.         s_player_butcher = -1;
  598.     };
  599.  
  600.     // Study Body
  601.     if (_player_studybody) then {
  602.     if (s_player_studybody < 0) then {
  603.         s_player_studybody = player addAction [("<t color=""#FF0000"">"+("Check Wallet") + "</t>"), "ZSC\actions\check_wallet.sqf",_cursorTarget, 0, false, true, "",""];
  604.     };
  605.     } else {
  606.     player removeAction s_player_studybody;
  607.     s_player_studybody = -1;
  608.     };
  609.  
  610.     // logic vars
  611.     _player_cook = false;
  612.     _player_boil = false;
  613.  
  614.     // CURSOR TARGET IS FIRE
  615.     if (inflamed _cursorTarget) then {
  616.        
  617.         //Fireplace Actions check
  618.         if (_hasRawMeat) then {
  619.             _player_cook = true;   
  620.         };
  621.        
  622.         // Boil water
  623.         if (_hasbottleitem && _hastinitem) then {
  624.             _player_boil = true;
  625.         };
  626.     };
  627.  
  628.     if (_player_SurrenderedGear) then {
  629.         if (s_player_SurrenderedGear < 0) then {
  630.             s_player_SurrenderedGear = player addAction [localize "STR_EPOCH_ACTIONS_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];
  631.         };
  632.     } else {
  633.         player removeAction s_player_SurrenderedGear;
  634.         s_player_SurrenderedGear = -1;
  635.     };
  636.  
  637.     //Fireplace Actions check
  638.     if (_player_cook) then {
  639.         if (s_player_cook < 0) then {
  640.             s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
  641.         };
  642.     } else {
  643.         player removeAction s_player_cook;
  644.         s_player_cook = -1;
  645.     };
  646.    
  647.     // Boil water
  648.     if (_player_boil) then {
  649.         if (s_player_boil < 0) then {
  650.             s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
  651.         };
  652.     } else {
  653.         player removeAction s_player_boil;
  654.         s_player_boil = -1;
  655.     };
  656.    
  657.     if(_cursorTarget == dayz_hasFire) then {
  658.         if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {
  659.             s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
  660.         };
  661.     } else {
  662.         player removeAction s_player_fireout;
  663.         s_player_fireout = -1;
  664.     };
  665.    
  666.     //Garage
  667.     if (_typeOfCursorTarget in DZE_Garage) then {
  668.         if (s_garage_dialog < 0) then {
  669.             s_garage_dialog = player addAction ["Garage","scripts\garage\garage_menu.sqf","", 5, false, true, "", ""];
  670.         };
  671.     } else {
  672.         player removeAction s_garage_dialog;
  673.         s_garage_dialog = -1;
  674.     }; 
  675.    
  676.     //Packing my tent
  677.     if(_isTent && (player distance _cursorTarget < 3)) then {
  678.         if (_ownerID == dayz_characterID) then {
  679.             if (s_player_packtent < 0) then {
  680.                 s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
  681.             };
  682.         } else {
  683.             if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {
  684.                 if (s_player_packtent < 0) then {
  685.                     s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  686.                 };
  687.             };
  688.         };
  689.     } else {
  690.         player removeAction s_player_packtent;
  691.         s_player_packtent = -1;
  692.     };
  693.  
  694.     //Allow owner to unlock vault
  695.     if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
  696.         if (s_player_unlockvault < 0) then {
  697.             if(_typeOfCursorTarget in DZE_LockedStorage) then {
  698.                 if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
  699.                     _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
  700.                     s_player_combi set [count s_player_combi,_combi];
  701.                 } else {
  702.                     _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  703.                     s_player_combi set [count s_player_combi,_combi];
  704.                 };
  705.                 s_player_unlockvault = 1;
  706.             } else {
  707.                 if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
  708.                     _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  709.                     s_player_combi set [count s_player_combi,_combi];
  710.                     s_player_unlockvault = 1;
  711.                 };
  712.             };
  713.         };
  714.     } else {
  715.         {player removeAction _x} count s_player_combi;s_player_combi = [];
  716.         s_player_unlockvault = -1;
  717.     };
  718.    
  719.         if(_typeOfCursorTarget in ZSC_MoneyStorage && (player distance _cursorTarget < 5)) then {
  720.         if (s_bank_dialog < 0) then {
  721.                 s_bank_dialog = player addAction ["Money Storage", "ZSC\actions\bank_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
  722.         };
  723.     } else {
  724.         player removeAction s_bank_dialog;
  725.         s_bank_dialog = -1;
  726.     };
  727.  
  728.     // cars
  729.     if( _isVehicle && !_isMan &&_isAlive && !_isMan && !locked _cursorTarget && !(_cursorTarget isKindOf "Bicycle") && (player distance _cursorTarget < 5)) then {     
  730.         if (s_bank_dialog2 < 0) then {
  731.             s_bank_dialog2 = player addAction ["Money Storage", "ZSC\actions\bank_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
  732.         };         
  733.     } else {       
  734.         player removeAction s_bank_dialog2;
  735.         s_bank_dialog2 = -1;
  736.     };
  737.  
  738.     //Allow owner to pack vault
  739.     if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
  740.  
  741.         if (s_player_lockvault < 0) then {
  742.             if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
  743.                 s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
  744.             };
  745.         };
  746.         if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
  747.             s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true, "",""];
  748.         };
  749.     } else {
  750.         player removeAction s_player_packvault;
  751.         s_player_packvault = -1;
  752.         player removeAction s_player_lockvault;
  753.         s_player_lockvault = -1;
  754.     };
  755.  
  756.    
  757.  
  758.     //Player Deaths
  759.     if(_typeOfCursorTarget == "Info_Board_EP1") then {
  760.         if (s_player_information < 0) then {
  761.             s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];
  762.         };
  763.     } else {
  764.         player removeAction s_player_information;
  765.         s_player_information = -1;
  766.     };
  767.    
  768.     if (_isMan and _isAlive and !_isZombie and !_isAnimal and !(_traderType in serverTraders)) then {
  769.     if (s_givemoney_dialog < 0) then {
  770.         s_givemoney_dialog = player addAction [format["Give Money to %1", (name _cursorTarget)], "ZSC\actions\give_player_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
  771.     };
  772.     } else {
  773.     player removeAction s_givemoney_dialog;
  774.     s_givemoney_dialog = -1;
  775.     };
  776.    
  777.     //Fuel Pump
  778.     if(_typeOfCursorTarget in dayz_fuelpumparray) then {   
  779.         if (s_player_fuelauto < 0) then {
  780.            
  781.             // check if Generator_DZ is running within 30 meters
  782.             _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
  783.             _findNearestGen = [];
  784.             {
  785.                 if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
  786.                     _findNearestGen set [(count _findNearestGen),_x];
  787.                 };
  788.             } count _findNearestGens;
  789.             _IsNearRunningGen = count (_findNearestGen);
  790.            
  791.             // show that pump needs power if no generator nearby.
  792.             if(_IsNearRunningGen > 0) then {
  793.                 s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];
  794.             } else {
  795.                 s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  796.             };
  797.         };
  798.     } else {
  799.         player removeAction s_player_fuelauto;
  800.         s_player_fuelauto = -1;
  801.     };
  802.  
  803.     //Fuel Pump on truck
  804.     if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {
  805.         if (s_player_fuelauto2 < 0) then {
  806.             // show that fuel truck pump needs power.
  807.             if(isEngineOn _cursorTarget) then {
  808.                 s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];
  809.             } else {
  810.                 s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  811.             };
  812.         };
  813.     } else {
  814.         player removeAction s_player_fuelauto2;
  815.         s_player_fuelauto2 = -1;
  816.     };
  817.  
  818.     // inplace upgrade tool
  819.     if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
  820.         if ((s_player_lastTarget select 0) != _cursorTarget) then {
  821.             if (s_player_upgrade_build > 0) then {
  822.                 player removeAction s_player_upgrade_build;
  823.                 s_player_upgrade_build = -1;
  824.             };
  825.         };
  826.         if (s_player_upgrade_build < 0) then {
  827.             // s_player_lastTarget = _cursorTarget;
  828.             s_player_lastTarget set [0,_cursorTarget];
  829.             s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "custom\BuildVectors\action\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""];
  830.         };
  831.     } else {
  832.         player removeAction s_player_upgrade_build;
  833.         s_player_upgrade_build = -1;
  834.     };
  835.    
  836.     // downgrade system
  837.     if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {
  838.         if ((s_player_lastTarget select 1) != _cursorTarget) then {
  839.             if (s_player_downgrade_build > 0) then {   
  840.                 player removeAction s_player_downgrade_build;
  841.                 s_player_downgrade_build = -1;
  842.             };
  843.         };
  844.  
  845.         if (s_player_downgrade_build < 0) then {
  846.             s_player_lastTarget set [1,_cursorTarget];
  847.             s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "custom\BuildVectors\action\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""];
  848.         };
  849.     } else {
  850.         player removeAction s_player_downgrade_build;
  851.         s_player_downgrade_build = -1;
  852.     };
  853.  
  854.     // inplace maintenance tool
  855.     if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
  856.         if ((s_player_lastTarget select 2) != _cursorTarget) then {
  857.             if (s_player_maint_build > 0) then {   
  858.                 player removeAction s_player_maint_build;
  859.                 s_player_maint_build = -1;
  860.             };
  861.         };
  862.  
  863.         if (s_player_maint_build < 0) then {
  864.             s_player_lastTarget set [2,_cursorTarget];
  865.             s_player_maint_build = player addAction [format[localize "STR_EPOCH_ACTIONS_MAINTAIN",_text], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true, "",""];
  866.         };
  867.     } else {
  868.         player removeAction s_player_maint_build;
  869.         s_player_maint_build = -1;
  870.     };
  871.  
  872.  
  873.     //Start Generator
  874.     if(_cursorTarget isKindOf "Generator_DZ") then {
  875.         if (s_player_fillgen < 0) then {
  876.            
  877.             // check if not running
  878.             if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
  879.                 s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];               
  880.             } else {
  881.             // check if not filled && player has jerry.
  882.                 if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
  883.                     s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  884.                 } else {
  885.                     if("ItemJerrycan" in _magazinesPlayer) then {
  886.                         s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  887.                     };
  888.                 };
  889.             };
  890.         };
  891.     } else {
  892.         player removeAction s_player_fillgen;
  893.         s_player_fillgen = -1;
  894.     };
  895.  
  896.     //Towing with tow truck
  897.     /*
  898.     if(_typeOfCursorTarget == "TOW_DZE") then {
  899.         if (s_player_towing < 0) then {
  900.             if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
  901.                 s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];              
  902.             } else {
  903.                 s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];             
  904.             };
  905.         };
  906.     } else {
  907.         player removeAction s_player_towing;
  908.         s_player_towing = -1;
  909.     };
  910.     */
  911.  
  912.  
  913.     //Sleep
  914.     if(_isTent && _ownerID == dayz_characterID) then {
  915.         if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {
  916.             s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  917.         };
  918.     } else {
  919.         player removeAction s_player_sleep;
  920.         s_player_sleep = -1;
  921.     };
  922.    
  923.     //Repairing Vehicles
  924.     if ((dayz_myCursorTarget != _cursorTarget) && _isVehicle && !_isMan && _hasToolbox && (damage _cursorTarget < 1) && !_isDisallowRepair) then {
  925.         if (s_player_repair_crtl < 0) then {
  926.             dayz_myCursorTarget = _cursorTarget;
  927.             _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  928.             _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  929.             s_player_repairActions set [count s_player_repairActions,_menu];
  930.             s_player_repairActions set [count s_player_repairActions,_menu1];
  931.             s_player_repair_crtl = 1;
  932.         } else {
  933.             {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  934.             s_player_repair_crtl = -1;
  935.         };
  936.     };
  937.  
  938.     // All Traders
  939.     if (_isMan && !_isPZombie && _traderType in serverTraders) then {
  940.        
  941.         if (s_player_parts_crtl < 0) then {
  942.  
  943.             // get humanity
  944.             _humanity = player getVariable ["humanity",0];
  945.             _traderMenu = call compile format["menu_%1;",_traderType];
  946.  
  947.             // diag_log ("TRADER = " + str(_traderMenu));
  948.            
  949.             _low_high = "low";
  950.             _humanity_logic = false;
  951.             if((_traderMenu select 2) == "friendly") then {
  952.                 _humanity_logic = (_humanity < -5000);
  953.             };
  954.             if((_traderMenu select 2) == "hostile") then {
  955.                 _low_high = "high";
  956.                 _humanity_logic = (_humanity > -5000);
  957.             };
  958.             if((_traderMenu select 2) == "minorhero") then {
  959.                 _humanity_logic = (_humanity < 5000);
  960.             };
  961.             if((_traderMenu select 2) == "hero") then {
  962.                 _humanity_logic = (_humanity < 10000);
  963.             };
  964.             if((_traderMenu select 2) == "superhero") then {
  965.                 _humanity_logic = (_humanity < 20000);
  966.             };
  967.             if((_traderMenu select 2) == "megahero") then {
  968.                 _humanity_logic = (_humanity < 40000);
  969.             };
  970.             if((_traderMenu select 2) == "godlike") then {
  971.                 _humanity_logic = (_humanity < 80000);
  972.             };         
  973.             if(_humanity_logic) then {
  974.                 _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
  975.                 s_player_parts set [count s_player_parts,_cancel];
  976.             } else {
  977.                
  978.                 // Static Menu
  979.                 {
  980.                     //diag_log format["DEBUG TRADER: %1", _x];
  981.                     _buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true, "",""];
  982.                     s_player_parts set [count s_player_parts,_buy];
  983.                
  984.                 } count (_traderMenu select 1);
  985.                 _buyV = player addAction ["<t color='#0059FF'>Advanced Trading</t>", "zupa\advancedTrading\init.sqf",(_traderMenu select 0), 999, true, false, "",""];
  986.                 s_player_parts set [count s_player_parts,_buyV];
  987.                 // Database menu
  988.                 _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];
  989.                 s_player_parts set [count s_player_parts,_buy];
  990.  
  991.             };
  992.             s_player_parts_crtl = 1;
  993.            
  994.         };
  995.     } else {
  996.         {player removeAction _x} count s_player_parts;s_player_parts = [];
  997.         s_player_parts_crtl = -1;
  998.     };
  999.  
  1000.    
  1001.     if(dayz_tameDogs) then {
  1002.        
  1003.         //Dog
  1004.         if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" && player getVariable ["dogID", 0] == 0) then {
  1005.             if (s_player_tamedog < 0) then {
  1006.                 s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
  1007.             };
  1008.         } else {
  1009.             player removeAction s_player_tamedog;
  1010.             s_player_tamedog = -1;
  1011.         };
  1012.         if (_isDog && _ownerID == dayz_characterID && _isAlive) then {
  1013.             _dogHandle = player getVariable ["dogID", 0];
  1014.             if (s_player_feeddog < 0 && _hasRawMeat) then {
  1015.                 s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  1016.             };
  1017.             if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {
  1018.                 s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  1019.             };
  1020.             if (s_player_staydog < 0) then {
  1021.                 _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  1022.                 if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  1023.                 s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  1024.             };
  1025.             if (s_player_trackdog < 0) then {
  1026.                 s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  1027.             };
  1028.             if (s_player_barkdog < 0) then {
  1029.                 s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];
  1030.             };
  1031.             if (s_player_warndog < 0) then {
  1032.                 _warn = _dogHandle getFSMVariable "_watchDog";
  1033.                 if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
  1034.                 s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];       
  1035.             };
  1036.             if (s_player_followdog < 0) then {
  1037.                 s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  1038.             };
  1039.         } else {
  1040.             player removeAction s_player_feeddog;
  1041.             s_player_feeddog = -1;
  1042.             player removeAction s_player_waterdog;
  1043.             s_player_waterdog = -1;
  1044.             player removeAction s_player_staydog;
  1045.             s_player_staydog = -1;
  1046.             player removeAction s_player_trackdog;
  1047.             s_player_trackdog = -1;
  1048.             player removeAction s_player_barkdog;
  1049.             s_player_barkdog = -1;
  1050.             player removeAction s_player_warndog;
  1051.             s_player_warndog = -1;
  1052.             player removeAction s_player_followdog;
  1053.             s_player_followdog = -1;
  1054.         };
  1055.     };
  1056.  
  1057. } else {
  1058.     //Engineering
  1059.     player removeAction s_player_plotManagement;
  1060.     s_player_plotManagement = -1;
  1061.    
  1062.     {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  1063.     s_player_repair_crtl = -1;
  1064.  
  1065.     {player removeAction _x} count s_player_combi;s_player_combi = [];
  1066.        
  1067.     dayz_myCursorTarget = objNull;
  1068.     s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
  1069.  
  1070.     {player removeAction _x} count s_player_parts;s_player_parts = [];
  1071.     s_player_parts_crtl = -1;
  1072.  
  1073.     {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  1074.     s_player_lockUnlock_crtl = -1;
  1075.  
  1076.     player removeAction s_player_checkGear;
  1077.     s_player_checkGear = -1;
  1078.  
  1079.     player removeAction s_player_SurrenderedGear;
  1080.     s_player_SurrenderedGear = -1;
  1081.  
  1082.     //Others
  1083.     player removeAction s_player_maintain_area;
  1084.     s_player_maintain_area = -1;
  1085.     player removeAction s_player_maintain_area_preview;
  1086.     s_player_maintain_area_preview = -1;
  1087.     player removeAction s_player_forceSave;
  1088.     s_player_forceSave = -1;
  1089.     player removeAction s_player_flipveh;
  1090.     s_player_flipveh = -1;
  1091.     player removeAction s_player_sleep;
  1092.     s_player_sleep = -1;
  1093.     player removeAction s_player_deleteBuild;
  1094.     s_player_deleteBuild = -1;
  1095.     player removeAction s_player_butcher;
  1096.     s_player_butcher = -1;
  1097.     player removeAction s_player_cook;
  1098.     s_player_cook = -1;
  1099.     player removeAction s_player_boil;
  1100.     s_player_boil = -1;
  1101.     player removeAction s_player_fireout;
  1102.     s_player_fireout = -1;
  1103.     player removeAction s_player_packtent;
  1104.     s_player_packtent = -1;
  1105.     player removeAction s_player_fillfuel;
  1106.     s_player_fillfuel = -1;
  1107.     player removeAction s_player_studybody;
  1108.     s_player_studybody = -1;
  1109.     //Dog
  1110.     player removeAction s_player_tamedog;
  1111.     s_player_tamedog = -1;
  1112.     player removeAction s_player_feeddog;
  1113.     s_player_feeddog = -1;
  1114.     player removeAction s_player_waterdog;
  1115.     s_player_waterdog = -1;
  1116.     player removeAction s_player_staydog;
  1117.     s_player_staydog = -1;
  1118.     player removeAction s_player_trackdog;
  1119.     s_player_trackdog = -1;
  1120.     player removeAction s_player_barkdog;
  1121.     s_player_barkdog = -1;
  1122.     player removeAction s_player_warndog;
  1123.     s_player_warndog = -1;
  1124.     player removeAction s_player_followdog;
  1125.     s_player_followdog = -1;
  1126.    
  1127.     // vault
  1128.     player removeAction s_player_unlockvault;
  1129.     s_player_unlockvault = -1;
  1130.     player removeAction s_player_packvault;
  1131.     s_player_packvault = -1;
  1132.     player removeAction s_player_lockvault;
  1133.     s_player_lockvault = -1;
  1134.  
  1135.     player removeAction s_player_information;
  1136.     s_player_information = -1;
  1137.     player removeAction s_player_fillgen;
  1138.     s_player_fillgen = -1;
  1139.     player removeAction s_player_upgrade_build;
  1140.     s_player_upgrade_build = -1;
  1141.     player removeAction s_player_maint_build;
  1142.     s_player_maint_build = -1;
  1143.     player removeAction s_player_downgrade_build;
  1144.     s_player_downgrade_build = -1;
  1145.     player removeAction s_player_towing;
  1146.     s_player_towing = -1;
  1147.     player removeAction s_player_fuelauto;
  1148.     s_player_fuelauto = -1;
  1149.     player removeAction s_player_fuelauto2;
  1150.     s_player_fuelauto2 = -1;
  1151.     player removeAction s_garage_dialog;
  1152.     s_garage_dialog = -1;  
  1153.     player removeAction s_givemoney_dialog;
  1154.     s_givemoney_dialog = -1;
  1155.     player removeAction s_bank_dialog;
  1156.     s_bank_dialog = -1;
  1157.     player removeAction s_bank_dialog2;
  1158.     s_bank_dialog2 = -1;
  1159.     player removeAction s_player_bunker;
  1160.     s_player_bunker = -1;
  1161.     player removeAction s_player_bunkero;
  1162.     s_player_bunkero = -1;
  1163.  
  1164. };
  1165.  
  1166.  
  1167.  
  1168. //Dog actions on player self
  1169. _dogHandle = player getVariable ["dogID", 0];
  1170. if (_dogHandle > 0) then {
  1171.     _dog = _dogHandle getFSMVariable "_dog";
  1172.     _ownerID = "0";
  1173.     if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };
  1174.     if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {
  1175.         if (s_player_movedog < 0) then {
  1176.             s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
  1177.         };
  1178.         if (s_player_speeddog < 0) then {
  1179.             _text = (localize "str_epoch_player_249");
  1180.             _speed = 0;
  1181.             if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };
  1182.             s_player_speeddog = player addAction [format[localize "str_actions_speeddog", _text], "\z\addons\dayz_code\actions\dog\speed.sqf",[player getVariable ["dogID", 0],_speed], 0, false, true, "", ""];
  1183.         };
  1184.         if (s_player_calldog < 0) then {
  1185.             s_player_calldog = player addAction [localize "str_actions_calldog", "\z\addons\dayz_code\actions\dog\follow.sqf", [player getVariable ["dogID", 0], true], 2, false, true, "", ""];
  1186.         };
  1187.     };
  1188. } else {
  1189.     player removeAction s_player_movedog;      
  1190.     s_player_movedog =      -1;
  1191.     player removeAction s_player_speeddog;
  1192.     s_player_speeddog =     -1;
  1193.     player removeAction s_player_calldog;
  1194.     s_player_calldog =      -1;
  1195. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement