ai-core
The framework. Players and characters, the character screen, money, jobs and gangs, permissions, the admin panel and the ESX, QBCore, Qbox and vRP bridge.
ai-core is AI Core itself: the framework every other script builds on. It knows who is playing, which character they picked, how much money they have, which jobs and gangs they belong to, and who is an admin. It hosts the admin panel for every script, and it lets ESX, QBCore, Qbox and vRP scripts run unchanged.
This page is an overview. The admin panel itself is described on Admin panel.
Players and characters
- Accounts. A player is identified by their FiveM account (the
fivem:identifier). Connecting without one is refused. License and Discord ids are stored next to it for scripts that read them. - Several characters per account (3 slots by default). Players can delete characters unless you turn it off.
- Character screen. The player's characters stand in a real scene of the city, each in their own clothes; the camera glides to the one picked. Your server name, subtitle and tagline show on it.
- Creating a character asks for first and last name, birth date (minimum age 18 by default), sex and nationality. A new character then goes through the clothing creator (ai-appearance or another clothing script).
- Where to appear. A new character appears at the First spawn point. Optionally, after picking a character, a list shows the last location and the places you set.
- Saving. Money and memberships are saved at once. Position, armour and other small changes are saved every 5 minutes (panel), at logout, on resource stop and on txAdmin shutdown.
- PvP. One switch decides whether players can hurt each other (on by default); admins flip it in the game with
/togglepvp.
Money
- Accounts Cash (500 to start), Bank (5000), Dirty money and Crypto by default. You add, rename or remove accounts in the panel (Money accounts), each with a starting amount and whether it may go below zero.
- Jobs and gangs have their own accounts too (society money).
- Every change is written with a ledger row: who, how much, the reason.
Jobs and gangs
- Several jobs per character (3 by default, or one when Several jobs per character is off), and several gangs (2 by default) with one active gang.
- Duty. A character is on duty for at most one job. Salary comes only from the on-duty job. Players start off duty after joining unless you turn on Keep duty after rejoining.
- Paycheck. Every 15 minutes (panel) on-duty players get their rank's salary into their bank account, paid by the server or, if you choose, from the job's own account.
- Prime time. Outside the busy hours (18:00 to 01:00 by default) salaries drop to half. The hours, the cut and the switch are in the panel; a job can have its own hours.
- Jobs and gangs themselves (ranks, salaries, boss ranks) are records in the panel's Jobs and Gangs tabs.
Permissions
- Admins are players with the ACE
ai.admin. The recipe'spermission.cfggives it togroup.admin; add a player withadd_principal identifier.fivem:<id> group.admin. On a new server the welcome card shows the exact line. - Commands made with AI Core's lib check permissions on the server: everyone, admins, or certain ACEs and groups. The panel's Commands tab lists every command with who may use it.
- Job and gang permissions. ai-core mirrors memberships to ACE principals:
ai.job.<name>andai.job.<name>.<grade>(every grade up to the player's), the same for gangs. Soadd_ace ai.job.police command.mdt allowgives every officer a command.
Admin panel
ai-core hosts the in-game panel (F10 or /aiadmin) for itself and for every ai-* script. Its own sections:
| Section | What you set |
|---|---|
| General | Server name, subtitle, tagline and background; character slots, deleting, minimum age; the save interval; which inventory, key, police alert, clothing, fuel, door lock, garage, notification, bill, bank, MDT and medic scripts AI Core uses (Automatic picks the first running one); prompt or target interaction; PvP; update checks; refusing players while an unneeded script runs; the setup guide. |
| Spawn points | The first spawn and the places players may choose from. |
| Character screen | The scene behind the character screen: camera, time and weather, the spots where characters stand. |
| Job and gang rules | How many jobs and gangs, duty after rejoining, the paycheck, prime time. |
| Jobs, Gangs | Every job and gang with its ranks, salaries and boss ranks. |
| Money accounts | The kinds of money and what a new character starts with. |
| Keybinds | Every script's keys: the default key for everyone and whether the HUD shows it as a hint. |
| Commands | Every command on the server with its arguments and who may use it. |
| Other panels | Settings screens of other scripts, opened from the dashboard. |
| vRP scripts | Who gets the permissions, groups and items vRP scripts ask for. |
| Logs | Console, Discord, Fivemanage and FiveM Stats, levels, webhooks. |
It also checks every script with a GitHub repository for updates (once every 6 hours per script) and recommends free scripts worth installing on the dashboard.
The bridge (ESX, QBCore, Qbox, vRP)
ai-core provides es_extended, qb-core, qbx_core and vrp, and answers their exports, core objects and events. Scripts written for those frameworks see AI Core as their framework: ESX.GetPlayerFromId, QBCore.Functions.GetPlayer, exports.qbx_core:GetPlayer, vRP 1, 2 and 3 calls all work on AI Core's players, money and jobs.
It also draws the framework UI resources with AI Core's own menus and cards: esx_context, esx_textui, esx_notify, esx_progressbar, esx_menu_default, esx_menu_dialog, esx_menu_list, qb-menu, qb-input and progressbar. Remove those resources: ai-core answers their names. See Compatibility.
Layers: one place for each kind of script
Items, vehicle keys, police alerts, clothing, deaths and revives, prison, fuel, door locks, garages, time and weather, bills, banking, phones, the radial menu, the HUD and notifications all go through ai-core. A script asks ai-core ("give this item"), and ai-core calls the script you run for that job. This is why you can swap almost any ai-* script for a third-party one, and why ai-core tells you in the console when two scripts for the same job run at once.
Installation
The AI Core txAdmin recipe installs it. By hand: put the folder in resources/[ai]/ and add ensure ai-core to server.cfg after ensure ai-mysql and before every other ai-* script. It needs OneSync and the database:
add_convar_permission ai-core read mysql_connection_stringIts tables (ai_core_users, ai_core_characters, ai_core_accounts, ai_core_transactions, ai_core_character_jobs, ai_core_character_gangs, ai_core_bills, ai_core_vrp_data) are created on the first start. Do not install es_extended, qb-core or qbx_core next to it. Keep set resources_useSystemChat false.
Commands
| Command | Arguments | Who | What it does |
|---|---|---|---|
/aiadmin | none | admins | Opens the admin panel. |
/togglepvp | none | admins | Turns player versus player damage on or off (saves the panel setting). |
aicore_switch | [id] | admins | Sends a player (default: you) back to the character screen. |
aicore_job | <job> <grade> [id] | admins | Gives a job at a grade. |
aicore_duty | <job | off> [id] | admins | Puts a player on duty in a job, or off duty. |
aicore_money | <account> <amount> [id] | admins | Adds to an account (a negative amount takes). |
aicore_gang | <gang> <grade> [id] | admins | Gives a gang at a grade. |
aicore_db | [slow] | admins | Database statistics of every resource in the server console; slow lists recent slow queries. |
aicore_alert | [high] | admins | Sends a test police alert at your position through the active alert script. |
The aicore_* commands are test tools: they answer in the server console. The familiar QB / ESX admin commands (setjob, givemoney...) come with ai-admin.
Keybinds
| Default key | What it does | Name in GTA settings |
|---|---|---|
| F10 | Opens the admin panel (admins only) | Open the admin panel |
Known limits
- Players need a FiveM account linked (the
fivem:identifier); players without one cannot join. - A script whose replacement runs at the same time (tgiann-inventory next to ai-inventory) keeps everyone out while both run, if Refuse players while both run is on (default). The console names the folder to delete.