Difference between revisions of "GetLocalPlayerEntityId"

From Nomad DB
Line 1: Line 1:
This functions return the [[EntityId|Entity Id]] of the local player. The returned id should be checked against the Invalid Entity Id.
+
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]].
  
 
== Syntax ==
 
== Syntax ==
Line 11: Line 11:
 
local lplayerId = GetLocalPlayerEntityId()
 
local lplayerId = GetLocalPlayerEntityId()
 
if lplayerId == GetInvalidEntityId() then
 
if lplayerId == GetInvalidEntityId() then
print("Local Player is valid")
+
print("Invalid local player")
 
else
 
else
print("Invalid Local Player")
+
print("Got the local player ID")
 
end
 
end
 
</pre>
 
</pre>

Revision as of 18:26, 14 April 2020

This functions return the 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.

Syntax

GetLocalPlayerEntityId()

Example

The example below checks to see if the Entity Id for the player is valid.

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

Related Pages