OnClientPlayerVehicleEnter: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 14: Line 14:


==Example==
==Example==
<section class="client" name="Client script" show="true">
This will check if the car you entered is a Banshee or not.
This will check if the car you entered is a Banshee or not.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 27: Line 26:
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),checkVehicles)
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),checkVehicles)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==

Revision as of 07:34, 18 January 2012

This event is fired when a player enters a vehicle.

Parameters

vehicle theVehicle, int seat
  • vehicle: the vehicle that the player entered
  • seat: the seat that the player now is on. Driver's seat = 0, higher numbers are passenger seats.

Source

The source of this event is the player that entered the vehicle.

Example

This will check if the car you entered is a Banshee or not.

function checkVehicles()
	local theVehicle = getPedOccupiedVehicle(source)
	if (getVehicleName(theVehicle)) == "Banshee" then
		outputChatBox("You entered a Banshee!")
	else
		outputChatBox("This isn't a Banshee!")
	end
end
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),checkVehicles)

See Also

Client player events


Client event functions