SetPlayerHealth: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Needs_Checking|Is health an int or a float? What is the maximum Health?|[[User:Vandalite|Vandalite]]}}
==Description==
==Description==
This function allows you to set a player's health directly. It may return false if the player object is invalid, or the health argument is out of range.
This function allows you to set a player's health directly. It may return false if the player object is invalid, or the health argument is out of range.
Line 10: Line 9:
===Required Arguments===
===Required Arguments===
*'''player''': The [[player]] whose health you want to set
*'''player''': The [[player]] whose health you want to set
*'''health''': The value you want to set the health to.
*'''health''': The value you want to set the health to. Valid values are from 0 to 100


==Example==
==Example==

Revision as of 01:22, 30 March 2006

Description

This function allows you to set a player's health directly. It may return false if the player object is invalid, or the health argument is out of range.

Syntax

bool setPlayerHealth ( player player, float health )

Required Arguments

  • player: The player whose health you want to set
  • health: The value you want to set the health to. Valid values are from 0 to 100

Example

if ( setPlayerHealth ( findPlayer ( "Someguy" ), 1 ) ) then
  serverChat ( "Someguy's life expectancy just got a lot less expected." )
end