GetPlayerIdFromPlayerIndex

From Nomad DB
Revision as of 18:44, 14 April 2020 by Wasdennnoch (talk | contribs) (Created page with "Returns the Player ID based on the given Player Index. == Syntax == <pre> GetPlayerIdFromPlayerIndex(playerIndex) </pre> == Example == The example below checks wheth...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Returns the Player ID based on the given Player Index.

Syntax

GetPlayerIdFromPlayerIndex(playerIndex)

Example

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

local playerCount = GetNumberOfPlayers()
for i = 0, playerCount - 1 do
    local playerId = GetPlayerIdFromPlayerIndex(i)
    local playerNameDebug = GetPlayerNameDebug(playerId)
    if playerNameDebug == "2XTheTap" then
        -- do stuff
    end
end

Related Pages