Author Topic: Is there any way to get a passengerClient from a vehicle?  (Read 1313 times)

I know that you can use
Code: [Select]
.getControllingClientto get the player that controls the vehicle, But is there a way to identify a passenger who's mounted on for example mount1, which is not in control of the vehicle?

.getMountObject(i) will return the player object mounted at slot i. If it exists, you can get its client using .client.

How would i use this if i want a similar function to this:
Code: [Select]
commandtoclient(%vehicle.getControllingClient(),'bottomprint',);
So that the passenger would get a print instead?

He just told you, use the .getMountObject(i) function.

Like:
Code: [Select]
(%vehicle.getMountObject(1).client,'bottomprint',);This?

 If slot 1 is the passenger seat then that should work but you should do some logic checks before using the commandToClient function.

Make sure you check to make sure the client exists, also, use %client.bottomPrint(stuff); instead.

Try testing you code before you ask "is this right?"

Well, it depends on your definition of 'passenger.' Say there's 4 people in a jeep, do you only want the person next to the driver to get the message, or do you want everyone to get the message? If you only want the person next to the driver to get the message, then isObject(%mounted=%veh.getMountedObject(1))?%mounted.client:0 will work just fine, but if you want them all to get it, you're gonna have to loop through each slot and do the same check for that slot #.