OnClientVehicleStartEnter: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Clearly wasn't tested)
Line 28: Line 28:
==Example==
==Example==
This example outputs if the local player is about to enter the drivers seat.
This example outputs if the local player is about to enter the drivers seat.
<syntaxhighlight lang="lua">addEventHandler("onClientVehicleStartEnter", localPlayer, function(player,seat,door)
<syntaxhighlight lang="lua">addEventHandler("onClientVehicleStartEnter", root, function(player,seat,door)
if (seat == 0)then
if (player == localPlayer and seat == 0)then
outputChatBox("You are going to sit in the drivers seat.")
outputChatBox("You are going to sit in the drivers seat.")
end
end

Revision as of 18:22, 24 May 2018

This event is triggered when a player starts entering a vehicle. Once the entering animation completes, onClientVehicleEnter is triggered.

Parameters

player thePlayer, int seat, int door
  • thePlayer: the player that just started entering a vehicle.
  • seat: the number of the seat he is going to sit on.
  • door: An integer of which door the player used (0-3). 0 is driver side door, 1 is front passenger, 2 is back left, 3 is back right.

Source

The source of this event is the vehicle the player is entering.

Cancel effect

This event can be canceled, but only for the local player, they will not begin to the enter the vehicle.

Example

This example outputs if the local player is about to enter the drivers seat.

addEventHandler("onClientVehicleStartEnter", root, function(player,seat,door)
	if (player == localPlayer and seat == 0)then
		outputChatBox("You are going to sit in the drivers seat.")
	end
end)

See Also

Client vehicle events


Client event functions