GetPlayerTarget: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
This example blows up any vehicle a specified player targets (aims at) | This example blows up any vehicle a specified player targets (aims at) | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function playerTargetCheck ( | function playerTargetCheck ( thePlayer ) -- called on a timer | ||
target = getPlayerTarget ( | target = getPlayerTarget ( thePlayer ) -- get the current target of the player | ||
if ( target ) then -- if there was a target | if ( target ) then -- if there was a target | ||
if ( getElementType ( target ) == "vehicle" ) then -- if the target is a vehicle | if ( getElementType ( target ) == "vehicle" ) then -- if the target is a vehicle |
Revision as of 16:38, 13 June 2006
Description
This function is used to get the current entity a player is targeting.
Syntax
float getPlayerTarget ( player thePlayer )
Required Arguments
- player: The player whose target you want to retrieve.
Returns
Returns the entity 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
- forcePlayerMap
- getAlivePlayers
- getDeadPlayers
- getPlayerACInfo
- getPlayerAnnounceValue
- getPlayerBlurLevel
- getPlayerCount
- getPlayerFromName
- getPlayerIdleTime
- getPlayerIP
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerScriptDebugLevel
- getPlayerSerial
- getPlayerTeam
- getPlayerVersion
- getPlayerWantedLevel
- getRandomPlayer
- givePlayerMoney
- isPlayerMapForced
- isPlayerMuted
- isPlayerNametagShowing
- isVoiceEnabled
- redirectPlayer
- resendPlayerACInfo
- resendPlayerModInfo
- setPlayerAnnounceValue
- setPlayerBlurLevel
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerMuted
- setPlayerName
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- setPlayerScriptDebugLevel
- setPlayerTeam
- setPlayerVoiceBroadcastTo
- setPlayerVoiceIgnoreFrom
- setPlayerWantedLevel
- spawnPlayer
- takePlayerMoney
- takePlayerScreenShot