devhub_lib FOR DEVS ONLY

devhub_lib β€” Developer documentation


Getting Started

Accessing the Core Object

-- From an external resource
Core = nil
Citizen.CreateThread( function()
Core = exports['devhub_lib']:GetCoreObject()
    while Core?.Loaded == nil do
        Wait(1000)
        Core = exports['devhub_lib']:GetCoreObject()
    end
end)

Core Functions

Callbacks

Server callbacks allow you to request data from the server and receive a response on the client.

Register a Server Callback SERVER

Parameter
Type
Description

name

string

Unique callback name.

handler

function

Handler function. Receives source, cb, and additional arguments.

Trigger a Server Callback CLIENT

Parameter
Type
Description

name

string

The callback name to trigger.

cb

function

Function to receive the response.

...

any

Additional arguments to pass.


Promises

Wrap asynchronous operations into synchronous-style code. CLIENT


Notifications & UI

Core.Notify CLIENT

Core.Notify SERVER

Core.ShowStaticMessage CLIENT

Persistent message on screen. Pass false to hide.

Core.ShowControlButtons CLIENT

Control button prompts on screen. Pass false to hide.

Core.ShowProgressbar CLIENT

Core.CloseProgressbar CLIENT

Core.PopupForm CLIENT

Displays a popup form with input fields and/or dropdowns. Returns status (bool) and data (table).

Core.DecisionPrompt CLIENT

Timed decision prompt with keybinds.

Core.ShowRequiredItems CLIENT

Shows a required items HUD display.

Core.HideRequiredItems CLIENT

Core.CopyClipboard CLIENT


NPC Dialog

Interactive dialog system with NPC camera, typing animation, sound, and multiple response types (grid, input, items, payment). CLIENT

Core.NpcDialog

Returns a result table with status (bool) and data (table).

circle-info

You can replace the grid key with other response types: input, items, or paymentMethod. Only one response type per dialog.

Core.CloseNpcDialog CLIENT


Utility Functions

Core.RequestModel CLIENT

Core.GetClosestPlayers CLIENT

Core.GenerateRandomChar CLIENT

Core.GenerateString SHARED

Core.GenerateUid SERVER CLIENT

Core.GetPlayerPicture SERVER

Core.GetOnlinePoliceCount SERVER CLIENT

Core.DumpTable SHARED

Core.GetLengthOfObject SHARED

Core.IsObjectEmpty SHARED

Core.GetClientTimestamp CLIENT


String Utilities

All accessed via Core.String. SHARED


Math Utilities

SHARED


Framework

All functions are unified β€” they work identically regardless of whether the server uses ESX, QBCore, QBOX, or vRP.

Player Identity

Core.GetIdentifier SERVER

Core.GetFullName SERVER


Money

Core.GetCash / Core.AddCash / Core.RemoveCash SERVER

Core.GetBank / Core.AddBank / Core.RemoveBank SERVER


Job

Core.GetJob SERVER

Core.IsPolice SERVER


Player Info

Core.GetUserInfo SERVER

Core.GetUserSkin SERVER


Inventory

All inventory functions are unified across supported inventory systems (ox_inventory, qb-inventory, etc.).

Item Management

Core.RegisterItem SERVER

Registers an item as usable. When a player uses the item, the callback fires.

Core.AddItem SERVER

Parameter
Type
Description

source

number

Player server ID.

itemName

string

Item spawn name.

amount

number

Amount to add (default 1).

metadata

table

Optional metadata table.

Core.RemoveItem SERVER

Core.GetItemCount SERVER

Core.CanCarry SERVER

Core.GetAllItems SERVER

Returns all items from a player's inventory as an array.


Item Metadata

Core.GetItemMetadata SERVER

Core.SetItemMetadata SERVER


Item Data

Core.GetItemData SERVER

Gets global item info (not player-specific).


Target

Unified targeting system supporting ox_target, qb-target, and others. All functions are CLIENT.

Model Targets

Core.AddModelToTarget


Coordinate Targets

Core.AddCoordsToTarget

Single option:

Multiple options (pass an array):

Core.RemoveCoordsFromTarget


Entity Targets

Core.AddLocalEntityToTarget

Core.RemoveLocalEntityFromTarget


Global Targets

Core.AddGlobalVehicleToTarget

Core.RemoveGlobalVehicleFromTarget

Core.AddGlobalPlayerToTarget

Core.RemoveGlobalPlayerFromTarget


Vehicles

Spawning & Deleting

Core.SpawnVehicle CLIENT

Spawns a vehicle with keys and fuel automatically applied.

Parameter
Type
Description

modelName

string

Vehicle model name or hash.

coords

vector3

Spawn position.

heading

number

Vehicle heading.

cb

function

Callback receiving vehicle handle.

networked

boolean

Network the entity (default true).

fuel

number

Fuel level 0–100 (default 100).

Core.DeleteVehicle CLIENT


Vehicle Keys

Core.AddVehicleKeys / Core.RemoveVehicleKeys CLIENT


Vehicle Fuel

Core.SetVehicleFuel CLIENT


Vehicle Helpers

Core.GetClosestVehicle CLIENT

Core.IsSpawnPointClear CLIENT


World

Peds

addPedToCoords (Export) CLIENT

Spawns a ped at coordinates with automatic spawn/despawn based on distance (75 units).


Objects

Core.SpawnObject CLIENT

Core.GetObjects CLIENT


Blips

Core.AddBlip CLIENT

Parameter
Type
Description

coords

vector3

Blip position.

sprite

number

Blip sprite ID.

color

number

Blip color ID.

scale

number

Blip scale.

name

string

Blip label.

Core.RemoveBlip CLIENT


PolyZone

Built-in poly zone system (based on mkafrin/PolyZone). CLIENT

Also available via export:


Animations & Clothing

Animations

Core.StartAnim CLIENT

Full animation with optional prop.

Core.StopAnim CLIENT

Core.PlayAnim CLIENT

Simple one-shot animation.


Clothing

Change Clothing CLIENT

Reset Clothing CLIENT

Variations: mask, gloves, pants, backpack, boots, neckless, tshirt, vest, decals, torso Props: hat, glasses, ears, watch, bracelets


Sound

Requires xsound resource. All functions are CLIENT.

Core.PlaySoundLocally

Core.PlaySoundCoords

Core.StopSound

Core.FadeIn / Core.FadeOut

Core.ChangeDistance

Core.SoundExists


Database (SQL)

Server-side wrapper around oxmysql. All functions are SERVER.

Execute (multiple rows)

Single (one row)

Insert

Update


Admin & Logging

Admin

Core.IsPlayerAdmin SERVER


Logs

Core.SendLog SERVER

Sends a Discord webhook embed with player info.

Core.SendLog CLIENT


Events

Player Loaded

Player Unloaded

Resource Stop

Vehicle Status CLIENT

Routing Bucket SERVER

Last updated