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:
- 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. - 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.progressand 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 changes | Default |
|---|---|---|
| Notifications card, Notification script | Where 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 style | Prompt and key (ai-lib's prompts), or Target eye (a target script such as ai-target). | Prompt and key |
Commands
None.
Keybinds
| Default key | What it does | Name in GTA settings |
|---|---|---|
| E | Uses the prompt on top (or the focused target marker) | Interact with the prompt on screen |
| Backspace | Cancels 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-inputandprogressbarwith 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.