Entity.SetHealth
From GMod Wiki
Function | |
Syntax | Entity:SetHealth( Integer Health ) |
Description: | |
Set's an entity or player's health. | |
Returns: | nil |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.SetHealth]Entity.SetHealth [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | Set's an entity's health. |
---|---|
Used on | |
Code | -- Use SetHealth to change an entity's (or player's) health. MyEntity:SetHealth(1) -- Set's "MyEntity"'s health to 1. |
Output | N/A |
Additional Notes
- A short period of time exists after an entity's health is set by this method where it cannot be damaged. This problem can easily be handled using timer.Simple.