Jump to content


Photo

Скрипт на возможность поменяться оружием с напарником


  • Please log in to reply
No replies to this topic

#1 OFFLINE   Ibragim

Ibragim

    Сержант

  • Пользователи
  • 161 posts

Posted 24 January 2021 - 01:47

PC_CHANGE_WEAPON_TEXT 		= 	"Поменяться оружием";
PC_CHANGE_WEAPON_CONDITION 	= 	"(player distance cursorTarget < 2) && (group cursorTarget == group player) && (player == leader group player) && (lifeState cursorTarget in ['HEALTHY','INJURED'])";

PC_fn_exchange_weapon = 
	{
		params ["_leader","_unit"];

		_leader_weapon = primaryWeapon _leader; 	
		_leader_weapon_ammo = _leader ammo _leader_weapon; 
		_silencer_leader = _leader weaponAccessories _leader_weapon select 0; 
		_flash_leader = _leader weaponAccessories _leader_weapon select 1; 
		_optics_leader = _leader weaponAccessories _leader_weapon select 2;
		_bipod_leader = _leader weaponAccessories _leader_weapon select 3;
		_all_weapon_magazines_leader = primaryWeaponMagazine _leader;	
		
		_leader removeWeapon _leader_weapon;
		_all_magazines_full_leader = magazinesAmmoFull _leader;
			{_leader removeItem (_x select 0)} forEach _all_magazines_full_leader;
			
		_unit_weapon = primaryWeapon _unit;
		_unit_weapon_ammo = _unit ammo _unit_weapon; 
		_silencer_unit = _unit weaponAccessories _unit_weapon select 0;
		_flash_unit = _unit weaponAccessories _unit_weapon select 1;
		_optics_unit = _unit weaponAccessories _unit_weapon select 2;
		_bipod_unit = _unit weaponAccessories _unit_weapon select 3;
		_all_weapon_magazines_unit = primaryWeaponMagazine _unit; 
		_all_magazines_full_unit = magazinesAmmoFull _unit;
		
		_unit removeWeapon _unit_weapon;
		_all_magazines_full_unit = magazinesAmmoFull _unit;
			{_unit removeItem (_x select 0)} forEach _all_magazines_full_unit;
		
			{_leader addMagazine _x} forEach _all_weapon_magazines_unit;
		_leader addWeaponGlobal _unit_weapon;
		_leader setAmmo [_unit_weapon, _unit_weapon_ammo];
		_leader addPrimaryWeaponItem _silencer_unit;
		_leader addPrimaryWeaponItem _flash_unit;
		_leader addPrimaryWeaponItem _optics_unit;
		_leader addPrimaryWeaponItem _bipod_unit;
			{_leader addMagazine [(_x select 0),(_x select 1)]} forEach _all_magazines_full_leader;		
		
		_leader selectWeapon _unit_weapon;
		_leader selectWeapon primaryWeapon _leader;
		_leader action ["PutWeapon"];	  
	  
			{_unit addMagazine _x} forEach _all_weapon_magazines_leader;
		_unit addWeaponGlobal _leader_weapon;
		_unit setAmmo [_leader_weapon, _leader_weapon_ammo];
		_unit addPrimaryWeaponItem _silencer_leader;
		_unit addPrimaryWeaponItem _flash_leader;
		_unit addPrimaryWeaponItem _optics_leader;
		_unit addPrimaryWeaponItem _bipod_leader;
			{_unit addMagazine [(_x select 0),(_x select 1)]} forEach _all_magazines_full_unit;		
		
		_unit selectWeapon primaryWeapon _leader;
	  
		_unit_azimuth = floor (_unit getDir _leader);
		_unit domove (_unit getPos [0.5, _unit_azimuth]);
		_unit action ["PutWeapon"];
	};
	
0 = player addaction [PC_CHANGE_WEAPON_TEXT, {[player, cursorTarget] call PC_fn_exchange_weapon},nil,6,true,true,"",PC_CHANGE_WEAPON_CONDITION];

  • 0




Яндекс.Метрика