OnClientPedVehicleEnter: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client event}} __NOTOC__ {{New feature/item|3.0160|1.5.8|20740|This event is fired when a ped has entered a vehicle.}} ==Parameters== <syntaxhighlight lang="lua"> v...")
 
Line 14: Line 14:


==Example==
==Example==
{{Needs Example}}
This example outputs a text when a ped enters a bike as a driver.
<syntaxhighlight lang="lua">
function detectVehicleEnterByPed(theVehicle, seat)
    if (getVehicleType(theVehicle) == "Bike" and seat == 0) then
        outputChatBox("A ped has entered a bike as a driver!", 0, 255, 0)
    end
end
addEventHandler("onClientPedVehicleEnter", root, detectVehicleEnterByPed)
</syntaxhighlight>


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

Revision as of 20:06, 8 December 2020

This event is fired when a ped has entered a vehicle.

Parameters

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

Source

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

Example

This example outputs a text when a ped enters a bike as a driver.

function detectVehicleEnterByPed(theVehicle, seat)
    if (getVehicleType(theVehicle) == "Bike" and seat == 0) then
        outputChatBox("A ped has entered a bike as a driver!", 0, 255, 0)
    end
end
addEventHandler("onClientPedVehicleEnter", root, detectVehicleEnterByPed)

See Also

Client ped events


Client ped functions