GetPlayerStat: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Server client function}} | |||
__NOTOC__ | __NOTOC__ | ||
==Description== | ==Description== | ||
Line 5: | Line 6: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float getPlayerStat ( player | float getPlayerStat ( player thePlayer, int stat ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''thePlayer''': The [[player]] whose stat you want to retrieve. | ||
*'''stat''': A whole number determining the stat ID. | *'''stat''': A whole number determining the stat ID. | ||
Line 16: | Line 17: | ||
==Example== | ==Example== | ||
This example outputs a | <section name="Server" class="server" show="true"> | ||
This example outputs a player's stat in the chat box. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onPlayerSpawn ( | function onPlayerSpawn ( spawnedPlayer ) | ||
local stat = getPlayerStat ( spawnedPlayer, 102 ) | |||
-- Check that getPlayerStat returned a value | |||
if ( stat ) then | |||
-- Output the stat in the chat box | |||
outputChatBox ( "The value for " .. getClientName ( spawnedPlayer ) .. "'s 102 stat is " .. stat ) | |||
end | |||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} |
Revision as of 13:40, 19 August 2007
Description
This function returns a float that contains the value of the specified statistic, for a specific player.
Syntax
float getPlayerStat ( player thePlayer, int stat )
Required Arguments
- thePlayer: The player whose stat you want to retrieve.
- stat: A whole number determining the stat ID.
Returns
Returns a float indicating the statistic value.
Example
Click to collapse [-]
ServerThis example outputs a player's stat in the chat box.
function onPlayerSpawn ( spawnedPlayer ) local stat = getPlayerStat ( spawnedPlayer, 102 ) -- Check that getPlayerStat returned a value if ( stat ) then -- Output the stat in the chat box outputChatBox ( "The value for " .. getClientName ( spawnedPlayer ) .. "'s 102 stat is " .. stat ) 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