Jump to content
  • 0

Removing ammo from armed vehicles


second_coming

Question

I am looking at adding RHS Escaltion to my Epoch server and am planning on adding only unarmed vehicles (except for the CH-47 Chinook which has 2 miniguns).

I am looking at using the following script to remove ammo from random spawning vehicles:

if(isServer) then
{
	waitUntil {!isNil "EPOCH_StorageSlotsCount"};
	{
		_veh = _x;
		if ((typeOf _x) == "rhs_ch_47f" || (typeOf _x) == "rhs_ch_47f_light") then 
		{
			_x removeWeaponTurret ["rhs_weap_m134_minigun_1",[-1]];
			_x removeWeaponTurret ["rhs_weap_m134_minigun_2",[-1]];
			_x removeMagazine "5000rnd_762x51_belt";
			_x setVehicleAmmo 0;
			_x setVehicleAmmoDef 0;
			
		};
	} forEach (vehicles);
	
}; 
This won't work for vehicles bought from traders though.

What is the best way to trigger a script to remove the ammo when a player enters the gunners position?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

As I have it set up so players can buy and sell armed helis they find randomly spawned I needed to have it so the script didn't just run at server restart (selling an disarmed heli to a trader and buying it back again rearms it).

 

I ended up using this, called from onPlayerRespawn.sqf:

waitUntil {alive vehicle player}; 
waitUntil {typeOF player != "VirtualMan_EPOCH"};


    while {true} do
    {
		if(vehicle player isKindOf "Air") then
		{
			// Delete Weapons from Armed Helicopters the player is in
			_vehicles = vehicle player;
			
			// UH-80 Ghost Hawk
			_vehicles removeWeaponTurret ["LMG_Minigun_Transport",[1]];
			_vehicles removeWeaponTurret ["LMG_Minigun_Transport2",[2]];	

			// CH-47 Chinook & UH-60M Blackhawk
			_vehicles removeWeaponTurret  ["rhs_weap_m134_minigun_1",[0]];
			_vehicles removeWeaponTurret  ["rhs_weap_m134_minigun_2",[1]];	
			
			// AH-99 Blackfoot
			_vehicles removeWeaponTurret  ["gatling_20mm",[0]];
			_vehicles removeWeaponTurret  ["missiles_DAGR",[0]];
			_vehicles removeWeaponTurret  ["missiles_ASRAAM",[0]];
			
		};
		uiSleep 1;	
	};

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...