Skip to Content
Cobalt

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.

Open the Players page

ExportSideWhat it does
GetCoreObjectClient, ServerThe core object, or only the listed keys of it.
GetSharedSharedA Cobalt.Shared table, such as GetShared('Jobs'), or one entry of it, such as GetShared('Jobs', 'police').
GetCoreVersionServercobalt_core's manifest version.
GetPlayerDataClientThe local character's player data: citizenid, charinfo, job, gang, money and metadata.
GetNameClient, ServerThe local character's full name.
IsWearingGlovesClientWhether the local ped's arms drawable counts as gloves, which keeps fingerprints off evidence.
GetPlayersClient, ServerActive player indices.
GetPlayerServerLooks up by server id, or by identifier when given a non-numeric string.
GetPlayerByCitizenIdServerReturns the character with this citizenid, online from memory or else loaded from players and cached for a minute.
GetPlayerByLicenseServerReturns 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.
GetAccountServerEverything cobalt_core holds on a Rockstar license: its state ID, the connected player, every character and every ban.
GetPlayerByPhoneServerReturns the character whose npwd number in players.phone_number is number, online from memory or else loaded and cached for a minute.
GetPlayerByCharInfoServerReturns the first online character whose charinfo[property] equals value, such as firstname, or else the first matching row, cached for a minute.
GetIdentifierServerOne of the player's identifiers, license by default.
GetSourceServerThe loaded player holding an identifier, or 0.
GetMetaDataServerOne metadata key for each character, online ones from memory and the rest from players in one query.
SetMetaDataServerSets one metadata key on a character and writes it to players.metadata straight away.
SetNeedServerSets hunger or thirst, clamped to 0 to 100, and updates the HUD.
AddNeedServerAdds to hunger or thirst, clamped to 0 to 100, and updates the HUD.
SetMethodServerAdds a method to every player object.
SetFieldServerAdds a field to the core object.
AddPlayerMethodServerAdds a method to one player, a list of players, or every player with -1.
AddPlayerFieldServerAdds 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.

Open the Interface page

ExportSideWhat it does
NotifyClient, ServerShows a notification through cobalt_interfaces.
ProgressbarClientYields and returns true when the bar fills.
progressActiveClientWhether a progress bar is running.
cancelProgressClientCancels the running progress bar, as if the player pressed cancel.
ShowTextUIClientShows the text prompt, such as [E] Open trunk, until HideTextUI.
HideTextUIClientHides the prompt only when the calling resource showed it.
IsTextUIOpenClientWhether the text prompt is showing, and its text.
SkillCheckClientYields until the check ends; false at once, with a notification, while another check runs.
RegisterContextClientRegisters one or more context menus by id, for ShowContext.
ShowContextClientOpens a context menu registered with RegisterContext.
HideContextClientCloses the open context menu.
InputDialogClientYields until the dialog closes; nil at once, with a notification, while another is open.
AlertDialogClientYields until the dialog closes; 'cancel' at once, with a notification, while another is open.
AddRadialItemClientAdds items to the radial menu.
RemoveRadialItemClientRemoves a radial menu item by id.
RegisterRadialClientRegisters a radial submenu that items open through their menu field.
HideRadialClientCloses the radial menu.
DisableRadialClientStops the radial menu from opening while state is true.
DrawTextClientDraws 2D text for one frame.
DrawText3DClientDraws world text for one frame.

Jobs and gangs

Temporary jobs, and adding, changing or removing jobs and gangs while the server runs.

Open the Jobs and gangs page

ExportSideWhat it does
GetPlayersByJobServerOnline players whose cobalt_management job (PlayerData.job) has this name or type, and their count.
SetTempJobServerGives the player a runtime-only job beside their real one, replacing any temp job they hold.
ClearTempJobServerEnds the player's temporary job.
GetTempJobServerThe player's temp job, or nil when they have none.
AddJobServerAdds a job at runtime and sends it to every client.
AddJobsServerAdds several jobs at runtime.
RemoveJobServerRemoves a job at runtime.
UpdateJobServerReplaces a job's definition at runtime.
AddGangServerAdds a gang at runtime and sends it to every client.
AddGangsServerAdds several gangs at runtime.
RemoveGangServerRemoves a gang at runtime.
UpdateGangServerReplaces a gang's definition at runtime.

Licenses

Check, grant and revoke licenses, add license points, fill in new ID cards and show them.

Open the Licenses page

ExportSideWhat it does
GetLicenseTypesClient, ServerThe licence types from licenses in config/shared.lua, by key.
HasLicenseServerFalse for an unknown type or character.
GetLicenseRecordsServerEvery licence type's record for the character: whether it is held, who granted it and when, when it was revoked, and its points.
GrantLicenseServerGrants 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?).
RevokeLicenseServerRevokes a licence and records when in metadata.licenceRevoked, saving an offline character, and fires cobalt_core:server:licenseChanged(citizenid, key, false, source?).
AddLicensePointsServerAdds points to a held licence whose type has a pointsLimit, and revokes it once the total reaches that limit, firing licenseChanged.
CardMetadataServerThe metadata for a new ID or licence card item, from the player's loaded character and dated today.
UseCardServerThe 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.

Open the Vehicles page

ExportSideWhat it does
SpawnVehicleServerSpawns a vehicle with CreateVehicleServerSetter, so no player needs to be near the coords.
GeneratePlateServerA random eight-character plate that no player_vehicles row uses.
GetVehicleOwnerByPlateServerThe citizenid owning a plate, and that vehicle's player_vehicles id.
GetVehiclesByCitizenIdServerRows of player_vehicles owned by a character, without the trunk and glovebox inventory columns.
GetVehicleTypeServerThe 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.
GetPlateClientThe vehicle's plate with surrounding spaces trimmed.
GetVehicleLabelClientThe vehicle's display name from the game's text labels, such as Sultan.
SetVehiclesServerAdds 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

ExportSideWhat it does
GetVehiclesClientEvery vehicle the client has loaded.
GetObjectsClientEvery object the client has loaded.
GetPedsClientEvery ped the client has loaded, except the ones listed in ignoreList.
GetStreetNameAtCoordsClientThe street and cross street at a position.
GetZoneAtCoordsClientThe display name of the map zone at a position, such as Legion Square.
GetGroundHashClientCasts a capsule down through the entity and returns the material it lands on, with the raw shape test results.
GetBucketObjectsServerThe routing bucket of every player and entity that cobalt_core has moved out of bucket 0.
SetPlayerBucketServerMoves a player to a routing bucket.
SetEntityBucketServerMoves an entity to a routing bucket.
GetPlayersInBucketServerThe players in a routing bucket, or false when there are none.
GetEntitiesInBucketServerThe 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

ExportSideWhat it does
HasPermissionServerWhether the player holds the rank, or any of the ranks listed.
GetPermissionServerEvery rank the player holds.
AddPermissionServerGives the player a rank (staff, admin or owner) for this session.
RemovePermissionServerTakes a rank from the player for this session.
IsWhitelistedServerWhether the player may join while the whitelist is on.
IsOptinServerWhether an admin has opted in to admin reports.
ToggleOptinServerFlips an admin's opt-in to admin reports.
IsPlayerBannedServerWhether a ban matches the player by license, Discord or Steam, with the kick message.
IsLicenseInUseServerWhether a connected player already has that Rockstar license.
KickServerDrops the player with a reason.
ExploitBanServerBans the player for an exploit and drops them.
BanServerBans an online player by the chosen identifiers, which IsPlayerBanned then matches on connect.
UnbanServerLifts 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

ExportSideWhat it does
LogServerQueues a log event for FiveMesh.
LogPlayerServerLog with the player's server id, identifiers and citizenid attached, plus a target player's when given.
UploadFileServerUploads a Base64 file to the FiveMesh CDN and returns its public URL.

On this page