OnClientVehicleStartEnter: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Client event}}
{{Client event}}
__NOTOC__
__NOTOC__
This event is triggered when a player starts entering a vehicle. Once the entering animation completes, [[onClientVehicleEnter]] is triggered.
This event is triggered when a [[ped]] or [[player]] starts entering a vehicle. Once the entering animation completes, [[onClientVehicleEnter]] is triggered.


==Parameters==  
==Parameters==  
{{Deprecated_feature|3|1.0|
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
player thePlayer, int seat
ped thePed, int seat, int door
</syntaxhighlight>
</syntaxhighlight>
}}
*'''thePed:''' the ped that just started entering a vehicle.
{{new_feature/item|3|1.0||
<syntaxhighlight lang="lua">
player thePlayer, int seat, int door
</syntaxhighlight>
}}
*'''thePlayer:''' the player that just started entering a vehicle.
*'''seat:''' the number of the seat he is going to sit on.
*'''seat:''' the number of the seat he is going to sit on.
{{new_feature/item|3|1.0||
*'''door:''' An integer of which door the ped used (0-3). 0 is driver side door, 1 is front passenger, 2 is back left, 3 is back right.
*'''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==
==Source==
The source of this event is the vehicle the player is entering.
The source of this event is the vehicle the ped is entering.
 
==Cancel effect==
This event can be [[Event system#Canceling|canceled]], but only for the local player or peds synced by the client. If cancelled, they will not begin to the enter the vehicle.


==Example==  
==Example==
{{Example}}
This example outputs if the local player is about to enter the drivers seat.
<syntaxhighlight lang="lua">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)</syntaxhighlight>


==See Also==
==See Also==
Line 31: Line 30:
===Client event functions===
===Client event functions===
{{Client_event_functions}}
{{Client_event_functions}}
[[es:onClientVehicleStartEnter]]

Latest revision as of 12:58, 29 November 2020

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

Parameters

ped thePed, int seat, int door
  • thePed: the ped 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 ped 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 ped is entering.

Cancel effect

This event can be canceled, but only for the local player or peds synced by the client. If cancelled, 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