Player
Server

Ox.GetPlayer

Return an instance of OxPlayer for the given player source.

local player = Ox.GetPlayer(source)
print(json.encode(player, { indent = true }))

Ox.GetPlayerByFilter

Return the first OxPlayer that matches the filter properties.

local filter = { phoneNumber = '556-560-6609' }
local player = Ox.GetPlayerByFilter(filter)
print(json.encode(player, { indent = true }))

Ox.GetPlayers

Returns an array containing all players. Methods will not be applied if the first argument is false. Players can be filtered to only return players that match the given properties, or groups.

-- Get an array containing all players in the police or sheriff groups, with grade 3 or higher.
local filter = { groups = {['sheriff'] = 3, ['police'] = 3} })
local players = Ox.GetPlayers(usemetatable, filter)
 
for i = 1, #players do
    local player = players[i]
    print(json.encode(player, { indent = true }))
end