Shared types
Every type the API pages link to, with each field, its type and an example value.
The API pages write types by name (Vec3, ActionResult, InventoryRef...). This page explains each one once: its fields, what each field means, and an example value.
Where a type comes from:
| Package | Import | Types |
|---|---|---|
@aicore-fivem/shared | import type { AiPlayerData } from "@aicore-fivem/shared"; | Everything on this page unless the heading says otherwise. |
@aicore-fivem/lib/shared | import type { Vec3 } from "@aicore-fivem/lib/shared"; | Vec3, Vec4, AccessRule, BlipStyle, ZoneShape, VehicleProps, VehicleSetup, PlacePed. |
@aicore-fivem/lib/client | import type { ProgressOptions } from "@aicore-fivem/lib/client"; | ProgressOptions. |
@aicore-fivem/lib/server | import type { ProgressForOptions } from "@aicore-fivem/lib/server"; | ProgressForOptions. |
Lua has no types at run time. A Lua table with the same keys is the same value: { x = 1.0, y = 2.0, z = 3.0 } is a Vec3. Arrays are Lua lists ({ 'police', 'sheriff' }), null is nil. See Lib for Lua for vectors.
Positions
Vec3
A point in the world, in metres. GTA's x is east, y is north, z is up.
Prop
Type
const counter: Vec3 = { x: 25.7, y: -1347.3, z: 29.5 };local counter = vector3(25.7, -1347.3, 29.5) -- or { x = 25.7, y = -1347.3, z = 29.5 }Vec4
A point with a heading: where a ped stands or a vehicle spawns and which way it faces. Panel vec4 fields and the panel's point tool store this shape.
Prop
Type
const spawn: Vec4 = { x: -42.1, y: -1098.4, z: 26.4, heading: 158.0 };A Lua vector4 calls the heading w. The lib's readers (readVec4) accept both heading and w.
ZoneShape
An area in the world. Used by client Zones and by server area checks (zone geometry). It is one of three shapes, picked by type.
Sphere (a ball around a point):
Prop
Type
Cylinder (a circle on the ground, reaching up and down):
Prop
Type
Poly (a ground polygon between two heights):
Prop
Type
const yard: ZoneShape = { type: "sphere", center: { x: 440.1, y: -981.2, z: 30.7 }, radius: 25 };
const lot: ZoneShape = {
type: "poly",
points: [ { x: 210, y: -810 }, { x: 240, y: -800 }, { x: 230, y: -770 }, { x: 200, y: -780 } ],
minZ: 28,
maxZ: 36,
};Results
ActionResult
What every server action answers a client: either success, or a lang key the client shows as the reason. Extra fields can ride on the success branch (ActionResult<{ id: number }>). The new state itself never travels in the reply: it arrives as a delta.
Success:
Prop
Type
Refusal:
Prop
Type
const done: ActionResult = { ok: true };
const created: ActionResult<{ id: number }> = { ok: true, id: 42 };
const refused: ActionResult = { ok: false, error: "NOT_ENOUGH_MONEY" };return { ok = true }
return aiLib.fail('NOT_ENOUGH_MONEY') -- { ok = false, error = 'NOT_ENOUGH_MONEY' }Build refusals with fail; read replies with isActionOk and replyError.
Players and characters
AiPlayerData
The player data ai-core pushes to a player's own client: one full snapshot when the character loads, then only the key that changed. Also returned by the GetPlayerData export on both sides. Other pages may call it "player data".
Prop
Type
const data: AiPlayerData = {
character: { id: 12, citizenid: "AB12CD34", slot: 1, firstname: "Jane", lastname: "Doe", birthdate: "1994-05-12", sex: "female", nationality: "American" },
money: { cash: 500, bank: 5000, black_money: 0, crypto: 0 },
jobs: [{ job: "police", grade: 2 }],
duty: "police",
job: { job: "police", grade: 2 },
gangs: [],
activeGang: null,
metadata: { hunger: 80, thirst: 75 },
};CharacterInfo
A character as other resources see it (the "character" of GetCharacter, playerLoaded and AiPlayerData.character).
Prop
Type
const character: CharacterInfo = {
id: 12, citizenid: "AB12CD34", slot: 1,
firstname: "Jane", lastname: "Doe", birthdate: "1994-05-12",
sex: "female", nationality: "American",
};JobMembership
One job a character has.
Prop
Type
const membership: JobMembership = { job: "police", grade: 2 };GangMembership
One gang a character is in.
Prop
Type
const membership: GangMembership = { gang: "ballas", grade: 0 };SpawnPoint
Where and how a loaded character appears in the world (the payload ai-core sends to put the character in the world).
Prop
Type
const spawn: SpawnPoint = { x: -1037.6, y: -2737.9, z: 20.2, heading: 330, model: "mp_f_freemode_01", armour: 0, health: 200 };Branding
The server's name and look on full-screen menus (panel General settings; export GetBranding).
Prop
Type
const branding: Branding = { name: "Los Santos RP", subtitle: "Serious roleplay", tagline: "Welcome", taglineSub: "Pick a character", background: "skyline" };PlayerCache
The local player's often read values, kept current by ai-core's one watcher (lib cache on the client). false means "none".
Prop
Type
const snapshot: PlayerCache = { ped: 258, playerId: 0, serverId: 7, vehicle: 81922, seat: -1, weapon: false };UnloadReason
Why a character was let go.
| Value | Meaning |
|---|---|
"dropped" | The player left the server. |
"switch" | The player went back to the character screen. |
Money
Account names
Money lives in named accounts. The panel's Accounts list sets which exist; ai-core ships with these:
| Name | Label | Starting amount |
|---|---|---|
cash | Cash | 500 |
bank | Bank | 5000 |
black_money | Dirty money | 0 |
crypto | Crypto | 0 |
A server owner can add, rename or remove accounts in the panel, so read the list with the GetAccountTypes export instead of assuming it. When the list is empty, ai-core keeps a single cash account.
core.AddMoney(source, "bank", 250, "Paycheck");AccountTypeDefinition
One account type from the panel's Accounts list (GetAccountTypes returns Record<string, AccountTypeDefinition>, keyed by account name).
Prop
Type
const bank: AccountTypeDefinition = { label: "Bank", start: 5000, allowNegative: false };MoneyRef
One side of a money transfer (TransferMoney): a loaded player's account, or a job's or gang's shared account.
Prop
Type
const player: MoneyRef = { source: 7, account: "bank" };
const society: MoneyRef = { owner: "job", id: "mechanic", account: "bank" };Jobs and gangs
GradeDefinition
One grade of a job or gang (panel content).
Prop
Type
const grade: GradeDefinition = { label: "Sergeant", salary: 400, boss: false };JobDefinition
One job from the panel's Jobs list (GetJobDefinition). Grade n of a JobMembership is grades[n].
Prop
Type
const police: JobDefinition = {
label: "Police", type: "leo", defaultDuty: false, listed: false,
grades: [ { label: "Cadet", salary: 200, boss: false }, { label: "Chief", salary: 900, boss: true } ],
};GangDefinition
One gang from the panel's Gangs list (GetGangDefinition).
Prop
Type
const ballas: GangDefinition = { label: "Ballas", grades: [ { label: "Recruit", salary: 0, boss: false } ] };AccessRule
Who may use a place (a shop, a stash, a garage): one of jobs or one of gangs. Both lists empty means everyone. From @aicore-fivem/lib/shared; read it with readAccess.
Prop
Type
const armoury: AccessRule = { jobs: ["police"], gangs: [], grades: { police: 2 }, onDuty: true };Inventory
InventoryRef
Which inventory a call works on.
| Value | Means |
|---|---|
number | A player's server id: that player's own inventory. |
string | Any other inventory by its id: a stash name, a trunk or glovebox id. |
inventory.addItem(source, "water", 2); // a player
inventory.addItem("police_evidence", "phone", 1); // a stashItemMetadata
Free data stored on one item stack (Record<string, unknown>): a serial number, durability, a note. Each inventory shows some keys itself (label, description, image in most of them).
const metadata: ItemMetadata = { serial: "AB-1029", durability: 100 };Keep metadata small and JSON-safe (strings, numbers, booleans, plain objects and arrays). Two stacks with different metadata never stack together.
InventoryStack
One stack in an inventory (GetItems returns a list of these).
Prop
Type
const stack: InventoryStack = { name: "water", label: "Water", count: 3, slot: 4, metadata: {} };UsedItem
The stack a usable item handler gets when a player uses an item.
Prop
Type
const used: UsedItem = { name: "lockpick", slot: 2, count: 1, metadata: { durability: 80 } };UsableItemHandler
(source: number, item: UsedItem) => unknown: runs when a player uses the item. Returning false keeps the item in inventories that take a used item themselves (ai-inventory takes the item's consume amount); other inventories follow their own item settings.
const onUse: UsableItemHandler = (source, item) => {
if (item.metadata.durability === 0) return false; // keep it
return true;
};ItemDefinition
One item as the active inventory defines it (GetItemDefinition). Other pages may call it "item" or "item definition".
Prop
Type
const water: ItemDefinition = { name: "water", label: "Water", weight: 500, unique: false, close: true, description: "Fresh water" };StashDefinition
A stash as ai-core keeps it (the arguments of RegisterStash).
Prop
Type
const evidence: StashDefinition = { name: "police_evidence", label: "Evidence", slots: 50, maxWeight: 100000, jobs: ["police"] };ShopProduct
One product of a script shop.
Prop
Type
const product: ShopProduct = { name: "bandage", price: 50 };ShopDefinition
A shop a script registers. The server opens it for a player; it has no place of its own.
Prop
Type
const shop: ShopDefinition = { name: "police_armoury", label: "Armoury", items: [{ name: "bandage", price: 50 }] };HeldWeapon
The weapon item the local player holds, as the inventory knows it.
Prop
Type
const held: HeldWeapon = { name: "WEAPON_PISTOL", label: "Pistol" };Vehicles
VehicleProps
A vehicle's look and tuning as plain data: colours, mods, extras, livery, wheels, neon, tint, plate and condition. From @aicore-fivem/lib/shared. Stored JSON carries v: 1. Check received data with toVehicleProps.
Prop
Type
const props: VehicleProps = {
v: 1, model: 1032823388, plate: "AI 123", plateIndex: 0,
colors: [12, 12], extraColors: [0, 156], customPrimary: null, customSecondary: null,
wheelType: 0, windowTint: -1, livery: -1, mods: { 11: 2, 18: 1 }, xenonColor: 255,
neon: [false, false, false, false], neonColor: [255, 0, 255], tyreSmoke: [255, 255, 255],
extras: { 1: true }, dirt: 0, engineHealth: 1000, bodyHealth: 1000,
};VehicleSetup
What a freshly spawned vehicle gets on top of the model's defaults (the setup of lib spawnVehicle, a shop's chosen colour). From @aicore-fivem/lib/shared. Every field is optional. Check received data with toVehicleSetup.
Prop
Type
const setup: VehicleSetup = { colors: [27, 27], windowTint: 1, engineOn: true };KeyPurpose
Why a player gets a vehicle's key. Key scripts treat each one differently. Anything unknown counts as "temporary".
| Value | Use it when |
|---|---|
"purchase" | The player now owns the vehicle (dealer, admin give): a new key, older copies stop working. |
"garage" | An owned vehicle comes out of storage: the owner already has the key. |
"job" | A work vehicle for the shift. |
"rental" | A rented vehicle for the rental time. |
"temporary" | Anything else short-lived (admin spawn, test drive, robbery vehicle). The default. |
vehicleKeys.give(source, vehicle, "rental");VehicleOwner
Who owns an ai-vehicles vehicle.
Prop
Type
const owner: VehicleOwner = { type: "character", id: "12" };OwnedVehicle
An owned vehicle as ai-vehicles keeps it (GetVehicle).
Prop
Type
const car: OwnedVehicle = {
id: 7, plate: "AI 123", owner: { type: "character", id: "12" }, model: "sultan",
props: null, setup: null, state: "garage", garage: "legion", fuel: 100, engine: 1000, body: 1000,
};World
Weather
A weather type name of the qb-weathersync contract, exact upper case: "EXTRASUNNY", "CLEAR", "NEUTRAL", "SMOG", "FOGGY", "OVERCAST", "CLOUDS", "CLEARING", "RAIN", "THUNDER", "SNOW", "BLIZZARD", "SNOWLIGHT", "XMAS", "HALLOWEEN". The list is the WEATHERS constant; isWeather(value) checks a value.
import { isWeather, type Weather } from "@aicore-fivem/shared";
const next: Weather = "RAIN";
if (isWeather(input)) world.setWeather(input);BlipStyle
A blip's look as the panel's blip widget stores it. From @aicore-fivem/lib/shared; read it with readBlipStyle.
Prop
Type
const style: BlipStyle = { sprite: 52, color: 2, scale: 0.8 };PlacePed
An NPC standing at a place (a shopkeeper, a clerk). From @aicore-fivem/lib/shared; read it with readPlacePed.
Prop
Type
const clerk: PlacePed = { model: "mp_m_shopkeep_01", scenario: "WORLD_HUMAN_STAND_IMPATIENT", coords: { x: 24.5, y: -1346.6, z: 29.5, heading: 270 } };Player UI
NotificationKind
The colour and icon of a notification card: "success", "error", "info" or "warning". Other pages may call it "notify kind".
notify(source, "Vehicle stored", "success"); // server lib notify(source, text, kind?, duration?)Notification
A notification card. ai-lib draws it; texts are already translated by the sender.
Prop
Type
const card: Notification = { text: "Vehicle stored", kind: "success", duration: 3000 };ProgressOptions
What the client progress bar (lib progress on the client) shows and how the player may move while it runs. From @aicore-fivem/lib/client.
Prop
Type
const repair: ProgressOptions = {
label: "Repairing",
duration: 8000,
anim: { dict: "mini@repair", clip: "fixing_a_player" },
canCancel: true,
disable: { move: true, combat: true },
};ServerProgress
The bar a server flow runs on a player's client (lib progressFor). The same fields as ProgressOptions without whileDead. ProgressForOptions (from @aicore-fivem/lib/server) adds one field:
Prop
Type
const bar: ProgressForOptions = { label: "Picking the lock", duration: 6000, scenario: "PROP_HUMAN_PARKING_METER", minRatio: 0.9 };MenuItem
One row of a menu.
Prop
Type
const row: MenuItem = { id: "water", label: "Water ($5)", icon: "bottle-water" };MenuRequest
A menu to show (lib menu, Lua aiLib.menu.show).
Prop
Type
const shop: MenuRequest = {
title: "24/7",
items: [ { id: "water", label: "Water ($5)" }, { id: "bread", label: "Bread ($3)" } ],
};InputField
One field of an input dialog. It is a number field or a text field, picked by type.
Number field:
Prop
Type
Text field:
Prop
Type
InputRequest
An input dialog to show (lib input, Lua aiLib.input).
Prop
Type
const fine: InputRequest = {
title: "Write a fine",
confirm: "Send",
fields: [
{ name: "amount", label: "Amount", type: "number", min: 1, max: 10000 },
{ name: "reason", label: "Reason", type: "text", maxLength: 80 },
],
};PromptAnchor
Where a world prompt floats: a fixed point, or spots on entities. Entity offsets are in the entity's own space, so the prompt moves and turns with it (a swinging door). Of several entity spots, the one nearest the player is shown each frame.
Point:
Prop
Type
Entity spots:
Prop
Type
const atPoint: PromptAnchor = { x: 25.7, y: -1347.3, z: 30.2 };
const onDoor: PromptAnchor = { anchors: [{ entity: door, offset: { x: 0.5, y: 0, z: 0 } }] };ItemPickerRequest
ai-core's item picker for admin tools: every item of the active inventory with its picture, a search and a count.
Prop
Type
const request: ItemPickerRequest = { title: "Give items", target: 7 };PickedItem
One row the item picker answers.
Prop
Type
SkillDifficulty
How hard a skill check stage is: "easy", "medium", "hard", or ox_lib's own shape { areaSize: number; speedMultiplier: number }. The named stages: easy = 50 degree green arc at 0.6 turns per second, medium = 40 at 0.85, hard = 25 at 1.
const stages: SkillDifficulty[] = ["easy", "medium", { areaSize: 30, speedMultiplier: 1.2 }];LockpickResult
What the lockpick answers: "opened" (the lock opened), "broken" (the player broke every pick) or "cancelled" (the player closed it).
RadialItem
One item of the radial wheel (lib radial). Its functions run in the resource that added it; ai-core drops the item when that resource stops.
Prop
Type
const item: RadialItem = {
id: "engine", label: "Engine", icon: "car", parent: "vehicle",
canShow: () => cache.seat === -1,
onPressed: () => SetVehicleEngineOn(cache.vehicle as number, !GetIsVehicleEngineRunning(cache.vehicle as number), false, true),
};KeyHintRequest
A key help line a script shows for a while (admin noclip keys). Give keybind or key.
Prop
Type
const hint: KeyHintRequest = { label: "Speed up", key: "SHIFT", icon: "gauge-high" };KeyHintWhen
When a keybind's hint shows in HUDs: "foot" (on foot), "vehicle" (in a vehicle) or "always". The server owner can change it in the panel; a keybind without one never shows a hint.
KeyHintView
One row of the key hints a HUD shows (client export GetKeyHints, event ai-core:client:keyHints): the key as the player has it bound, and what it does.
Prop
Type
const row: KeyHintView = { id: "noclip_speed", key: "SHIFT", label: "Speed up", icon: "gauge-high" };Logs, alerts, phone
LogOptions
Extra details of a log line (lib aiLog, export Log).
Prop
Type
aiLog("payments", "Paid a bill", { source, metadata: { amount: 250 } });LogLevel
Severity of a log line: "debug", "info", "warn" or "error".
LogChannel
How a resource describes one of its log channels (lib aiLogChannels, export LogChannels, called once at start). Webhook urls are never here: the server owner sets them in ai-core's panel.
Prop
Type
aiLogChannels({ payments: { dataset: "my-shop" }, debug: { active: false } });DispatchAlert
A police (or other job) alert. The active alert script shows it to the on-duty members of jobs. Texts are already translated.
Prop
Type
const alert: DispatchAlert = { code: "10-71", title: "Shots fired", source, jobs: ["police"], priority: "high" };PhoneMail
A mail a script sends to a player's phone.
Prop
Type
const mail: PhoneMail = { sender: "Los Santos Customs", subject: "Your car is ready", message: "Pick it up at the garage." };PhoneNotification
A notification on a player's phone.
Prop
Type
const note: PhoneNotification = { title: "Bank", message: "You received $250", app: "bank" };Billing, MDT, EMS, garages
BillRequest
A bill a script sends (lib billing.send): from a job (fines, service fees) or from a player, to a player. Texts are already translated.
Prop
Type
const bill: BillRequest = { to: 7, amount: 250, label: "Speeding", from: source, job: "police" };UnpaidBill
One open bill of a player.
Prop
Type
MdtRecord
A record a script writes into the police MDT (lib mdt.record). Texts are already translated.
Prop
Type
const record: MdtRecord = { kind: "jail", target: 7, by: source, title: "Armed robbery", minutes: 20 };MdtRecordKind
What an MDT record is about: "fine", "warrant", "arrest" or "jail".
DistressCall
A downed player's call to the medics (lib ems.distress).
Prop
Type
const call: DistressCall = { jobs: ["ambulance"], message: "Unconscious" };GaragedVehicle
One of a player's vehicles kept by a garage script.
Prop
Type
Looks
CharacterAppearance
A look as ai-core's appearance layer hands it out: the ped model and the clothing script's own data. Treat data as opaque: give the whole object back to ApplyAppearance unchanged.
Prop
Type
ClothingMenu
A clothing script menu other scripts open: "clothing" (clothing shop), "barber" or "outfits" (the player's saved outfits).
JobOutfit
A job outfit (uniform) for the freemode model the player wears. Only the listed pieces change.
Prop
Type
OutfitPiece
One piece of a job outfit.
Prop
Type
const uniform: JobOutfit = {
components: [ { id: 11, collection: "", index: 55, texture: 0 }, { id: 4, collection: "", index: 35, texture: 0 } ],
props: [ { id: 0, collection: "", index: 46, texture: 0 } ],
};Commands
CommandInfo
A command of lib addCommand, as the resource announces it to ai-core (the panel's Commands tab lists it).
Prop
Type
const info: CommandInfo = { names: ["jail", "prison"], help: "Jails a player", params: [{ name: "id", type: "playerId" }], aces: ["ai.admin"] };CommandParam
One argument of a lib addCommand command, parsed and checked before the handler runs.
Prop
Type
const params: CommandParam[] = [
{ name: "id", type: "playerId", help: "Player id" },
{ name: "reason", type: "longString", help: "Reason", optional: true },
];Admin panel
PanelSchema
A script's admin panel: which data files it has and how the panel lays them out. A resource hands it to the lib's AdminPanel (see Admin panel). Every text field is a lang key of the resource's locales/*.json.
Prop
Type
const schema: PanelSchema = {
title: "ADMIN_TITLE",
icon: "store",
files: { shops: { kind: "records", sync: "all", labelPath: "label", sections: { label: { type: "text", min: 1, max: 48 }, coords: { type: "vec3" } } } },
tabs: [{ id: "shops", file: "shops", icon: "store", label: "ADMIN_TAB_SHOPS", desc: "ADMIN_TAB_SHOPS_DESC", cards: [] }],
};FileSpec
One data file of a panel.
Prop
Type
TabSpec
One tab of the panel, showing one file.
Prop
Type
CardSpec
One card of fields inside a tab.
Prop
Type
const card: CardSpec = {
icon: "location-dot",
title: "ADMIN_CARD_PLACE",
fields: [{ widget: "point", path: "coords", label: "ADMIN_F_COORDS", hint: "ADMIN_H_COORDS" }],
};LookupSource
A list of values a panel field picks from. A lookup on a text or names field makes the server refuse anything else and the panel offer the list.
| Value | The list |
|---|---|
"item" | Items of the active inventory. |
"job" | Jobs from the panel's Jobs list. |
"gang" | Gangs from the panel's Gangs list. |
"account" | Money accounts. |
"resource" | Started resources. |
"player" | Online players, by citizen id. |
"vehicle" | Every vehicle model the admin's game has, addons included. Never refused by the server (it cannot list models). |
"ped" | GTA's ped models. Never refused by the server. |
AdminDelta
A changed record of a panel file, forwarded to the admins who have the panel open (export AdminPanelChanged).
Prop
Type
const delta: AdminDelta = { resource: "my-shop", file: "shops", key: "legion", value: { label: "Legion" } };UpdateInfo
A script whose GitHub release is newer than the running version (ai-core's update check, export GetUpdates).
Prop
Type
const update: UpdateInfo = { resource: "ai-core", label: "ai-core", current: "1.4.0", latest: "1.5.0", url: "https://github.com/..." };vRP bridge
VrpConfig
The panel's vRP permission mapping (data/vrp.json), as ai-core's vRP bridge reads it (server export GetVrpConfig; the local event ai-core:vrp:config carries the same shape after a change).
Prop
Type
VrpPermissionRule: grants permission to whoever matches any filled target.
Prop
Type
VrpGroupAlias: a vRP group name that means a job or gang grade, or admin (vRPex style ranks such as "Coronel").
Prop
Type
const config: VrpConfig = {
defaults: { jobPrefix: true, jobOnDuty: true, adminPrefix: true, playerPrefix: true },
permissions: [{ permission: "police.armory", job: "police", gang: "", group: "", grade: 2, onDuty: true, admin: false, everyone: false }],
groups: { Coronel: { job: "police", gang: "", grade: 4, admin: false } },
items: { "edible|tacos": "tacos" },
};