OnPedVehicleEnter: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server event}} {{New feature/item|3.0160|1.5.8|20740|This event is triggered when a ped enters a vehicle.}} ==Parameters== <syntaxhighlight lang="lua"> vehicle...")
 
Line 17: Line 17:
==Example==  
==Example==  
{{Needs Example}}
{{Needs Example}}
 
<section name="Server" class="server" show="true">
Sending a message to every player when ped has entered to a vehicle
<syntaxhighlight lang="lua">
function sendMessage()
  for _, player in pairs(getElementsByType("player")) do
      outputChatBox("Ped has entered to a vehicle", player)
  end
end
addEventHandler("onPedVehicleEnter", root, sendMessage)
</syntaxhighlight>
</section>
{{See also/Server event|Ped events}}
{{See also/Server event|Ped events}}

Revision as of 10:53, 29 January 2021

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

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

Example

Accessories-text-editor.png Script Example Missing Event OnPedVehicleEnter needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.
Click to collapse [-]
Server

Sending a message to every player when ped has entered to a vehicle

function sendMessage()
   for _, player in pairs(getElementsByType("player")) do
      outputChatBox("Ped has entered to a vehicle", player)
   end
end
addEventHandler("onPedVehicleEnter", root, sendMessage)

See Also

Ped events


Event functions