GetPedContactElement: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | |||
This clientside function outputs the name of the vehicle the specified player is standing on, or a message saying he isn't on one. | 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"> | <syntaxhighlight lang="lua"> | ||
function outputContactVehicleMessage ( thePlayer ) | function outputContactVehicleMessage ( thePlayer ) | ||
local elementStandingOn = getPedContactElement( thePlayer ) | local elementStandingOn = getPedContactElement ( thePlayer ) | ||
if elementStandingOn | if elementStandingOn and getElementType ( elementStandingOn ) == "vehicle" then | ||
local vehicleName = getVehicleName( elementStandingOn ) | local vehicleName = getVehicleName ( elementStandingOn ) | ||
outputChatBox( " | outputChatBox( "You're standing on a " .. vehicleName .. "." ) | ||
else | else | ||
outputChatBox( " | outputChatBox( "You're not standing on any vehicle." ) | ||
end | end | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions}} |
Revision as of 20:27, 25 May 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
Click to collapse [-]
ClientThis 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 and getElementType ( elementStandingOn ) == "vehicle" then local vehicleName = getVehicleName ( elementStandingOn ) outputChatBox( "You're standing on a " .. vehicleName .. "." ) else outputChatBox( "You're not standing on any vehicle." ) end 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