AI Core

ai-vehicleshop for developers

The server export of ai-vehicleshop.

Typed as AiVehicleshopServerExports in @aicore-fivem/shared (exports.ts).

TypeScript
import { resourceExport } from "@aicore-fivem/lib/server";
const shop = resourceExport("ai-vehicleshop");

Server exports

GetCatalogPrice

A model's price in the panel's catalog. Use it to value a vehicle (a buy-back, insurance, a tax). ai-vehiclesales uses it for the dealer's offer.

Side: Server · Waits: no

Signature
GetCatalogPrice(model: string): number | null
Lua
local price = exports['ai-vehicleshop']:GetCatalogPrice(model) -- number or nil

Parameters

Prop

Type

Returns

The price in dollars. null when no catalog vehicle has that model, or model is not text.

Example

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

const shop = resourceExport("ai-vehicleshop");

// Insurance pays out 40 % of the catalog price.
export function insurancePayout(model: string): number {
  const price = shop.GetCatalogPrice(model);
  return price === null ? 0 : Math.floor(price * 0.4);
}

Events

ai-vehicleshop's buy callback is internal (its client to its server); do not call it from other scripts. It checks the shop, the distance, access and the catalog on the server.

On this page