setPedArmor | Multi Theft Auto: Wiki Skip to content

setPedArmor

Client-side
Server-side
Shared

Pair: getPedArmor

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 armor value of a ped. Function also added client-side.

OOP Syntax Help! I don't understand this!

  • Method:ped:setArmor(...)
  • Variable: .armor

Syntax

bool setPedArmor ( ped thePed, float armor )
Required Arguments
  • thePed: the ped whose armor you want to modify.
  • armor: the amount of armor you want to set on the ped. Valid values are from 0 to 100.

Returns

  • bool: value

Returns true if the armor was changed succesfully. Returns false if an invalid ped was specified, or the armor value specified is out of acceptable range.

Code Examples

shared

This example removes the armor of a player.

function armor (player, command)
if command == "addarmor" then
setPedArmor ( player, 100 ) -- Set player's armor to 100 when he types the command 'addarmor'
elseif command == "removearmor" then
setPedArmor ( player, 0 ) -- Set player's armor to 0 when he types the command 'removearmor'
end
end
addCommandHandler ("addarmor", armor)
addCommandHandler ("removearmor", armor)

See Also