Entity.SetMaxHealth

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:SetMaxHealth( Number int )
Description:
Sets the maximum health of an entity.
Returns: nil
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.SetMaxHealth]Entity.SetMaxHealth [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionChanges John's maximum health to 500
Used onNewerServer.png
Code
function HealthMax( )
      local r = ents.FindByClass( "player" )
      for i=1, table.getn(r) do
           if r[i]:Nick() == "John" then
                r[i]:SetMaxHealth(500)
           end
      end
 end
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox