GetPlayerBySteamId

From Onset Developer Wiki
Revision as of 10:04, 20 January 2020 by 28days (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
GetPlayerBySteamId

Type: Function
Context: Server
Introduced: v1.0.3

Description

Gets a player by SteamID.

Syntax

GetPlayerBySteamId(steamid)

Parameters

  • steamid
    The SteamId64 as an integer.

Return Value

  • Returns the player identifier. Returns false if no player has the specified steamid.

Example

AddCommand("steamid", function (playerid, steam64)
    local length = string.len(steam64)
    if (length < 17 or length > 17) then
        return AddPlayerChat(playerid, "Invalid Steam64 length specified.")
    end

    local lookupid = GetPlayerSteamId(tonumber(steam64))
    if (lookupid == false) then
        return AddPlayerChat(playerid, "The specified Steam64 is not in game.")
    else
        return AddPlayerChat(playerid, "The specified Steam64 is online and their player ID: "..lookupid..".")
    end
end)

See also