AI Core

ai-lib

The shared player UI every script uses (notifications, progress bar, prompts, menus, input dialogs, minigames) and the AI Core helpers for Lua and JavaScript resources.

ai-lib does two jobs:

  1. The player UI every script shares. Notification cards, the progress bar and its cancel key, the prompts on the right of the screen and the interaction key, menus, input dialogs, and the lockpick and skill check minigames. Every ai-* script, AI Core's bridge (ESX and QB scripts) and your own scripts draw through it, so the whole server looks the same.
  2. The AI Core helpers for other resources. A Lua resource adds one line to its manifest and gets aiLib.notify, aiLib.Points, aiLib.addCommand, aiLib.progress and the rest. Plain JavaScript resources load its bundles. This is how Lua scripts use AI Core like TypeScript ones do.

The UI runs without ai-core, so you can use ai-lib on its own. The helpers that read players, money or items need ai-core.

What it does in the game

  • Notifications. Cards in four kinds (success, error, info, warning), 4 seconds by default.
  • Progress bar. One bar for every script. The player cancels a cancellable action with Backspace.
  • Prompts. "Press E to ..." boxes on the right, or floating over a world point (a door). One interaction key (E) for every script; the newest prompt is on top.
  • Menus and input dialogs. Lists with icons, sub menus (Escape goes back, holding Escape closes), switches, and forms with text and number fields.
  • Minigames. A lockpick (move the pick, turn the lock) and a skill check (press on the green).
  • Always on top. Menus and notifications show over every other screen, the character screen included.

Installation

The AI Core txAdmin recipe installs it. By hand: put the folder in resources/[ai]/ and add ensure ai-lib to server.cfg, after ensure ai-core when you run AI Core. It needs OneSync. It has no database table.

Panel settings

ai-lib has no tab of its own. Two settings in AI Core's General tab change it:

Setting (General tab)What it changesDefault
Notifications card, Notification scriptWhere notification cards show: ai-lib's own cards, or another notification script you installed. When that script stops, ai-lib's cards come back. Prompts always stay ai-lib's.ai-lib
Interaction card, Interaction stylePrompt and key (ai-lib's prompts), or Target eye (a target script such as ai-target).Prompt and key

Commands

None.

Keybinds

Default keyWhat it doesName in GTA settings
EUses the prompt on top (or the focused target marker)Interact with the prompt on screen
BackspaceCancels the running action (a progress bar that allows it)Cancel the running action

Change the default for everyone in the panel's Keybinds tab; each player can change their own in GTA's key settings.

Works with other scripts

  • ESX and QB UI. AI Core's bridge draws esx_context, esx_textui, esx_notify, esx_progressbar, esx_menu_*, qb-menu, qb-input and progressbar with ai-lib's menus, prompts, cards and bar, so those scripts look like the rest of the server.
  • Other notification scripts can take over the cards (General tab, above).

Known limits

  • The menu icon names are a fixed Font Awesome list; an unknown name shows a dot.
  • Lua resources check their own zones and model points; JavaScript resources hand theirs to ai-lib, which checks them all on one timer.

On this page