Server

The ak47_lib automatically detects the running framework. You can access these functions by importing the lib export in your script.

local Lib47 = exports['ak47_lib']:GetLibObject()

Core Player & Identity

These functions handle identifying players and retrieving their basic information across all frameworks.

Lib47.GetPlayer

Retrieves the raw framework-specific player object (e.g., xPlayer for ESX, Player for QBCore).

--- @param source number The player's server ID
--- @return table|nil The player object
local player = Lib47.GetPlayer(source)

Lib47.GetIdentifier

Returns the unique identifier for the player (CitizenID for QBCore/QBX, Identifier for ESX).

--- @param source number The player's server ID
--- @return string The unique identifier
local identifier = Lib47.GetIdentifier(source)

Lib47.GetName

Returns the player's full character name.

--- @param source number The player's server ID
--- @return string The full name (Firstname Lastname)
local name = Lib47.GetName(source)

Lib47.GetPhoneNumber

Returns the player's phone number.

Lib47.GetLicense

Returns the Rockstar license of the player.

Lib47.GetSourceFromIdentifier

Finds a player's server ID based on their identifier.

Lib47.GetPlayerMetaValue / Lib47.SetPlayerMetaValue

Gets or sets metadata for a player. (Bridges QBCore metadata and ESX xPlayer.getMeta/setMeta).


Jobs, Gangs & Permissions

Lib47.GetJob

Returns a standardized job table.

Lib47.SetJob

Sets the player's job and grade.

Lib47.GetGang

Returns a standardized gang table.

Lib47.SetGang

Sets the player's gang and grade.

Lib47.IsAdmin

Checks if the player has admin privileges (checks for 'command' ace permission).


Economy

Lib47.GetMoney

Retrieves the balance of a specific account.

Lib47.AddMoney

Adds money to a specific account.

Lib47.RemoveMoney

Removes money from a specific account.

Lib47.GetSocietyMoney

Gets the money associated with a job/society. Supports esx_addonaccount, qb-management, qb-banking, okokBanking, and Renewed-Banking.

Lib47.AddSocietyMoney / Lib47.RemoveSocietyMoney

Modifies society funds.


Basic Vehicle Management

Lib47.IsVehicleOwner

Checks if a player owns a vehicle with a specific plate.

Lib47.GetVehicleOwner

Returns the identifier of the owner of a specific plate.

Lib47.GeneratePlate

Generates a unique plate based on a pattern.

Lib47.GiveVehicle

Inserts a vehicle into the database (owned_vehicles / player_vehicles).

Last updated