Difference between revisions of "GetLocalPlayerEntityId"

From Nomad DB
Line 1: Line 1:
This functions return the [[EntityId|Entity Id]] of the local player. Under some circumstances it's possible for the returned entity ID to not exist and thus should be checked against [[GetInvalidEntityId]].
+
This functions return the [[EntityId|Entity ID]] of the local player. Under some circumstances it's possible for the returned ID to be invalid, thus should be checked against [[GetInvalidEntityId]].
  
 
== Syntax ==
 
== Syntax ==
Line 7: Line 7:
  
 
== Example ==
 
== Example ==
The example below checks to see if the [[EntityId|Entity Id]] for the player is valid.
+
The example below checks whether the [[EntityId|Entity ID]] of the local player is valid or not.
 
<pre>
 
<pre>
 
local lplayerId = GetLocalPlayerEntityId()
 
local lplayerId = GetLocalPlayerEntityId()

Revision as of 18:29, 14 April 2020

This functions return the Entity ID of the local player. Under some circumstances it's possible for the returned ID to be invalid, thus should be checked against GetInvalidEntityId.

Syntax

GetLocalPlayerEntityId()

Example

The example below checks whether the Entity ID of the local player is valid or not.

local lplayerId = GetLocalPlayerEntityId()
if lplayerId == GetInvalidEntityId() then
	print("Invalid local player")
else
	print("Got the local player ID")
end

Related Pages