getPedContactElement | Multi Theft Auto: Wiki Skip to content

getPedContactElement

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function detects the element a ped is standing on. This can be a vehicle or an object.

Syntax

getPedContactElement ( )

Code Examples

server

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 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