Difference between revisions of "GetLocalPlayerEntityId"
From Nomad DB
Wasdennnoch (talk | contribs) |
Wasdennnoch (talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | This functions return the [[EntityId|Entity | + | 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 == | ||
− | < | + | <syntaxhighlight lang="lua"> |
GetLocalPlayerEntityId() | GetLocalPlayerEntityId() | ||
− | </ | + | </syntaxhighlight> |
+ | |||
+ | * '''Returns''': [[EntityId]] | ||
== Example == | == Example == | ||
− | The example below checks | + | The example below checks whether the [[EntityId|Entity ID]] of the local player is valid or not. |
− | < | + | <syntaxhighlight lang="lua" highlight="1"> |
local lplayerId = GetLocalPlayerEntityId() | local lplayerId = GetLocalPlayerEntityId() | ||
if lplayerId == GetInvalidEntityId() then | if lplayerId == GetInvalidEntityId() then | ||
Line 15: | Line 17: | ||
print("Got the local player ID") | print("Got the local player ID") | ||
end | end | ||
− | </ | + | </syntaxhighlight> |
== Related Pages == | == Related Pages == |
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()
- Returns: EntityId
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