GetPlayerTarget: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element getPlayerTarget ( player thePlayer ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 08:59, 22 August 2006
This function is used to get the current entity a player is targeting.
Syntax
element getPlayerTarget ( player thePlayer )
Required Arguments
- thePlayer: The player whose target you want to retrieve.
Returns
Returns the element that's being targeted, or false if there isn't one.
Example
This example blows up any vehicle a specified player targets (aims at)
function playerTargetCheck ( thePlayer ) -- called on a timer target = getPlayerTarget ( thePlayer ) -- get the current target of the player if ( target ) then -- if there was a target if ( getElementType ( target ) == "vehicle" ) then -- if the target is a vehicle blowVehicle ( target ) -- blow the vehicle end 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