GetPlayerStat

From Multi Theft Auto: Wiki
Revision as of 13:40, 19 August 2007 by Arc (talk | contribs)
Jump to navigation Jump to search

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 [-]
Server

This 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