GetPedOccupiedVehicle: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (→Example) |
||
Line 17: | Line 17: | ||
function showVehicleName ( player ) | function showVehicleName ( player ) | ||
local vehicle = getPedOccupiedVehicle ( player ) | local vehicle = getPedOccupiedVehicle ( player ) | ||
if vehicle then | |||
outputChatBox ( "Name of the Vehicle: " .. getVehicleName ( vehicle ), player ) | |||
else | |||
outputChatBox ( "You do not have a Vehicle!", player, 255, 0, 0, true ) | |||
end | |||
end | end | ||
addCommandHandler ( "getcarname", showVehicleName ) | addCommandHandler ( "getcarname", showVehicleName ) |
Revision as of 00:48, 21 January 2011
This function gets the vehicle that the ped is currently in, if any.
Syntax
vehicle getPedOccupiedVehicle ( ped thePed )
Required Arguments
- thePed: The ped whose vehicle you're looking up.
Returns
Returns the vehicle that the specified ped is in, or false if the ped is not in a vehicle or is an invalid ped.
Example
When a ped enters the 'getcarname' command and is currently in a vehicle, this example outputs the name of the vehicle.
function showVehicleName ( player ) local vehicle = getPedOccupiedVehicle ( player ) if vehicle then outputChatBox ( "Name of the Vehicle: " .. getVehicleName ( vehicle ), player ) else outputChatBox ( "You do not have a Vehicle!", player, 255, 0, 0, true ) end end addCommandHandler ( "getcarname", showVehicleName )
See Also
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedOxygenLevel
- getPedSimplestTask
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- IsPedFootBloodEnabled
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
- Shared
- 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