OnClientPlayerVehicleEnter: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
{{Client event}}
{{Client event}}
__NOTOC__
__NOTOC__
This event is fired when a player enters a vehicle.
This event is fired when a player or ped enters a vehicle.


==Parameters==
==Parameters==
Line 7: Line 7:
vehicle theVehicle, int seat
vehicle theVehicle, int seat
</syntaxhighlight>
</syntaxhighlight>
*'''theVehicle:''' the vehicle that the player entered
*'''theVehicle:''' the [[vehicle]] that the player entered
*'''seat:''' the seat that the player now is on. Driver's seat = 0, higher numbers are passenger seats.
*'''seat:''' the seat that the player now is on. Driver's seat = 0, higher numbers are passenger seats.


==Source==
==Source==
The source of this event is the player that entered the vehicle.
The [[event system#Event source|source]] of this event is the [[player]] or [[ped]] that entered the vehicle.


==Example==
==Example==

Revision as of 23:06, 30 December 2019

This event is fired when a player or ped enters a vehicle.

Parameters

vehicle theVehicle, int seat
  • theVehicle: 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 or ped 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