setPedStat | Multi Theft Auto: Wiki Skip to content

setPedStat

Client-side
Server-side
Shared
Needs checking

Things like infinite run, fire proof CJ, 150 armor have special activation flags. They need a way to be triggered on/off.

Manual Review Required

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


This function allows you to set the value of a specific statistic for a ped. Visual stats (FAT and BODY_MUSCLE) can only be used on the CJ skin, they have no effect on other skins. When this function is used client-side, it can only be used on client-side created peds.

Syntax

bool setPedStat ( ped thePed, int stat, float value )
Required Arguments
  • thePed: the ped whose statistic you want to modify.
  • stat: the stat ID.
  • value: MISSING_PARAM_DESC

Returns

  • bool: value

Returns true if the statistic was changed succesfully. Returns false if an invalid player is specified, if the stat ID/value is out of acceptable range or if the FAT or BODY_MUSCLE stats are used on non-CJ players.

Code Examples

shared

This example allows a player to type the command 'beefcake' to change his player's BODY_MUSCLE stat (#23) to the maximum value of 1000. This will result in him looking really muscular.

function changeBodyStrength(thePlayer, commandName)
-- Output whether the setPlayerStat was successful in changing the BODY_MUSCLE STAT
if setPedStat(thePlayer, 23, 1000) then
outputChatBox("Your player looks really muscular")
else
outputChatBox("Failed to make your player look muscular.")
end
end
addCommandHandler("beefcake", changeBodyStrength)

See Also