onPedVehicleEnter | Multi Theft Auto: Wiki Skip to content

onPedVehicleEnter

Client-side
Server-side
Shared

This event is triggered when a ped enters a vehicle.

Parameters

vehicle theVehicle, int seat, ped jacked
  • theVehicle: A vehicle element representing the vehicle that was entered.
  • seat: An int representing the seat in which the ped is entering.
  • jacked: A player or ped element representing who has been jacked.

Source

element: The source of this event is the ped that entered the vehicle.

Code Examples

server

Sending a message to everyplayerwhenpedhas entered to avehicle:

function sendMessage (theVehicle, seat)
local vehicleName = getVehicleName (theVehicle) -- Get name of the vehicle
if seat == 0 then -- if the ped is a driver
outputChatBox ("Ped is now a driver of "..vehicleName, root)
else -- if not
outputChatBox ("Ped has entered to "..vehicleName, root)
end
end
addEventHandler ("onPedVehicleEnter", root, sendMessage)

See Also