Difference between revisions of "GetLocalPlayerEntityId"

From Nomad DB
 
Line 5: Line 5:
 
GetLocalPlayerEntityId()
 
GetLocalPlayerEntityId()
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
* '''Returns''': [[EntityId]]
  
 
== Example ==
 
== Example ==
 
The example below checks whether the [[EntityId|Entity ID]] of the local player is valid or not.
 
The example below checks whether the [[EntityId|Entity ID]] of the local player is valid or not.
<syntaxhighlight lang="lua">
+
<syntaxhighlight lang="lua" highlight="1">
 
local lplayerId = GetLocalPlayerEntityId()
 
local lplayerId = GetLocalPlayerEntityId()
 
if lplayerId == GetInvalidEntityId() then
 
if lplayerId == GetInvalidEntityId() then

Latest revision as of 19:05, 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