HU/getPedContactElement

From Multi Theft Auto: Wiki
Revision as of 12:33, 7 October 2018 by Surge (talk | contribs)
Jump to navigation Jump to search

Ez a function felismeri azt az elemet, amin egy ped áll. Ez lehet egy jármű, vagy egy objekt.

Szintaxis

element getPedContactElement ( ped thePed )

OOP Syntax Help! I don't understand this!

Method: ped:getContactElement(...)
Variable: .contactElement


Kötelező argumentumok

  • thePed: The ped of which you want to get the element he is standing on.

Visszatérési érték

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.

Példa

Click to collapse [-]
Client

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

Lásd még

Fordította