# Server

## Server Events

{% hint style="success" %}
Developers can take your script to the next level by utilizing server events for integration
{% endhint %}

## AddMoney

Use this event when the player receives cash

Attribute:

* playerid:
  * `integer`: server id of the player
* monetype:
  * `string`: type of the money
* amount:
  * `integer`: amount of money
* currentbalance:
  * `integer`: the player's current balance of money
* reason:
  * `string`: any reason can be added for the transfer

{% code title="Usage" %}

```lua
TriggerEvent('highqez_cashitem:server:AddMoney', playerid, moneytype, amount, currentbalance, reason)
```

{% endcode %}

***

## RemoveMoney

Use this event when the player loses cash

Attribute:

* playerid:
  * `integer`: server id of the player
* monetype:
  * `string`: type of the money
* amount:
  * `integer`: amount of money
* currentbalance:
  * `integer`: the player's current balance of money
* reason:
  * `string`: any reason can be added for the transfer

{% code title="Usage" %}

```lua
TriggerEvent('highqez_cashitem:server:RemoveMoney', playerid, moneytype, amount, currentbalance, reason)
```

{% endcode %}

***

## SetMoney

Use this event when the player's cash is reset to certain value

Attribute:

* playerid:
  * `integer`: server id of the player
* monetype:
  * `string`: type of the money
* amount:
  * `integer`: amount of money
* reason:
  * `string`: any reason can be added for the transfer

{% code title="Usage" %}

```lua
TriggerEvent('highqez_cashitem:server:SetMoney', playerid, moneytype, amount, reason)
```

{% endcode %}

***

## AddItem

Use this event when an item is added to the player

Attribute:

* playerid:
  * `integer`: server id of the player
* item:
  * `string`: name of the item
* amount:
  * `integer`: amount of item

{% code title="Usage" %}

```lua
TriggerEvent('highqez_cashitem:server:AddItem', playerid, item, amount)
```

{% endcode %}

***

## RemoveItem

Use this event when an item is removed from the player

Attribute:

* playerid:
  * `integer`: server id of the player
* item:
  * `string`: name of the item
* amount:
  * `integer`: amount of item

{% code title="Usage" %}

```lua
TriggerEvent('highqez_cashitem:server:RemoveItem', playerid, item, amount)
```

{% endcode %}

***

## ClearInventory

Use this event when clearing the player's inventory

Attribute:

* playerid:
  * `integer`: server id of the player

{% code title="Usage" %}

```lua
TriggerEvent('highqez_cashitem:server:ClearInventory', playerid)
```

{% endcode %}

***


---

# Agent Instructions: 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://highqez.gitbook.io/docs/resources/cash-item/api/server.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.
