setPedStat
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
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.") endendaddCommandHandler("beefcake", changeBodyStrength)See Also
Ped Functions
- addPedClothes
- canPedBeKnockedOffBike
- createPed
- getPedAmmoInClip
- getPedAnalogControlState
- getPedAnimation
- getPedArmor
- getPedBonePosition
- getPedCameraRotation
- getPedClothes
- getPedContactElement
- getPedControlState
- getPedFightingStyle
- getPedGravity
- getPedMoveState
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedOxygenLevel
- getPedSimplestTask
- getPedStat
- getPedTarget
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedTotalAmmo
- getPedVoice
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponMuzzlePosition
- getPedWeaponSlot
- getValidPedModels
- givePedWeapon
- isPedBleeding
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDoingTask
- isPedDucked
- IsPedFootBloodEnabled
- isPedHeadless
- isPedInVehicle
- isPedOnGround
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- isPedWearingJetpack
- killPed
- playPedVoiceLine
- reloadPedWeapon
- removePedClothes
- removePedFromVehicle
- resetPedVoice
- setPedAimTarget
- setPedAnalogControlState
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedChoking
- setPedControlState
- setPedDoingGangDriveby
- setPedEnterVehicle
- setPedExitVehicle
- setPedFightingStyle
- setPedFootBloodEnabled
- setPedGravity
- setPedHeadless
- setPedLookAt
- setPedOxygenLevel
- setPedStat
- setPedTargetingMarkerEnabled
- setPedVoice
- setPedWalkingStyle
- setPedWeaponSlot
- setPedWearingJetpack
- warpPedIntoVehicle