GetPlayerContactElement: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Client function}} <!-- Describe in plain english what this function does. Don't go into details, just give an overview --> This function detects the vehicle a player is standi...) |
(Removed comments, updated page, improved example) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
This function detects the element a player is standing on. This can be a vehicle or an object. | |||
This function detects the | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element getPlayerContactElement ( player thePlayer ) | element getPlayerContactElement ( player thePlayer ) | ||
Line 11: | Line 9: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' The [[player]] you want to get the [[element]] he is touching from. | |||
*'''thePlayer:''' The player you want to get the | |||
===Returns=== | ===Returns=== | ||
Returns an [[object]] or a [[vehicle]] if the player is standing on one, ''false'' if he is touching none or is a invalid player. | |||
Returns a [[vehicle]] if the player is | |||
==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. | |||
This | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local | function outputContactVehicleMessage ( thePlayer ) | ||
local | local elementStandingOn = getPlayerContactElement( thePlayer ) | ||
outputChatBox( | if 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> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} |
Revision as of 16:59, 8 August 2007
This function detects the element a player is standing on. This can be a vehicle or an object.
Syntax
element getPlayerContactElement ( player thePlayer )
Required Arguments
Returns
Returns an object or a vehicle if the player is standing on one, false if he is touching none or is a invalid player.
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 = getPlayerContactElement( thePlayer ) if 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
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState