cobalt_core
Players, characters, money, licenses, vehicles and the interface exports every Cobalt resource calls.
cobalt_core also answers as qb-core, mapping QBCore's surface onto these exports; that API is not documented here.
Players
Find online and offline characters, read everything on a license, read player data and metadata, change hunger and thirst, and add methods or fields to the player object.
| Export | Side | What it does |
|---|---|---|
GetCoreObject | Client, Server | The core object, or only the listed keys of it. |
GetShared | Shared | A Cobalt.Shared table, such as GetShared('Jobs'), or one entry of it, such as GetShared('Jobs', 'police'). |
GetCoreVersion | Server | cobalt_core's manifest version. |
GetPlayerData | Client | The local character's player data: citizenid, charinfo, job, gang, money and metadata. |
GetName | Client, Server | The local character's full name. |
IsWearingGloves | Client | Whether the local ped's arms drawable counts as gloves, which keeps fingerprints off evidence. |
GetPlayers | Client, Server | Active player indices. |
GetPlayer | Server | Looks up by server id, or by identifier when given a non-numeric string. |
GetPlayerByCitizenId | Server | Returns the character with this citizenid, online from memory or else loaded from players and cached for a minute. |
GetPlayerByLicense | Server | Returns the character on this Rockstar license, online from memory or else the license's character whose row changed last (players.last_updated, normally the last one played), loaded and cached for a minute. |
GetAccount | Server | Everything cobalt_core holds on a Rockstar license: its state ID, the connected player, every character and every ban. |
GetPlayerByPhone | Server | Returns the character whose npwd number in players.phone_number is number, online from memory or else loaded and cached for a minute. |
GetPlayerByCharInfo | Server | Returns the first online character whose charinfo[property] equals value, such as firstname, or else the first matching row, cached for a minute. |
GetIdentifier | Server | One of the player's identifiers, license by default. |
GetSource | Server | The loaded player holding an identifier, or 0. |
GetMetaData | Server | One metadata key for each character, online ones from memory and the rest from players in one query. |
SetMetaData | Server | Sets one metadata key on a character and writes it to players.metadata straight away. |
SetNeed | Server | Sets hunger or thirst, clamped to 0 to 100, and updates the HUD. |
AddNeed | Server | Adds to hunger or thirst, clamped to 0 to 100, and updates the HUD. |
SetMethod | Server | Adds a method to every player object. |
SetField | Server | Adds a field to the core object. |
AddPlayerMethod | Server | Adds a method to one player, a list of players, or every player with -1. |
AddPlayerField | Server | Adds a field to one player, a list of players, or every player with -1. |
Interface
Notifications, progress bars, text prompts, skill checks, context and radial menus, and input and alert dialogs, all drawn by cobalt_interfaces.
| Export | Side | What it does |
|---|---|---|
Notify | Client, Server | Shows a notification through cobalt_interfaces. |
Progressbar | Client | Yields and returns true when the bar fills. |
progressActive | Client | Whether a progress bar is running. |
cancelProgress | Client | Cancels the running progress bar, as if the player pressed cancel. |
ShowTextUI | Client | Shows the text prompt, such as [E] Open trunk, until HideTextUI. |
HideTextUI | Client | Hides the prompt only when the calling resource showed it. |
IsTextUIOpen | Client | Whether the text prompt is showing, and its text. |
SkillCheck | Client | Yields until the check ends; false at once, with a notification, while another check runs. |
RegisterContext | Client | Registers one or more context menus by id, for ShowContext. |
ShowContext | Client | Opens a context menu registered with RegisterContext. |
HideContext | Client | Closes the open context menu. |
InputDialog | Client | Yields until the dialog closes; nil at once, with a notification, while another is open. |
AlertDialog | Client | Yields until the dialog closes; 'cancel' at once, with a notification, while another is open. |
AddRadialItem | Client | Adds items to the radial menu. |
RemoveRadialItem | Client | Removes a radial menu item by id. |
RegisterRadial | Client | Registers a radial submenu that items open through their menu field. |
HideRadial | Client | Closes the radial menu. |
DisableRadial | Client | Stops the radial menu from opening while state is true. |
DrawText | Client | Draws 2D text for one frame. |
DrawText3D | Client | Draws world text for one frame. |
Jobs and gangs
Temporary jobs, and adding, changing or removing jobs and gangs while the server runs.
| Export | Side | What it does |
|---|---|---|
GetPlayersByJob | Server | Online players whose cobalt_management job (PlayerData.job) has this name or type, and their count. |
SetTempJob | Server | Gives the player a runtime-only job beside their real one, replacing any temp job they hold. |
ClearTempJob | Server | Ends the player's temporary job. |
GetTempJob | Server | The player's temp job, or nil when they have none. |
AddJob | Server | Adds a job at runtime and sends it to every client. |
AddJobs | Server | Adds several jobs at runtime. |
RemoveJob | Server | Removes a job at runtime. |
UpdateJob | Server | Replaces a job's definition at runtime. |
AddGang | Server | Adds a gang at runtime and sends it to every client. |
AddGangs | Server | Adds several gangs at runtime. |
RemoveGang | Server | Removes a gang at runtime. |
UpdateGang | Server | Replaces a gang's definition at runtime. |
Licenses
Check, grant and revoke licenses, add license points, fill in new ID cards and show them.
| Export | Side | What it does |
|---|---|---|
GetLicenseTypes | Client, Server | The licence types from licenses in config/shared.lua, by key. |
HasLicense | Server | False for an unknown type or character. |
GetLicenseRecords | Server | Every licence type's record for the character: whether it is held, who granted it and when, when it was revoked, and its points. |
GrantLicense | Server | Grants a licence, records when and by whom in metadata.licenceGrants, clears its revocation and points, saves an offline character, and fires cobalt_core:server:licenseChanged(citizenid, key, true, source?). |
RevokeLicense | Server | Revokes a licence and records when in metadata.licenceRevoked, saving an offline character, and fires cobalt_core:server:licenseChanged(citizenid, key, false, source?). |
AddLicensePoints | Server | Adds points to a held licence whose type has a pointsLimit, and revokes it once the total reaches that limit, firing licenseChanged. |
CardMetadata | Server | The metadata for a new ID or licence card item, from the player's loaded character and dated today. |
UseCard | Server | The id_card, driver_license and weapon_license items' server export. |
Vehicles
Spawn vehicles, generate plates, edit the vehicle catalogue, and look up owners, types, plates and labels.
| Export | Side | What it does |
|---|---|---|
SpawnVehicle | Server | Spawns a vehicle with CreateVehicleServerSetter, so no player needs to be near the coords. |
GeneratePlate | Server | A random eight-character plate that no player_vehicles row uses. |
GetVehicleOwnerByPlate | Server | The citizenid owning a plate, and that vehicle's player_vehicles id. |
GetVehiclesByCitizenId | Server | Rows of player_vehicles owned by a character, without the trunk and glovebox inventory columns. |
GetVehicleType | Server | The CreateVehicleServerSetter type of a model (automobile, bike, boat, heli, plane, submarine, train), read from the shared vehicle list, or asked of source's client for models not in it. |
GetPlate | Client | The vehicle's plate with surrounding spaces trimmed. |
GetVehicleLabel | Client | The vehicle's display name from the game's text labels, such as Sultan. |
SetVehicles | Server | Adds vehicles to data/vehicles.lua or changes fields on existing ones, then saves the file. |
World and buckets
Entity pools, street and zone names, ground materials, and routing buckets.
Open the World and buckets page
| Export | Side | What it does |
|---|---|---|
GetVehicles | Client | Every vehicle the client has loaded. |
GetObjects | Client | Every object the client has loaded. |
GetPeds | Client | Every ped the client has loaded, except the ones listed in ignoreList. |
GetStreetNameAtCoords | Client | The street and cross street at a position. |
GetZoneAtCoords | Client | The display name of the map zone at a position, such as Legion Square. |
GetGroundHash | Client | Casts a capsule down through the entity and returns the material it lands on, with the raw shape test results. |
GetBucketObjects | Server | The routing bucket of every player and entity that cobalt_core has moved out of bucket 0. |
SetPlayerBucket | Server | Moves a player to a routing bucket. |
SetEntityBucket | Server | Moves an entity to a routing bucket. |
GetPlayersInBucket | Server | The players in a routing bucket, or false when there are none. |
GetEntitiesInBucket | Server | The entities in a routing bucket, or false when there are none. |
Permissions and bans
Ranks, the whitelist, admin report opt-in, bans and kicks.
Open the Permissions and bans page
| Export | Side | What it does |
|---|---|---|
HasPermission | Server | Whether the player holds the rank, or any of the ranks listed. |
GetPermission | Server | Every rank the player holds. |
AddPermission | Server | Gives the player a rank (staff, admin or owner) for this session. |
RemovePermission | Server | Takes a rank from the player for this session. |
IsWhitelisted | Server | Whether the player may join while the whitelist is on. |
IsOptin | Server | Whether an admin has opted in to admin reports. |
ToggleOptin | Server | Flips an admin's opt-in to admin reports. |
IsPlayerBanned | Server | Whether a ban matches the player by license, Discord or Steam, with the kick message. |
IsLicenseInUse | Server | Whether a connected player already has that Rockstar license. |
Kick | Server | Drops the player with a reason. |
ExploitBan | Server | Bans the player for an exploit and drops them. |
Ban | Server | Bans an online player by the chosen identifiers, which IsPlayerBanned then matches on connect. |
Unban | Server | Lifts bans matching a ban id or a license, Discord or Steam identifier. |
Logs and uploads
Server logs and file uploads, sent to FiveMesh.
Open the Logs and uploads page
| Export | Side | What it does |
|---|---|---|
Log | Server | Queues a log event for FiveMesh. |
LogPlayer | Server | Log with the player's server id, identifiers and citizenid attached, plus a target player's when given. |
UploadFile | Server | Uploads a Base64 file to the FiveMesh CDN and returns its public URL. |