GetPedOccupiedVehicleSeat: Difference between revisions
Jump to navigation
Jump to search
m (→Example: Might as well get a Random Player) |
No edit summary |
||
(13 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server client function}} | ||
This function gets the seat that a specific ped is sitting in in a vehicle. | This function gets the seat that a specific ped is sitting in in a vehicle. | ||
[[File:vehicle seat ids.png|200px|thumb|right|Vehicle seat ids]] | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">int getPedOccupiedVehicleSeat ( ped thePed )</syntaxhighlight> | <syntaxhighlight lang="lua">int getPedOccupiedVehicleSeat ( ped thePed )</syntaxhighlight> | ||
{{OOP|Prior to 1.5, the variable was .occupiedVehicleSeat|[[ped]]:getOccupiedVehicleSeat|vehicleSeat}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 10: | Line 13: | ||
===Returns=== | ===Returns=== | ||
Returns an integer containing the number of the seat that the ped is currently in | * Returns an integer containing the number of the seat that the ped is currently in: | ||
** '''0:''' Front-left | |||
** '''1:''' Front-right | |||
** '''2:''' Rear-left | |||
** '''3:''' Rear-right | |||
Returns ''false'' if the ped is on foot, or the ped doesn't exist. | |||
==Example== | ==Example== | ||
Line 18: | Line 27: | ||
theVehicle = getPedOccupiedVehicle ( thePed ) | theVehicle = getPedOccupiedVehicle ( thePed ) | ||
if ( theVehicle ) then | if ( theVehicle ) then | ||
outputChatBox ( " | outputChatBox ( getPlayerName(thePed).." is in a vehicle in seat number " .. getPedOccupiedVehicleSeat ( thePed ) .. "." ) | ||
else | else | ||
outputChatBox ( " | outputChatBox ( getPlayerName(thePed).." is not in a vehicle." ) | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 21:00, 20 June 2018
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:
- 0: Front-left
- 1: Front-right
- 2: Rear-left
- 3: Rear-right
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
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle