Player

Functions for reading player information on the server.

GetPlayers

Returns a list of all connected player server IDs.

local players = KOJA.Server.GetPlayers()

Returns number[]

GetPlayerBySource

Returns the framework's player object for a given server ID.

local player = KOJA.Server.GetPlayerBySource(source)

Returns table | nil — the raw framework player object, or nil if not found.

The structure of the returned table depends on the framework. Use the specific helper functions below when possible.

GetPlayerIdentifier

Returns the player's unique character identifier.

local id = KOJA.Server.GetPlayerIdentifier(source)

Returns string | nil

Framework
Returns

ESX

identifier (license hash)

QBCore

citizenid

Custom

whatever CustomFramework.Server.GetIdentifier returns

GetPlayerName

Returns the player's display name.

Returns string

Framework
Returns

ESX

firstName lastName

QBCore

charinfo.firstname charinfo.lastname

GetPlayerJob

Returns the player's current job.

Returns table

GetPlayerGroup

Returns the player's permission group.

Returns string | nil — e.g. "admin", "superadmin", "user".

Examples

Last updated