AI Core

ai-rental for developers

What ai-rental exposes to other scripts.

ai-rental has no exports and no database. A rented vehicle is a plain spawned vehicle:

  • its plate starts with the panel's Plate start (RNT by default) followed by digits, 8 characters in total;
  • its fuel state bag is 100 when it appears;
  • the renter gets the keys through ai-core's key layer with the purpose "rental", so a key script that knows rentals can treat them apart.

It is not an owned vehicle: ai-vehicles does not know it, and garages refuse to park it.

// Server: is this vehicle a rental? (default plate start "RNT")
export function isRental(vehicle: number): boolean {
  return GetVehicleNumberPlateText(vehicle).trim().startsWith("RNT");
}

The plate start is a panel setting. If the owner changes it, a check like the one above must change too.

Events

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

NameKindWhat it does
ai-rental:rentclient callback(locationId, vehicleKey) -> { ok, plate, minutes }: rent a vehicle of the list. Limited to 2 calls per 5 seconds.
ai-rental:giveBackclient callback(locationId) -> { ok, refund }: give the rental back at the counter.
ai-rental:stateserver to client(active: boolean): whether the player has a rental (shows the return prompt).

On this page