getPedStat | Multi Theft Auto: Wiki Skip to content

getPedStat

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function returns the value of the specified statistic of a specific ped.

OOP Syntax Help! I don't understand this!

  • Method:ped:getStat(...)

Syntax

float getPedStat ( ped thePed, int stat )
Required Arguments
  • thePed: The ped whose stat you want to retrieve.
  • stat: A whole number determining the stat ID.

Returns

  • float: value

Returns the value of the requested statistic.

Code Examples

shared

This example announces whether a player is fat upon spawn

function checkWeightOnSpawn ( )
local stat = getPedStat ( source, 21 )
-- Check that getPedStat returned a value
if ( stat > 500 ) then
-- Output the stat in the chat box
outputChatBox ( getPlayerName ( source ) .. " needs to lose a bit of weight!" )
end
end
addEventHandler ( "onPlayerSpawn", getRootElement(), checkWeightOnSpawn )

See Also