GetPedContactElement: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
Returns an [[object]] or a [[vehicle]] if the ped is standing on one, ''false'' if he is touching none or an invalid element was passed. | Returns an [[object]] or a [[vehicle]] if the ped is standing on one, ''false'' if he is touching none or an invalid element was passed. | ||
==Example== | ==Example== | ||
This clientside function outputs the name of the vehicle the specified player is standing on, or a message saying he isn't on one. | |||
<syntaxhighlight lang="lua"> | |||
function outputContactVehicleMessage ( thePlayer ) | |||
local elementStandingOn = getPedContactElement( thePlayer ) | |||
if elementStandingOn ~= false and getElementType( elementStandingOn ) == "vehicle" then | |||
local vehicleName = getVehicleName( elementStandingOn ) | |||
outputChatBox( "The player is standing on a " .. vehicleName .. "." ) | |||
else | |||
outputChatBox( "The player isn't standing on any vehicle." ) | |||
end | |||
end | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Client_ped_functions}} | {{Client_ped_functions}} |
Revision as of 17:18, 30 March 2008
This function detects the element a ped is standing on. This can be a vehicle or an object.
Syntax
element getPedContactElement ( ped thePed )
Required Arguments
Returns
Returns an object or a vehicle if the ped is standing on one, false if he is touching none or an invalid element was passed.
Example
This clientside function outputs the name of the vehicle the specified player is standing on, or a message saying he isn't on one.
function outputContactVehicleMessage ( thePlayer ) local elementStandingOn = getPedContactElement( thePlayer ) if elementStandingOn ~= false and getElementType( elementStandingOn ) == "vehicle" then local vehicleName = getVehicleName( elementStandingOn ) outputChatBox( "The player is standing on a " .. vehicleName .. "." ) else outputChatBox( "The player isn't standing on any vehicle." ) end end
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