Referencia de la APILib para Lua
Todas las funciones de aiLib
La lista completa de miembros de aiLib: lado, si la llamada espera y la página que la documenta con su pestaña Lua.
Cada miembro de aiLib, a partir del init.lua de ai-lib. La mayoría son el equivalente de una función de TypeScript y se documentan en la página de esa función, con la llamada Lua en el bloque de firma y una pestaña de ejemplo Lua. Espera significa que la llamada se pausa hasta que llega la respuesta: llámala dentro de un hilo (consulta Funciones que esperan).
Los métodos de una clase (points:add(...), job:set(...)) se listan con su clase.
Ambos lados
| Función | Espera | Documentado en |
|---|---|---|
aiLib.side | no | Lib para Lua |
aiLib.every(ms, fn, options?), job:set(active), job:stop(), job.running | no | Planificación: every |
aiLib.waitFor(check, timeout?, interval?) | sí | Planificación: waitFor |
aiLib.formatText(text, ...) | no | Texto y números: formatText |
aiLib.locale(resource?) | no | Idioma: createLocale |
aiLib.fail(error) | no | Acciones y entrada del cliente: fail |
aiLib.numbers.round(value, decimals?) | no | Texto y números: round |
aiLib.numbers.groupDigits(value, separator?) | no | Texto y números: groupDigits |
aiLib.numbers.headingTo(from, to) | no | Posiciones: headingTo |
aiLib.stripGameText(text) | no | Texto y números: stripGameText |
aiLib.notify(...): cliente (text, kind?, duration?), servidor (source, text, kind?, duration?) | no | Cliente: Interfaz compartida, Servidor: Jugadores |
aiLib.inventory, aiLib.world, aiLib.appearance, aiLib.mdt | ver abajo | Los miembros difieren según el lado (abajo). |
Cliente
| Función | Espera | Documentado en |
|---|---|---|
aiLib.triggerServerCallback(name, args?, timeout?) | sí | Hablar con el servidor |
aiLib.onServerCallback(name, handler) | no | Hablar con el servidor |
aiLib.onServerEvent(name, handler) | no | Hablar con el servidor |
aiLib.callAction(name, args?, { fallback, timeout?, silent? }) | sí | Hablar con el servidor |
aiLib.cache (ped, playerId, serverId, vehicle, seat, weapon), aiLib.cache.onChange(key, handler) | no | El jugador local |
aiLib.player (coords, heading, distanceTo, freeze, teleport, playAnim, stopAnim) | teleport sí | El jugador local |
aiLib.fadeOut(ms?), aiLib.fadeIn(ms?) | sí | El jugador local |
aiLib.playerPed(serverId) | no | El jugador local |
aiLib.nearestPlayer(metres, { from?, filter? }) | no | El jugador local |
aiLib.playerData.get(key), aiLib.playerData.onChange(key, handler) | no | Utilidades solo de Lua |
aiLib.Points.new(): :add, :addModel, :addVehicle, :remove, :clear, :refresh | no | Puntos de interacción |
aiLib.Zones.new(): :add, :remove, :clear, :isInside | no | Zonas |
aiLib.LocalPed.new(options): :remove | no | Peds, blips y props |
aiLib.Blips.new(): :add, :get, :remove, :clear; aiLib.Blips.create(options) | no | Peds, blips y props |
aiLib.progress(options), aiLib.progress.cancel(), aiLib.progress.isRunning() | progress sí | Interfaz compartida |
aiLib.menu.show(request, listeners?) | sí | Interfaz compartida, la tabla menu |
aiLib.input(request) / aiLib.menu.input | sí | Interfaz compartida |
aiLib.itemPicker(request) / aiLib.menu.itemPicker | sí | Interfaz compartida |
aiLib.skillCheck(difficulty, keys?) / aiLib.menu.skillCheck | sí | Interfaz compartida |
aiLib.lockpick(options?) / aiLib.menu.lockpick | sí | Interfaz compartida |
aiLib.showPrompt(id, text), aiLib.hidePrompt(id), aiLib.onPromptPressed(handler) | no | Interfaz compartida |
aiLib.hud (hide, show, visible) | no | Pantallas y controles |
aiLib.keyHints (show, hide) | no | Pantallas y controles |
aiLib.controls (disable, disableAll, enable) | no | Pantallas y controles |
aiLib.Keybind.new(options): :disable | no | Keybinds |
aiLib.inventory (openInventory, hasItem, currentWeapon) | no | Capas a través de ai-core |
aiLib.world (pauseSync, resumeSync) | no | Capas a través de ai-core |
aiLib.appearance (apply, read, openMenu, wearOutfit, reloadSkin) | no | Capas a través de ai-core |
aiLib.gestures (isHandsUp, isPointing, provider, playEmote, cancelEmote, emoteProvider) | no | Capas a través de ai-core |
aiLib.seatbelt (isOn, onChange, provider) | no | Capas a través de ai-core |
aiLib.radial (add, remove, refresh) | no | Capas a través de ai-core |
aiLib.mdt.open() | no | Capas a través de ai-core |
aiLib.nearestVehicle(metres, { networked?, notOwn?, filter? }) | no | Vehículos y entidades |
aiLib.waitForEntity(netId, timeout?) | sí | Vehículos y entidades |
aiLib.raycast(from, to, options?) | no | Sondeos y carga |
aiLib.groundZ(x, y, z?), aiLib.locationName(coords?), aiLib.vehicleLabel(vehicle), aiLib.waypoint() | no | Sondeos y carga |
aiLib.pedHeadshot(ped, transparent?, timeout?) | sí | Sondeos y carga |
aiLib.onShot(handler) | no | Sondeos y carga |
aiLib.requestModel, requestAnimDict, requestAnimSet, requestPtfxAsset, requestTextureDict, requestWeaponAsset (name, timeout?) | sí | Sondeos y carga |
aiLib.ModelPoints y aiLib.targets son internos (sirven a Points:addModel y a los adaptadores de scripts de target); no los llames.
Servidor
| Función | Espera | Documentado en |
|---|---|---|
aiLib.onClientCallback(name, handler, { rate?, lock?, ace? }) | no | Entrada del cliente |
aiLib.onClientEvent(name, handler, { rate?, ace? }) | no | Entrada del cliente |
aiLib.triggerClientCallback(name, source, args?, timeout?) | sí | Entrada del cliente |
aiLib.progressFor(source, options) | sí | Entrada del cliente |
aiLib.minigameFor(source, options) | sí | Entrada del cliente |
aiLib.isAdmin(source, ace?) | no | Utilidades solo de Lua |
aiLib.addCommand(name, options, handler) | no | Comandos |
aiLib.online (character, name, jobs, gangs, jobGrade, gangGrade, dutyJob, sources) | no | Utilidades solo de Lua |
aiLib.onCharacter({ loaded?, unloaded? }) | no | Jugadores y personajes |
aiLib.playersNear(source, radius), aiLib.playersNearEntity(entity, radius), aiLib.nearestPlayerTo(source, metres, filter?) | no | Jugadores y personajes |
aiLib.RateLimit.new(count, windowMs): :take(source), :release(source) | no | Jugadores y personajes |
aiLib.inventory (addItem, removeItem, getItemCount, hasItem, canCarryItem, getItems, clearInventory, registerStash, openInventory, registerUsableItem, getItemDefinition, registerShop, openShop) | no | Objetos |
aiLib.spawnVehicle(options) | sí | Vehículos |
aiLib.vehicleKeys (give, remove, has) | no | Vehículos |
aiLib.vehicleFromNet(netId), aiLib.vehicleNearPlayer(source, netId, options?), aiLib.nearestVehicleTo(source, metres, filter?) | no | Vehículos |
aiLib.billing (send, unpaid, pay, provider) | unpaid sí | Dinero y banca |
aiLib.banking (open, societyBalance, provider) | no | Dinero y banca |
aiLib.dispatch.alert(alert) | no | Trabajos y servicios |
aiLib.prison (jail, release, timeLeft) | no | Trabajos y servicios |
aiLib.mdt (record, provider) | no | Trabajos y servicios |
aiLib.ems (available, distress, provider) | no | Trabajos y servicios |
aiLib.stress (gain, relieve, provider) | no | Trabajos y servicios |
aiLib.world (getWeather, setWeather, getTime, setTime, setBlackout, freezeTime) | no | Mundo |
aiLib.phone (number, sourceOf, hasPhone, mail, message, notify) | no | Teléfono y apariencia |
aiLib.appearance (get, provider) | get sí | Teléfono y apariencia |
aiLib.aiLog(channel, message, options?) | no | Logs |