OnClientPedVehicleEnter: 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__
{{New feature/item|3.0159|1.5.8|20740|This event is fired when a [[ped]] has entered a [[vehicle]].}}
{{Added feature/item|3.0159|1.5.9|1.5.8|20740|This event is fired when a [[ped]] has entered a [[vehicle]].}}


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


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


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


==See Also==
==See Also==
===Client ped events===
===Client ped events===
{{Client_ped_events}}
{{Client_ped_events}}
===Client ped functions===
===Client ped functions===
{{Client_ped_functions}}
{{Client_ped_functions}}

Revision as of 11:10, 20 September 2021

20740

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)

Requirements

This template will be deleted.

See Also

Client ped events


Client ped functions