Every aiLib function
The full list of aiLib members: side, whether the call waits, and the page that documents it with its Lua tab.
Every member of aiLib, from ai-lib's init.lua. Most are the twin of a TypeScript function and are documented on that function's page, with the Lua call in the signature block and a Lua example tab. Waits means the call pauses until the answer comes: call it inside a thread (see Functions that wait).
Methods of a class (points:add(...), job:set(...)) are listed with their class.
Both sides
| Function | Waits | Documented on |
|---|---|---|
aiLib.side | no | Lib for Lua |
aiLib.every(ms, fn, options?), job:set(active), job:stop(), job.running | no | Scheduling: every |
aiLib.waitFor(check, timeout?, interval?) | yes | Scheduling: waitFor |
aiLib.formatText(text, ...) | no | Text and numbers: formatText |
aiLib.locale(resource?) | no | Locale: createLocale |
aiLib.fail(error) | no | Actions and client input: fail |
aiLib.numbers.round(value, decimals?) | no | Text and numbers: round |
aiLib.numbers.groupDigits(value, separator?) | no | Text and numbers: groupDigits |
aiLib.numbers.headingTo(from, to) | no | Positions: headingTo |
aiLib.stripGameText(text) | no | Text and numbers: stripGameText |
aiLib.notify(...): client (text, kind?, duration?), server (source, text, kind?, duration?) | no | Client: Shared UI, Server: Players |
aiLib.inventory, aiLib.world, aiLib.appearance, aiLib.mdt | see below | The members differ per side (below). |
Client
| Function | Waits | Documented on |
|---|---|---|
aiLib.triggerServerCallback(name, args?, timeout?) | yes | Talking to the server |
aiLib.onServerCallback(name, handler) | no | Talking to the server |
aiLib.onServerEvent(name, handler) | no | Talking to the server |
aiLib.callAction(name, args?, { fallback, timeout?, silent? }) | yes | Talking to the server |
aiLib.cache (ped, playerId, serverId, vehicle, seat, weapon), aiLib.cache.onChange(key, handler) | no | The local player |
aiLib.player (coords, heading, distanceTo, freeze, teleport, playAnim, stopAnim) | teleport yes | The local player |
aiLib.fadeOut(ms?), aiLib.fadeIn(ms?) | yes | The local player |
aiLib.playerPed(serverId) | no | The local player |
aiLib.nearestPlayer(metres, { from?, filter? }) | no | The local player |
aiLib.playerData.get(key), aiLib.playerData.onChange(key, handler) | no | Lua-only helpers |
aiLib.Points.new(): :add, :addModel, :addVehicle, :remove, :clear, :refresh | no | Interaction points |
aiLib.Zones.new(): :add, :remove, :clear, :isInside | no | Zones |
aiLib.LocalPed.new(options): :remove | no | Peds, blips and props |
aiLib.Blips.new(): :add, :get, :remove, :clear; aiLib.Blips.create(options) | no | Peds, blips and props |
aiLib.progress(options), aiLib.progress.cancel(), aiLib.progress.isRunning() | progress yes | Shared UI |
aiLib.menu.show(request, listeners?) | yes | Shared UI, the menu table |
aiLib.input(request) / aiLib.menu.input | yes | Shared UI |
aiLib.itemPicker(request) / aiLib.menu.itemPicker | yes | Shared UI |
aiLib.skillCheck(difficulty, keys?) / aiLib.menu.skillCheck | yes | Shared UI |
aiLib.lockpick(options?) / aiLib.menu.lockpick | yes | Shared UI |
aiLib.showPrompt(id, text), aiLib.hidePrompt(id), aiLib.onPromptPressed(handler) | no | Shared UI |
aiLib.hud (hide, show, visible) | no | Screens and controls |
aiLib.keyHints (show, hide) | no | Screens and controls |
aiLib.controls (disable, disableAll, enable) | no | Screens and controls |
aiLib.Keybind.new(options): :disable | no | Keybinds |
aiLib.inventory (openInventory, hasItem, currentWeapon) | no | Layers through ai-core |
aiLib.world (pauseSync, resumeSync) | no | Layers through ai-core |
aiLib.appearance (apply, read, openMenu, wearOutfit, reloadSkin) | no | Layers through ai-core |
aiLib.gestures (isHandsUp, isPointing, provider, playEmote, cancelEmote, emoteProvider) | no | Layers through ai-core |
aiLib.seatbelt (isOn, onChange, provider) | no | Layers through ai-core |
aiLib.radial (add, remove, refresh) | no | Layers through ai-core |
aiLib.mdt.open() | no | Layers through ai-core |
aiLib.nearestVehicle(metres, { networked?, notOwn?, filter? }) | no | Vehicles and entities |
aiLib.waitForEntity(netId, timeout?) | yes | Vehicles and entities |
aiLib.raycast(from, to, options?) | no | Probes and loading |
aiLib.groundZ(x, y, z?), aiLib.locationName(coords?), aiLib.vehicleLabel(vehicle), aiLib.waypoint() | no | Probes and loading |
aiLib.pedHeadshot(ped, transparent?, timeout?) | yes | Probes and loading |
aiLib.onShot(handler) | no | Probes and loading |
aiLib.requestModel, requestAnimDict, requestAnimSet, requestPtfxAsset, requestTextureDict, requestWeaponAsset (name, timeout?) | yes | Probes and loading |
aiLib.ModelPoints and aiLib.targets are internal (they serve Points:addModel and the target script adapters); do not call them.
Server
| Function | Waits | Documented on |
|---|---|---|
aiLib.onClientCallback(name, handler, { rate?, lock?, ace? }) | no | Client input |
aiLib.onClientEvent(name, handler, { rate?, ace? }) | no | Client input |
aiLib.triggerClientCallback(name, source, args?, timeout?) | yes | Client input |
aiLib.progressFor(source, options) | yes | Client input |
aiLib.minigameFor(source, options) | yes | Client input |
aiLib.isAdmin(source, ace?) | no | Lua-only helpers |
aiLib.addCommand(name, options, handler) | no | Commands |
aiLib.online (character, name, jobs, gangs, jobGrade, gangGrade, dutyJob, sources) | no | Lua-only helpers |
aiLib.onCharacter({ loaded?, unloaded? }) | no | Players and characters |
aiLib.playersNear(source, radius), aiLib.playersNearEntity(entity, radius), aiLib.nearestPlayerTo(source, metres, filter?) | no | Players and characters |
aiLib.RateLimit.new(count, windowMs): :take(source), :release(source) | no | Players and characters |
aiLib.inventory (addItem, removeItem, getItemCount, hasItem, canCarryItem, getItems, clearInventory, registerStash, openInventory, registerUsableItem, getItemDefinition, registerShop, openShop) | no | Items |
aiLib.spawnVehicle(options) | yes | Vehicles |
aiLib.vehicleKeys (give, remove, has) | no | Vehicles |
aiLib.vehicleFromNet(netId), aiLib.vehicleNearPlayer(source, netId, options?), aiLib.nearestVehicleTo(source, metres, filter?) | no | Vehicles |
aiLib.billing (send, unpaid, pay, provider) | unpaid yes | Money and banking |
aiLib.banking (open, societyBalance, provider) | no | Money and banking |
aiLib.dispatch.alert(alert) | no | Jobs and services |
aiLib.prison (jail, release, timeLeft) | no | Jobs and services |
aiLib.mdt (record, provider) | no | Jobs and services |
aiLib.ems (available, distress, provider) | no | Jobs and services |
aiLib.stress (gain, relieve, provider) | no | Jobs and services |
aiLib.world (getWeather, setWeather, getTime, setTime, setBlackout, freezeTime) | no | World |
aiLib.phone (number, sourceOf, hasPhone, mail, message, notify) | no | Phone and appearance |
aiLib.appearance (get, provider) | get yes | Phone and appearance |
aiLib.aiLog(channel, message, options?) | no | Logs |