ai-management for developers
ai-management has no exports. Memberships and the group account are ai-core's, so other scripts use ai-core directly.
ai-management has no exports, events or state bags for other scripts. Everything it changes belongs to ai-core:
| What the boss does | What ai-core holds | Read or change it with |
|---|---|---|
| Hire, change grade, fire | The player's job or gang membership | ai-core's job and gang exports (ai-core server exports) |
| Deposit, withdraw | The job's or gang's bank shared account | GetSharedMoney, AddSharedMoney, RemoveSharedMoney, or the lib's money.transfer |
Who counts as a boss is the boss flag on a grade in ai-core's job and gang definitions (lib definitions.job(name) / definitions.gang(name)).
Example
Show a job's account balance, the same number the boss menu shows:
import { addCommand, notify, resourceExport } from "@aicore-fivem/lib/server";
const core = resourceExport("ai-core");
// /jobbalance police (ai-core admins)
addCommand(
"jobbalance",
{ help: "Show a job account", restricted: true, params: [{ name: "job", type: "string" }] as const },
(source, { job }) => {
const balance = core.GetSharedMoney("job", job, "bank");
const text = balance === null ? "No such job account" : `${job}: $${balance}`;
if (source > 0) notify(source, text, "info");
else console.log(text);
},
);Private callbacks
The boss menu's calls (resource/common/boss.ts): open the menu, hire, set a grade, fire, deposit and withdraw. The server checks the boss grade and the distance on every call. They may change between versions: do not call them from other resources.