Squirrel/Client/Functions/Players/Health
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example) |
|||
Line 11: | Line 11: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | pPlayer <- FindLocalPlayer(); |
+ | |||
+ | function onClientCommand( cmd, text ) | ||
{ | { | ||
if ( cmd == "health" ) | if ( cmd == "health" ) | ||
{ | { | ||
− | + | pPlayer.Health = 100; | |
− | + | Message( "[#00ff00]*System* [#ff0000]Your health is " + pPlayer.Health + "."); | |
} | } | ||
} | } | ||
Line 25: | Line 27: | ||
=== Notes === | === Notes === | ||
− | The call [[Squirrel/ | + | The call [[Squirrel/Client/Events/Player/onClientCommand|onClientCommand]] and [[Squirrel/Client/Functions/Messages/Message|Message]] were used in in this example. More info about them in the corresponding page. |
Latest revision as of 11:07, 4 March 2015
Contents |
[edit] Syntax
float player.Health
player.Health = float value
[edit] Arguments
- value - What you can set the health value to.
[edit] Example
pPlayer <- FindLocalPlayer(); function onClientCommand( cmd, text ) { if ( cmd == "health" ) { pPlayer.Health = 100; Message( "[#00ff00]*System* [#ff0000]Your health is " + pPlayer.Health + "."); } }
This will heal the player when He use /health.
[edit] Notes
The call onClientCommand and Message were used in in this example. More info about them in the corresponding page.