Author Topic: Checking if someone is driving a vehicle?  (Read 651 times)

Is there a way to check if a player is the driver of a vehicle when he/she enters it

My thoughts were if there's something like a

Code: [Select]
%driver
variable for the

Code: [Select]
WheeledVehicleData::OnCollision()
but that didn't work, anyone know?

I cant remember it on the top of my head, but theres a function like getMountedObject(%i) which returns an object mounted in slot %i. dump() a vehicle to find the function.

Im fairly sure the driver seat is always slot 0.

It said function getMountedObject() unfound

Vehicle::getDrivingClient ?

Player::getObjectMount ?

Yeah, I just happened to use this yesterday. isObject(%player.getObjectMount()) works beautifully.

Edit: Wait, that only gets if you are in a vehicle. Use Marble's %vehicle.getDrivingClient().

I guess you can use if(isObject(%veh = %player.getObjectMount()) && %veh.getDrivingClient() == %player.client). You might want to check that its a vehicle and not a bot, because I'm not sure if bots have the function getDrivingClient.
« Last Edit: December 23, 2013, 09:59:47 AM by boodals 2 »