ai-admin for developers
What ai-admin uses and exposes. It has no exports, and every tool runs through AI Core's layers.
ai-admin has no exports. Everything it does goes through AI Core, so the same calls are open to your own script:
| ai-admin tool | What it calls (lib, server) |
|---|---|
| Heal, revive, is down | medical (works with whichever death script runs) |
| Revive fills needs | needs.refill |
Admin car keys, /givekey | vehicleKeys.give(source, vehicle, "temporary") |
/car | spawnVehicle after vehicleType(model, admin) checks the model |
| Item commands, open inventory | inventory (works with whichever inventory runs) |
/items, menu "Give item" | itemPicker |
| Weather, time, blackout, freeze | world (any weather script with the qb-weathersync contract) |
/closeserver | ai-core's AddConnectionCheck |
| Logs | aiLog("actions", ...) |
Permission
Every admin command is registered with addCommand(..., { restricted: true }), which means ACE ai.admin. The quick menu's action callback checks isAdmin() on the server. A player can always switch noclip off; switching it on is asked from the server.
import { addCommand, notify } from "@aicore-fivem/lib/server";
// Your own admin-only command, with the same permission as ai-admin's.
addCommand("cleanarea", { help: "Clean the area", restricted: true }, (source) => {
notify(source, "Area cleaned", "success");
});Optional export it calls
The quick menu's Always show the map calls ai-hud's client export SetMinimapAlways(on) when ai-hud runs.
Events
All of ai-admin's events are internal (its client and its server); do not call them from other scripts.
| Name | Kind | What it does |
|---|---|---|
ai-admin:access | client callback | Whether the player may open the quick menu. |
ai-admin:noclip | client callback | Ask to switch noclip on. |
ai-admin:players | client callback | The online player list for the menu. |
ai-admin:action | client callback | One quick menu action (admin checked on the server). |
ai-admin:giveItems | client callback | The items picked in the item picker (at most 50 rows). |
ai-admin:worldState | client callback | The weather and time for the Weather and time menu. |
ai-admin:client:toggleNoclip | server to client | Switch noclip. |
ai-admin:client:teleport | server to client | Teleport to a point the server picked. |
ai-admin:client:openMenu / openItems | server to client | Open the quick menu or the item picker. |
ai-admin:client:coords | server to client | Show the player's position. |
ai-admin:client:warned | server to client | Show an admin warning. |