AI Core

The lib

@aicore-fivem/lib - the helpers every ai-* script is built from, and ai-lib for Lua.

@aicore-fivem/lib replaces ox_lib in AI Core: everything scripts would write by hand lives here, built for scale and checked with benchmarks. TypeScript resources import it (@aicore-fivem/lib/client, /server, /shared); Lua resources load it from ai-lib (shared_script '@ai-lib/init.lua', then aiLib.<name>), JavaScript resources without a bundler load @ai-lib/dist/client.js / server.js.

Client and server input

HelperWhat
onClientCallback, onClientEventClient requests through the gate: rate, guards (isAdmin, hasCharacter, near), argument parser, one call at a time (lock).
triggerServerCallback, callActionThe client side; callAction shows the translated refusal itself.
fail("KEY"), ActionResultRefusals with a lang key.
readInt, readId, readText, readVec3, readVec4, oneArgStrict readers for client values.
progressForA timed action the server runs: ai-lib's progress bar on the player's client, true only when it ran out there and enough time passed on the server.
minigameForA minigame a server flow needs (lockpick, skill check): won, lost or broken, decided on the player's client, the server still checks.
PendingActionsDialogs the server waits for (a note's text): token, freed on drop.
PlayerMap, Cooldowns, KeyedCooldowns, onCharacterPer-player state that cleans itself on drop and character switch.

World

HelperWhat
PointsEvery place players use: prompt or target (the owner's choice), NPCs, blips, model points (ATMs, pumps), vehicle points.
Zones, Blips, LocalPedAreas, blips, local peds.
hasJob, inGang, onDutyIn, onMembershipChangeMembership checks for canShow.
player, cache, onCacheThe local ped: teleport with collision loading, animations, freeze; cached ped, vehicle, seat, weapon.
spawnVehicle, vehicleKeys, vehicleFromNet, pedFromNetServer vehicles with plate, keys, fuel, look and seats in one call.
EntityState, PlayerState, GlobalKey, GlobalGroupState bags without the per-read cost.
raycast, groundZ, locationName, vehicleLabel, pedHeadshotProbes and names.
AreaStream, AreaFollowerWorld objects (drops, plants, bodies, props) streamed to the players around them: a snapshot of the cells around the player, then only changes.

UI and flow

HelperWhat
notify, progress, menu, input, itemPickerThe shared UI, drawn by ai-lib (the item picker by ai-core). progress takes an animation or scenario, a point to face, blocked controls, freeze, cancel key.
skillCheck, lockpickMinigames drawn by ai-lib: a skill check ring (ox_lib's difficulty shape) and a lockpick with pins and picks.
NuiScreenA resource's full-screen page: focus, hidden HUDs, the close message and the page's callbacks in one class.
Keybind, addCommandKeys (shown in the panel and the key list) and commands (ACE checked, listed in the panel).
every(ms, fn)The resource's one scheduler for periodic work.
hud, keyHints, radial, controlsHide HUDs on full-screen UI, key help, radial items, disabled controls.

Through AI Core

inventory, vehicleKeys, dispatch, phone, world (time and weather), prison, medical, appearance, money.transfer, buckets, online (players, jobs, duty, names), isPrimeTime: each forwards to whatever script the server runs for that job.

The complete, current list is .claude/rules/lib.md in the server folder.

On this page