GetPedContactElement: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Client function}} This function detects the element a ped is standing on. This can be a vehicle or an object. ==Syntax== <syntaxhighlight lang="lua"> element getPedContactElement ( ped thePed...) |
mNo edit summary Tag: Manual revert |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Server client function}} | ||
This function detects the element a ped is standing on. This can be a vehicle or an object. | This function detects the element a ped is standing on. This can be a vehicle or an object. | ||
Line 6: | Line 6: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element getPedContactElement ( ped thePed ) | element getPedContactElement ( ped thePed ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[ped]]:getContactElement|contactElement}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePed:''' The [[ped]] you want to get the [[element]] he is | *'''thePed:''' The [[ped]] of which you want to get the [[element]] he is standing on. | ||
===Returns=== | ===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. | 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== | ||
<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. | |||
<syntaxhighlight lang="lua"> | |||
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 | |||
</syntaxhighlight> | |||
</section> | |||
==See Also== | |||
{{Ped functions}} | |||
[[hu:getPedContactElement]] | |||
Latest revision as of 15:15, 5 November 2022
This function detects the element a ped is standing on. This can be a vehicle or an object.
Syntax
element getPedContactElement ( ped thePed )
OOP Syntax Help! I don't understand this!
- Method: ped:getContactElement(...)
- Variable: .contactElement
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