> For the complete documentation index, see [llms.txt](https://corem.gitbook.io/corem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://corem.gitbook.io/corem/crm-pawncreator/exports.md).

# Exports

{% hint style="danger" %}
Prior experience as a developer or basic programming skills are recommended to effectively navigate this section of the documentation.
{% endhint %}

#### Pawnshop Creator Exports

*<mark style="color:$info;">The Pawnshop Creator provides several server-side exports that allow you to fully control pawnshops and their stock from other resources.</mark>*

*<mark style="color:$info;">All exports are server-side.</mark>*

You can use these exports from other resources with:

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

***

### 🔸togglePawnshops

<mark style="color:$info;">Enable or disable</mark> <mark style="color:$info;"></mark><mark style="color:$info;">**all pawnshops globally**</mark><mark style="color:$info;">.</mark>

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

**Returns**

* *(*&#x73;trin&#x67;*)* – `"crm-disabled"` or `"crm-enabled"`

**Example**

```lua
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

<mark style="color:$info;">Add stock to a specific pawnshop item.</mark>

```lua
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**

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

***

### 🔸removePawnshopStock

<mark style="color:$info;">Remove stock from a specific pawnshop item.</mark>

```lua
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 add (must be greater than 0).

**Returns**

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

**Example**

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

***

### 🔸getPawnshopStock

<mark style="color:$info;">Get stock information from a pawnshop.</mark>

```lua
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**

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

***

### 🔸wipePawnshopStock

<mark style="color:$info;">Wipe all stock from a specific pawnshop.</mark>

```lua
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**

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

***

### 🔸wipeAllPawnshopStock

<mark style="color:$info;">Wipe stock from all pawnshops.</mark>

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

**Parameters**

* `crm_onequery` (boolean) –\
  &#x20;   `true` → Uses single optimised MySQL query (requires MySQL 5.7+).\
  &#x20;   `false` → Updates each pawnshop individually.

**Example**

{% hint style="danger" %}
This action affects **all pawnshops**. Use with caution.
{% endhint %}

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

***

### 🔸toggleStations

<mark style="color:$info;">Enable or disable</mark> <mark style="color:$info;"></mark><mark style="color:$info;">**all melting stations globally**</mark><mark style="color:$info;">.</mark>

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

**Returns**

* *(*&#x73;trin&#x67;*)* – `"crm-disabled"` or `"crm-enabled"`

**Example**

```lua
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
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://corem.gitbook.io/corem/crm-pawncreator/exports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
