Jump to content

Recommended Posts

Greets guys (and girls if there are any) !

 

I need a script bu which only pilots can use choppers and planes. Can anyone explain how to do that? 

 

Thanks

 

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/getUnitTrait

I didn't test but this can return the pilot trait. If not you can check the class of the unit if it is pilot or not via

https://community.bistudio.com/wiki/isKindOf

classes are here

https://community.bistudio.com/wiki/Arma_3_CfgVehicles_WEST

 

then you can use event handler get in on the vehicle which you want the restriction

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetIn

 

and in case unit is not pilot youc an kick him out via

 

https://community.bistudio.com/wiki/moveOut

 

This is what I would do as aproach. Didn't tested it so cannot guarantee if it will achieve your desired result (KillzoneKid protection sentence :P )

Share this post


Link to post
Share on other sites

Give this a go. Assumes that you want to the pilot and copilot to be a pilot-type soldier. Doesn't handle switch seats.
 

player addEventhandler ["GetInMan", {
	params ["_unit", "", "_vehicle"];
	
	if (_vehicle isKindOf "Air" && {!(_vehicle isKindOf "ParachuteBase") && {assignedVehicleRole _unit in [['driver'], ['Turret', [0]]] && {!((toUpper typeOf _unit find toUpper "Pilot") > -1)}}}) then {
		moveOut _unit;
		hint "YOU ARE NOT A PILOT; THOUT SHALL NOT ENTER";
	};
}];

 

Share this post


Link to post
Share on other sites
On 3/21/2017 at 5:27 PM, HallyG said:

Give this a go. Assumes that you want to the pilot and copilot to be a pilot-type soldier. Doesn't handle switch seats.
 


player addEventhandler ["GetInMan", {
	params ["_unit", "", "_vehicle"];
	
	if (_vehicle isKindOf "Air" && {!(_vehicle isKindOf "ParachuteBase") && {assignedVehicleRole _unit in [['driver'], ['Turret', [0]]] && {!((toUpper typeOf _unit find toUpper "Pilot") > -1)}}}) then {
		moveOut _unit;
		hint "YOU ARE NOT A PILOT; THOUT SHALL NOT ENTER";
	};
}];

 

For the pilot it worked, but the copilot still takes the controls. Is there a way to lock the copilot controls?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×