AI Core

ai-properties for developers

GlobalState flags, metadata, stash names, tables and internal events of ai-properties.

ai-properties has no exports. Other scripts can read three things it keeps.

Owned flag (GlobalState)

Each owned property has the GlobalState key prop:<id> set to true (for example prop:grove_1). The key is removed (not set to false) when the property is sold. Readable on the server and on every client.

// Client or server: does anyone own Grove Street 1?
const owned = GlobalState["prop:grove_1"] === true;

The property a character is inside (metadata)

ai-core metadata property holds the id of the property the character is inside, or nothing when outside. Each property interior runs in its own routing bucket, taken from ai-core's bucket allocator while someone is inside.

import { resourceExport } from "@aicore-fivem/lib/server";

const core = resourceExport("ai-core");

export function isInsideProperty(source: number): boolean {
  const data = core.GetPlayerData(source);
  return typeof data?.metadata.property === "string";
}

Stashes

The stash of a property is property_<id>_<owner charId> (for example property_grove_1_12). It is per owner: after a sale, the next owner gets a new, empty stash name. Size comes from the panel's stash slots and weight.

Tables

TableWhat it holds
ai_properties_ownedOne row per owned property: owner character id and owner name.
ai_properties_keysKey holders per property, with their name at the time the key was given.

Events

ai-properties' events are internal (its client and its server); do not call them from other scripts.

NameKindWhat it does
ai-properties:mineclient callbackThe properties the player owns or holds a key to (the session snapshot). Limited to 2 per 10 seconds.
ai-properties:client:accessserver to client(id, access): the player's access changed ("owner", "key" or false).
ai-properties:buy / enterclient callback(id): buy at the door, or enter.
ai-properties:exit / stash / keys / giveKey / sellclient callbackActions inside the property the player is in.
ai-properties:takeKeyclient callback(charId): take a key back.
ai-properties:client:insideserver to client(id | null, to): the player is now inside this property (or left it); teleport to to.

On this page