GetPedOccupiedVehicleSeat: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (update cside msg)
m (one last oop note for cside)
Line 8: Line 8:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">int getPedOccupiedVehicleSeat ( ped thePed )</syntaxhighlight>
<syntaxhighlight lang="lua">int getPedOccupiedVehicleSeat ( ped thePed )</syntaxhighlight>
{{OOP|{{New feature/item|3.0150|1.5||Prior to 1.5, the variable was .occupiedVehicleSeat}}|[[ped]]:getOccupiedVehicleSeat|vehicleSeat}}
{{OOP|Prior to 1.5, the variable was .occupiedVehicleSeat|[[ped]]:getOccupiedVehicleSeat|vehicleSeat}}


===Required Arguments===
===Required Arguments===

Revision as of 00:43, 2 June 2015

This function is now available client side. This function gets the seat that a specific ped is sitting in in a vehicle.

Syntax

int getPedOccupiedVehicleSeat ( ped thePed )

OOP Syntax Help! I don't understand this!

Note: Prior to 1.5, the variable was .occupiedVehicleSeat
Method: ped:getOccupiedVehicleSeat(...)
Variable: .vehicleSeat


Required Arguments

  • thePed: The ped whose vehicle seat you're looking up.

Returns

Returns an integer containing the number of the seat that the ped is currently in, if any. Seat 0 represents the driver's seat, any higher represents a passenger seat. Returns false if the ped is on foot, or the ped doesn't exist.

Example

This example finds what seat a random player is sitting in and outputs it to the chat box.

thePed = getRandomPlayer()
theVehicle = getPedOccupiedVehicle ( thePed )
if ( theVehicle ) then
    outputChatBox ( getPlayerName(thePed).." is in a vehicle in seat number " .. getPedOccupiedVehicleSeat ( thePed ) .. "." )
else
    outputChatBox ( getPlayerName(thePed).." is not in a vehicle." )
end

See Also