Advertisement
TheScriptRunner

Untitled

Jul 13th, 2021
1,199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 10.36 KB | None | 0 0
  1. span class="re5"> WieldweaponAct = -1;
  2. vOutweaponEH = -1;
  3.  
  4. waffebefestigen={
  5.     private _weapon = (missionNamespace getVariable ["NN_Melee_Weapon",objNull]);
  6.     private _weaponType = typeOf _weapon;
  7.     if (_weaponType isEqualTo "Land_Axe_F") exitWith {
  8.         _weapon attachTo[player,[-0.01,0.12,0.005],"rightHandMiddle1"];
  9.         _weapon setDir 90;
  10.         _weapon setVectorUp[-12,-0.0,1];
  11.     };
  12.     if (_weaponType isEqualTo "Land_Axe_fire_F") exitWith {
  13.         _weapon attachTo[player,[-0.01,0.12,0.07],"rightHandMiddle1"];
  14.         _weapon setDir 90;
  15.         _weapon setVectorUp[-12,-0.0,1];
  16.     };
  17.     if (_weaponType isEqualTo "Land_Shovel_F") exitWith {
  18.         _weapon attachTo[player,[-0.01,0.1,0.01],"rightHandMiddle1"];
  19.         _weapon setDir 0;
  20.         _weapon setVectorUp[6,-0.0,0];
  21.     };
  22.     if (_weaponType isEqualTo "Land_Saw_F") exitWith {
  23.         _weapon attachTo[player,[0.01,0.1,-0.05],"leftHandMiddle1"];
  24.         _weapon setDir 220;
  25.         _weapon setVectorUp[10,0,1];
  26.     };
  27.     if (_weaponType isEqualTo "Land_Tableware_01_knife_F") exitWith {
  28.         _weapon attachTo[player,[0.01,0,-0.03],"leftHandMiddle1"];
  29.         _weapon setDir 90;
  30.         _weapon setVectorUp[-12,0,1];
  31.     };
  32.     if (_weaponType isEqualTo "Land_Hammer_F") exitWith {
  33.         _weapon attachTo[player,[-0.01,0.045,0.005],"rightHandMiddle1"];
  34.         _weapon setDir 0;
  35.         _weapon setVectorUp[0,-0.0,1];
  36.     };
  37.     if (_weaponType isEqualTo "Land_Wrench_F") exitWith {
  38.         _weapon attachTo[player,[-0.018,0.045,0.005],"rightHandMiddle1"];
  39.         _weapon setDir 0;
  40.         _weapon setVectorUp[4,0,1];
  41.     };
  42. };
  43.  
  44. pickupWeapon={
  45.     private _weapon=_this;
  46.  
  47.     private _found = false;
  48.     {
  49.         if (_x isEqualTo (missionNamespace getVariable ["NN_Melee_Weapon",objNull])) exitWith {_found = true;};
  50.     } forEach attachedObjects player;
  51.     if (_found) exitWith {["Du hast bereits eine Nahkampft Waffe an dir!","error"] call life_fnc_notification_4;};
  52.  
  53.     if ((currentWeapon player) isNotEqualTo "") exitWith {["Pack deine Waffe erstmal Weg!","error"] call life_fnc_notification_4;};
  54.  
  55.     if (stance player!="PRONE") then {
  56.         [player,"AmovPercMstpSnonWnonDnon_AinvPknlMstpSnonWnonDnon",false] remoteExecCall ["life_fnc_animSync",-2];
  57.         uisleep 0.5;
  58.     };
  59.  
  60.     removeAllActions _weapon;
  61.  
  62.     missionNamespace setVariable ["NN_Melee_Weapon",_weapon];
  63.  
  64.     call waffebefestigen;
  65.  
  66.     weaponDie = player addEventHandler["Killed",{
  67.         call dropWeapon;
  68.     }];
  69.  
  70.     vInWeaponEH = player addEventHandler["GetInMan",{
  71.         (findDisplay 46)displayRemoveEventHandler["MouseButtonDown",chopWeaponEH];
  72.         call vHideweapon;
  73.     }];
  74.  
  75.     chopWeaponEH = (findDisplay 46)displayAddEventHandler["MouseButtonDown",{
  76.         if ((_this select 1) isNotEqualTo 0) exitWith {};
  77.         if((animationState player in ["AwopPercMstpSgthWnonDnon_start","AwopPercMstpSgthWnonDnon_throw","AwopPercMstpSgthWnonDnon_end"]) || (stance player=="PRONE"))exitWith{};
  78.         [player] spawn chopWeapon;
  79.     }];
  80.  
  81.     DropWeaponAct = player addAction["Waffe fallen lassen",{call dropWeapon; (_this select 0)removeAction DropWeaponAct; (_this select 0)removeAction CarryweaponAct;}];
  82.     CarryWeaponAct = player addAction["Waffe holstern",{(_this select 0)removeAction DropweaponAct; (_this select 0) removeAction CarryweaponAct; call weaponBack;}];
  83.  
  84.     uiSleep 0.1;
  85.     [player,"ainvpknlmstpslaywrfldnon_amovpercmstpsnonwnondnon",false] remoteExecCall ["life_fnc_animSync",-2];
  86.     0 spawn {
  87.         for "_i" from 0 to 1 step 0 do {
  88.             if ((currentWeapon player) isNotEqualTo "" && !((missionNamespace getVariable ["NN_Melee_Weapon",objNull]) getVariable ["angeholstert",false])) exitWith {
  89.                 call dropWeapon;
  90.                 player removeAction DropWeaponAct;
  91.                 player removeAction CarryweaponAct;
  92.             };
  93.             _found = false;
  94.             {
  95.                 if (_x isEqualTo (missionNamespace getVariable ["NN_Melee_Weapon",objNull])) exitWith {_found = true;};
  96.             } forEach attachedObjects player;
  97.             if (!_found) exitWith {};
  98.         };
  99.     };
  100. };
  101.  
  102. vHideweapon={
  103.     player removeEventHandler["GetInMan",vInweaponEH];
  104.     [(missionNamespace getVariable ["NN_Melee_Weapon",objNull]),true] remoteExecCall ["hideObjectGlobal",2];
  105.     vOutweaponEH = player addEventHandler["GetOutMan",{call vShowweapon;}];
  106.     player removeAction DropweaponAct;
  107.     player removeAction CarryweaponAct;
  108.     if (isNil "WieldweaponAct") exitWith {};
  109.     player removeAction WieldweaponAct;
  110. };
  111.  
  112. vShowweapon={
  113.     [(missionNamespace getVariable ["NN_Melee_Weapon",objNull]),false] remoteExecCall ["hideObjectGlobal",2];
  114.     player removeEventHandler["GetOutMan",vOutweaponEH];
  115.     vInweaponEH=player addEventHandler["GetInMan",{
  116.         (findDisplay 46)displayRemoveEventHandler["MouseButtonDown",chopweaponEH];
  117.         call vHideweapon;
  118.     }];
  119.     call weaponBack;
  120. };
  121.  
  122. dropweapon={
  123.     (findDisplay 46)displayRemoveEventHandler["MouseButtonDown",chopweaponEH];
  124.     if(stance player isNotEqualTo "PRONE" && alive player)then{
  125.         0 spawn {
  126.             [player,"AmovPercMstpSnonWnonDnon_AinvPknlMstpSnonWnonDnon",false] remoteExecCall ["life_fnc_animSync",-2];
  127.             uisleep 0.5;
  128.             [player,"ainvpknlmstpslaywrfldnon_amovpercmstpsnonwnondnon",false] remoteExecCall ["life_fnc_animSync",-2];
  129.         };
  130.     };
  131.  
  132.     detach (missionNamespace getVariable ["NN_Melee_Weapon",objNull]);
  133.     player removeAction DropweaponAct;
  134.     player removeAction WieldweaponAct;
  135.     player removeEventHandler["GetInMan",vInweaponEH];
  136.     player removeEventHandler["GetOutMan",vOutweaponEH];
  137.     player removeEventHandler["Killed",weaponDie];
  138.  
  139.  
  140.     PickupweaponAct = (missionNamespace getVariable ["NN_Melee_Weapon",objNull]) addAction[format ["%1 nehmen",(([typeOf (missionNamespace getVariable ["NN_Melee_Weapon",objNull])] call life_fnc_fetchCfgDetails) select 1)],{
  141.         if((_this select 1)distance(_this select 0)<1.5)then{
  142.             (_this select 0)removeAction PickupweaponAct;
  143.             (_this select 0)removeAction DropweaponAct;
  144.             (_this select 0)removeAction WieldweaponAct;
  145.             (_this select 0)removeAction CarryweaponAct;
  146.             (missionNamespace getVariable ["NN_Melee_Weapon",objNull]) call pickupweapon;
  147.         };
  148.     }];
  149.     if (!alive player) exitWith {
  150.         deleteVehicle (missionNamespace getVariable ["NN_Melee_Weapon",objNull]);
  151.     };
  152. };
  153.  
  154. chopweapon={
  155.     if (time < (missionNamespace getVariable ["NN_Melee_Weapon_CD",time]) || dialog) exitWith {};
  156.     missionNamespace setVariable ["NN_Melee_Weapon_CD",time + 1.75];
  157.     0 spawn {
  158.         uiSleep 0.2;
  159.         [player,"miss0",20,1] remoteExec ["life_fnc_say3D",-2];
  160.     };
  161.     player setAnimSpeedCoef 0.85;
  162.     [player,"AwopPercMstpSgthWnonDnon_end",false] remoteExecCall ["life_fnc_animSync",-2];
  163.     uisleep 0.2;
  164.     player setAnimSpeedCoef 1;
  165.    
  166.     private _tarCond=objNull;
  167.  
  168.     {
  169.         if((alive _x) && (_x isNotEqualTo player)) exitWith {
  170.             _tarCond = _x;
  171.         };
  172.     }forEach (nearestObjects[player,["Man"],2]);
  173.  
  174.     if(isNull _tarCond)exitWith{};
  175.  
  176.     if([getPosATL player,getDir player,90,getPosATL _tarCond]call BIS_fnc_inAngleSector && (alive _tarCond) && !(_tarCond getVariable ["dead",false]) && player distance _tarCond<2.2)then{
  177.         private _tSnd=createVehicle["Land_HelipadEmpty_F",getPos _tarCond,[],0,"NONE"];
  178.         [_tSnd,"hit0",20,1] remoteExec ["life_fnc_say3D",-2];
  179.         _tarCond setDamage((damage _tarCond)+(0.65));
  180.         deleteVehicle _tSnd;
  181.     };
  182. };
  183.  
  184. weaponBack={
  185.     if (isNull (missionNamespace getVariable ["NN_Melee_Weapon",objNull])) exitWith {
  186.         (findDisplay 46)displayRemoveEventHandler["MouseButtonDown",chopweaponEH];
  187.     };
  188.  
  189.     (missionNamespace getVariable ["NN_Melee_Weapon",objNull]) setVariable ["angeholstert",true];
  190.  
  191.     if((stance player!="PRONE") && (isNull objectParent player))then{
  192.         [player,"AmovPercMstpSnonWnonDnon_AinvPercMstpSnonWnonDnon",false] remoteExecCall ["life_fnc_animSync",-2];
  193.     };
  194.     private _weapon=(missionNamespace getVariable ["NN_Melee_Weapon",objNull]);
  195.     (findDisplay 46)displayRemoveEventHandler["MouseButtonDown",chopweaponEH];
  196.  
  197.  
  198.     DropweaponAct=player addAction["Waffe fallen lassen",{(_this select 0)removeAction DropweaponAct; (_this select 1)removeAction DropweaponAct; (_this select 0)removeAction WieldweaponAct; (_this select 0)removeAction CarryweaponAct; call dropweapon;}];
  199.     WieldweaponAct=player addAction["Waffe entholstern",{(_this select 0)removeAction DropweaponAct;(_this select 1)removeAction DropweaponAct;(_this select 0)removeAction WieldweaponAct;(_this select 1)removeAction WieldweaponAct;(_this select 0)removeAction CarryweaponAct;(_this select 1)removeAction CarryweaponAct;call wieldweapon;}];
  200.  
  201.     call {
  202.         private _weapon = (missionNamespace getVariable ["NN_Melee_Weapon",objNull]);
  203.         private _weaponType = typeOf _weapon;
  204.         if (_weaponType isEqualTo "Land_Axe_F") exitWith {
  205.             _weapon attachTo[player,[0.2,-0.03,-0.1],"launcher"];
  206.             _weapon setDir 90;
  207.             _weapon setVectorUp[1,6.0,-1];
  208.         };
  209.         if (_weaponType isEqualTo "Land_Axe_fire_F") exitWith {
  210.             _weapon attachTo[player,[0.2,-0.03,-0.1],"launcher"];
  211.             _weapon setDir 90;
  212.             _weapon setVectorUp[1,6.0,-1];
  213.         };
  214.         if (_weaponType isEqualTo "Land_Shovel_F") exitWith {
  215.             _weapon attachTo[player,[-0.01,0.1,0.01],"rightHandMiddle1"];
  216.             _weapon setDir 0;
  217.             _weapon setVectorUp[6,-0.0,0];
  218.         };
  219.         if (_weaponType isEqualTo "Land_Saw_F") exitWith {
  220.             _weapon attachTo[player,[-0.18,-0.05,0],"pelvis"];
  221.             _weapon setDir 70;
  222.             _weapon setVectorUp[-12,0,1];
  223.         };
  224.         if (_weaponType isEqualTo "Land_Tableware_01_knife_F") exitWith {
  225.             _weapon attachTo[player,[-0.18,-0.05,0],"pelvis"];
  226.             _weapon setDir 0;
  227.             _weapon setVectorUp[-12,0,1];
  228.         };
  229.         if (_weaponType isEqualTo "Land_Hammer_F") exitWith {
  230.             _weapon attachTo[player,[-0.18,-0.05,0],"pelvis"];
  231.             _weapon setDir 70;
  232.             _weapon setVectorUp[-12,0,1];
  233.         };
  234.         if (_weaponType isEqualTo "Land_Wrench_F") exitWith {
  235.             _weapon attachTo[player,[-0.18,-0.05,0],"pelvis"];
  236.             _weapon setDir 70;
  237.             _weapon setVectorUp[-12,0,1];
  238.         };
  239.     };
  240. };
  241.  
  242. wieldweapon={
  243.     if ((currentWeapon player) isNotEqualTo "") exitWith {};
  244.  
  245.     private _weapon=(missionNamespace getVariable ["NN_Melee_Weapon",objNull]);
  246.     call waffebefestigen;
  247.     chopweaponEH=(findDisplay 46)displayAddEventHandler["MouseButtonDown",{
  248.         if ((_this select 1) isNotEqualTo 0) exitWith {};
  249.         if((animationState player in ["AwopPercMstpSgthWnonDnon_start","AwopPercMstpSgthWnonDnon_throw","AwopPercMstpSgthWnonDnon_end"]) || (stance player=="PRONE"))exitWith{};
  250.         [player] spawn chopWeapon;
  251.     }];
  252.  
  253.     DropweaponAct=player addAction["Waffe fallen lassen",{(_this select 0)removeAction DropweaponAct;(_this select 1)removeAction DropweaponAct;(_this select 0)removeAction WieldweaponAct;(_this select 0)removeAction CarryweaponAct;call dropweapon;}];
  254.     CarryweaponAct=player addAction["Waffe holstern",{(_this select 0)removeAction DropweaponAct;(_this select 0)removeAction WieldweaponAct;(_this select 0)removeAction CarryweaponAct;call weaponBack;}];
  255. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement