Advertisement
OksmanTV

Untitled

Jun 5th, 2023 (edited)
2,343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.72 KB | None | 0 0
  1. /*
  2.     Example call of code:
  3.     [
  4.         player,
  5.         "arifle_MX_GL_F",
  6.         ["30Rnd_65x39_caseless_mag","3Rnd_HE_Grenade_shell"],
  7.         "muzzle_snds_h",
  8.         "acc_pointer_ir",
  9.         "optic_hamr"
  10.     ] call WKB_CreateWeaponSecond_Scripted;
  11. */
  12.  
  13. WBK_CreateWeaponSecond_Scripted = {
  14.     Params [
  15.         ["_unit",objNull,[objNull]],
  16.         ["_weap","arifle_MXC_F",[""]],
  17.         ["_primaryWeaponMagazine",["30Rnd_65x39_caseless_mag","3Rnd_HE_Grenade_shell"],[[]]],
  18.         ["_silencer","",[""]],
  19.         ["_laser","",[""]],
  20.         ["_optics","",[""]],
  21.         ["_bipod","",[""]] 
  22.     ];
  23.  
  24.     if (!(isNil {_unit getVariable "WBK_SecondWeapon"})) exitWith {};
  25.  
  26.     _primaryWeaponItems1 = _silencer;
  27.     _primaryWeaponItems2 = _laser;
  28.     _primaryWeaponItems3 = _optics;
  29.     _primaryWeaponItems4 = _bipod;
  30.     _primaryWeaponMagazine1 = _primaryWeaponMagazine select 0;
  31.     _primaryWeaponMagazineGl = _primaryWeaponMagazine select 1;
  32.     _primaryWeaponMagazine2 = [];
  33.  
  34.     if (!(isNil "_primaryWeaponMagazineGl ")) then {
  35.         _primaryWeaponMagazine2 = [_primaryWeaponMagazineGl,1];
  36.     };
  37.  
  38.     _primaryWeapon = [
  39.         _weap,
  40.         _primaryWeaponItems1,
  41.         _primaryWeaponItems2,
  42.         _primaryWeaponItems3,
  43.         [_primaryWeaponMagazine1, getNumber(configFile >> "CfgMagazines" >> _primaryWeaponMagazine1 >> "count")],
  44.         _primaryWeaponMagazine2,
  45.         _primaryWeaponItems4
  46.     ];
  47.     _weaponHolder = createVehicle ["DummyWeapon_Wbk", getPosATL _unit, [], 0, "CAN_COLLIDE"];
  48.     _weaponHolder addWeaponWithAttachmentsCargoGlobal [_primaryWeapon, 1];
  49.  
  50.     _unit setVariable ["WBK_SecondWeapon",[_weaponHolder,_primaryWeapon],true];
  51.  
  52.     if (WBK_LocalParamWhereWeaponIs == "Pelvis") then {
  53.         [_unit,_weaponHolder,"Pelvis"] call WBK_AdjustGunPos;
  54.     }
  55.     else
  56.     {
  57.         [_unit,_weaponHolder,"Spine_normal"] call WBK_AdjustGunPos;
  58.     };
  59.  
  60.     _unit removeWeapon _weap;
  61. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement