SetPlayerHealth: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|SetPlayerHealth(player, health)}} {{FuncParameters}} {{FuncParam|player|__EDIT_ME__}} {{FuncParam|..."
 
Kuzkay (talk | contribs)
No edit summary
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|You can use this to set players health (0-100)}}


{{FuncSyntax|SetPlayerHealth(player, health)}}
{{FuncSyntax|SetPlayerHealth(player, health)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|player|__EDIT_ME__}}
{{FuncParam|player|Player you want to set health of}}
{{FuncParam|health|__EDIT_ME__}}
{{FuncParam|health|New health value you want to set player to}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|__EDIT_ME__}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
function heal(player)
  SetPlayerHealth(player, 100)
  AddPlayerChat(player, 'You/'ve healed yourself')
end
AddCommand('heal', heal)
 
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
__EDIT_ME__

Revision as of 20:18, 13 November 2019

SetPlayerHealth

Type: Function
Context: Server
Introduced: v1.0

Description

You can use this to set players health (0-100)

Syntax

SetPlayerHealth(player, health)

Parameters

  • player
    Player you want to set health of
  • health
    New health value you want to set player to

Return Value

  • __EDIT_ME__

Example

function heal(player)
   SetPlayerHealth(player, 100)
   AddPlayerChat(player, 'You/'ve healed yourself')
end
AddCommand('heal', heal)

See also

__EDIT_ME__