Advertisement
Guest User

Self Actions NOT WORKING

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