ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. setPedStat

Function

setPedStat

ServerPedsIdentical to MTA:SA

Sets a San Andreas stat for a ped within 0-1000. For a player the change reaches their game immediately, so e.g. raising a weapon skill (69-79) to 999 enables dual-wielding pistols, and stat 24 raises max health. The value is also stored on the server and returned by getPedStat.

Syntax

bool setPedStat(ped ped, int stat, float value)

Arguments

pedped
A player or an NPC.
statint
Stat number 0-342 (e.g. 22 stamina, 23 muscle, 24 max health, 69-79 weapon skills, 160 driving).
valuefloat
New value 0-1000. Values outside the range are rejected.

Returns

true on success.

Example

addEventHandler("onPlayerSpawn", root, function()
    for stat = 69, 79 do setPedStat(source, stat, 1000) end
end)

See also