Difference between revisions of "IsAlive"

From Nomad DB
(Created page with "Checks if an EntityId is alive. == Syntax == <pre> IsAlive(EntityId) </pre> * '''EntityId''' of the Entity to check * '''Returns: number''' indicating 0 for dead, 1...")
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Page_WD2}}
 
Checks if an [[EntityId]] is alive.
 
Checks if an [[EntityId]] is alive.
  
Line 12: Line 13:
 
This functions checks if the Local Player exists and is alive.
 
This functions checks if the Local Player exists and is alive.
  
<pre>
+
<syntaxhighlight lang="lua">
 
local function IsLocalPlayerValid()
 
local function IsLocalPlayerValid()
 
local plyId = GetLocalPlayerEntityId()
 
local plyId = GetLocalPlayerEntityId()
Line 20: Line 21:
 
return IsAlive(plyId) == 1
 
return IsAlive(plyId) == 1
 
end
 
end
</pre>
+
</syntaxhighlight>
  
 
== Related Pages ==
 
== Related Pages ==

Latest revision as of 20:43, 27 October 2020

Checks if an EntityId is alive.

Syntax

IsAlive(EntityId)
  • EntityId of the Entity to check
  • Returns: number indicating 0 for dead, 1 for alive

Example

This functions checks if the Local Player exists and is alive.

local function IsLocalPlayerValid()
	local plyId = GetLocalPlayerEntityId()
	if plyId == GetInvalidEntityId() then
		return false
	end
	return IsAlive(plyId) == 1
end

Related Pages