GetPlayerOccupiedVehicle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function gets the [[vehicle]] that the player is currently in, if any. | |||
This function | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">vehicle getPlayerOccupiedVehicle ( player | <syntaxhighlight lang="lua">vehicle getPlayerOccupiedVehicle ( player thePlayer )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''thePlayer''': The [[player]] whose vehicle you're looking up. | ||
===Returns=== | |||
Returns the vehicle that the player is in, or ''false'' if the player is not in a vehicle or is an invalid player. | |||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua">if ( vehicle = getPlayerOccupiedVehicle ( findPlayer ( " | This example finds if the player called ''someguy'' is in a vehicle, if they it shows the vehicle's health in the chatbox. | ||
<syntaxhighlight lang="lua">if ( vehicle = getPlayerOccupiedVehicle ( findPlayer ( "someguy" ) ) ) | |||
outputChatBox ( "Someguy is in a vehicle with " .. getVehicleHealth ( vehicle ) .. " health." ) | |||
else | else | ||
outputchatbox ( "Someguy is not in a vehicle." ) | |||
end</syntaxhighlight> | end</syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} |
Revision as of 11:14, 14 August 2006
This function gets the vehicle that the player is currently in, if any.
Syntax
vehicle getPlayerOccupiedVehicle ( player thePlayer )
Required Arguments
- thePlayer: The player whose vehicle you're looking up.
Returns
Returns the vehicle that the player is in, or false if the player is not in a vehicle or is an invalid player.
Example
This example finds if the player called someguy is in a vehicle, if they it shows the vehicle's health in the chatbox.
if ( vehicle = getPlayerOccupiedVehicle ( findPlayer ( "someguy" ) ) ) outputChatBox ( "Someguy is in a vehicle with " .. getVehicleHealth ( vehicle ) .. " health." ) else outputchatbox ( "Someguy is not in a vehicle." ) 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