Advertisement
Guest User

Untitled

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