Skip to Content

Exports

This section is aimed at developers. Basic scripting knowledge will help you get the most out of it.

Pawnshop Creator Exports

These server-side exports let you fully control pawnshops and their stock from any other resource.

Call them like this:

exports["crm-pawncreator"]:functionName(args)

togglePawnshops

Enable or disable all pawnshops globally.

local state = exports['crm-pawncreator']:togglePawnshops()

Returns

  • (string)"crm-disabled" or "crm-enabled"

Example

local state = exports["crm-pawncreator"]:togglePawnshops() if state == "crm-disabled" then print('All pawnshops have been disabled') else print('All pawnshops have been enabled') end

addPawnshopStock

Add stock to a specific pawnshop item.

exports["crm-pawncreator"]:addPawnshopStock(crm_pawnshopid, crm_itemname, crm_quantity)

Parameters

  • crm_pawnshopid (number) – Pawnshop ID.
  • crm_itemname (string) – Item name.
  • crm_quantity (number) – Quantity to add (must be greater than 0).

Returns

  • (boolean, string)true if stock was added successfully, otherwise false and an error reason.

Example

exports["crm-pawncreator"]:addPawnshopStock(1, "diamond_ring", 25)

removePawnshopStock

Remove stock from a specific pawnshop item.

exports["crm-pawncreator"]:removePawnshopStock(crm_pawnshopid, crm_itemname, crm_quantity)

Parameters

  • crm_pawnshopid (number) – Pawnshop ID.
  • crm_itemname (string) – Item name.
  • crm_quantity (number) – Quantity to remove (must be greater than 0).

Returns

  • (boolean, string)true if stock was removed successfully, otherwise false and an error reason.

Example

exports["crm-pawncreator"]:removePawnshopStock(1, "diamond_ring", 10)

getPawnshopStock

Get stock information from a pawnshop.

exports["crm-pawncreator"]:getPawnshopStock(crm_pawnshopid, crm_itemname)

Parameters

  • crm_pawnshopid (number) – Pawnshop ID.
  • crm_itemname (string, optional) – Specific item name.

Returns

  • Returns item stock (number) if crm_itemname is provided.
  • Returns full stock table if crm_itemname is not provided.
  • Returns nil if pawnshop does not exist.

Example

exports["crm-pawncreator"]:getPawnshopStock(1, "gold_watch") local stock = exports["crm-pawncreator"]:getPawnshopStock(1) print(json.encode(stock))

wipePawnshopStock

Wipe all stock from a specific pawnshop.

exports["crm-pawncreator"]:wipePawnshopStock(crm_pawnshopid)

Parameters

  • crm_pawnshopid (number) – Pawnshop ID.

Returns

  • (boolean, string) – true if stock was wiped successfully, otherwise false and an error reason.

Example

exports["crm-pawncreator"]:wipePawnshopStock(1)

wipeAllPawnshopStock

Wipe stock from all pawnshops.

exports["crm-pawncreator"]:wipeAllPawnshopStock(crm_onequery)

Parameters

  • crm_onequery (boolean) – true → Uses single optimised MySQL query (requires MySQL 5.7+). false → Updates each pawnshop individually.

Example

This action affects all pawnshops. Use with caution.

exports["crm-pawncreator"]:wipeAllPawnshopStock(true)

toggleStations

Enable or disable all melting stations globally.

local state = exports['crm-pawncreator']:toggleStations()

Returns

  • (string)"crm-disabled" or "crm-enabled"

Example

local state = exports["crm-pawncreator"]:toggleStations() if state == "crm-disabled" then print('All melting stations have been disabled') else print('All melting stations have been enabled') end