AI Core

ai-pawnshop for developers

ai-pawnshop has no exports. Its ledger reason, the vehicles a scrapyard refuses, and its private callbacks.

ai-pawnshop has no exports, events or state bags for other scripts. Shops and yards are panel data, and items and money go through AI Core.

Money

Pawnshop sales go to the panel's Money account with the ledger reason pawn:<shopId> (for example pawn:pawn_vinewood).

Which vehicles a scrapyard takes

A yard takes only world vehicles. It refuses:

  • vehicles created by the server (population type 7, "mission"): rentals, job and service cars, owned cars spawned by a garage, the armored truck, and any vehicle your own script spawns on the server;
  • vehicles registered in ai-vehicles (an owned plate).

So a vehicle spawned from the server with the lib's spawnVehicle can never be scrapped, which keeps work vehicles and rentals safe without extra code.

Feeding a pawnshop from your script

A shop buys whatever items are listed under What it buys. To let players sell your script's loot, give them an item and add it to a shop's list in the panel; no code is needed on the ai-pawnshop side.

Private callbacks

The script's own contract (resource/common/pawn.ts). The server checks the distance, the stock and the cooldown on every call. They may change between versions: do not call them from other resources.

NameDirectionWhat it carries
ai-pawnshop:offersclient callback(shopId): answers { ok, offers }, what this shop buys that the player carries.
ai-pawnshop:sellclient callback(shopId, item, count): sell items.
ai-pawnshop:scrapStartclient callback(yardId, netId): start taking a vehicle apart; the server runs the progress bar and pays.

On this page