Jump to content
Sign in to follow this  
juleshuxley

How do I tell if a player is in a vehicles commander position?

Recommended Posts

When a player is in the driving position in a vehicle, it's easy to find out that he is the driver:

// assuming player is in driving seat
assignedVehicleRole player; // returns "driver"

However, when you're the commander or gunner you get an array that's the "turret path" of what turret you're in:

// assuming player is in commanding turret
(assignedVehicleRole player) select 1; // returns [0,0] often, but the commander turret can vary depending on vehicle, especially modded vehicles

If the commanding turret were always [0,0] I could use that to detect if the player is in the commanding position. However sometimes it's [0,1], and on modded vehicles it can [5] or [6].

I thought that

(allTurrets [_this, true]) select 1// [[0],[0,0]]

might have been the answer. That the last entry in the array it returns was always the commanding turret. This is not the case, again, often not on modded vehicles.

Basically I'm about to go ahead and hard code every single vehicle name in my script with a reference to which turret path is the commanding position. However, before I do that, is there a cleverer way to find out if the player is in the commanding position? The moveInCommander command always moves the player to the commanding position, so there must be a way to query the vehicle and for it to give the commanding position / commanding turret path, right?

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
Sign in to follow this  

×