# FiveM

### Installation

1. Go to [My Settings](https://tip4serv.com/dashboard/my-settings) and complete your profile
2. Add a **FiveM** server via [My Servers](https://tip4serv.com/dashboard/my-servers) and follow the setup instructions

✅ On successful connection, your console will show:\
`Server has been successfully connected`

🔄 To check the connection later, run this command on your FiveM server console:

```
restart tip4serv
```

***

### How Donations Work

1. The player donates through your Tip4Serv store
2. Their purchase is automatically delivered in-game

Players can also run:

```
/checkdonate
```

to force-check their donation delivery.

***

### Setting Up Commands

Before you set up commands:

* All commands run from the **server console** (not in-game as admin).
* If your framework does not support console commands, you must create them manually (see below).

You can configure your commands from the [product editor](/store-setup/server-commands.md).

{% hint style="info" %}
When a player connects to your server, the `{fivem_live_id}` placeholder in your command will automatically be replaced with their actual FiveM Live ID, retrieved using their Steam ID or Discord ID provided at checkout.
{% endhint %}

***

### 📣 In-Game Donation Announcements

Use the built-in `t4s_announce` command:

```bash
t4s_announce [STORE] Thanks to {discord_username} for donating on mystore.tip4serv.com
t4s_announce [STORE] Thanks to {steam_username} for donating on mystore.tip4serv.com
```

***

### 🔧 Commands for ESX Framework

✅ Requires [ESX](https://esx-framework.org) and [es\_extended](https://github.com/ESX-Official/es_extended)

* **Give Money**

  ```
  giveaccountmoney {fivem_live_id} bank 5000
  ```
* **Give Item**

  ```
  giveitem {fivem_live_id} milk 1
  ```
* **Give Weapon**

  ```
  giveweapon {fivem_live_id} WEAPON_STUNGUN 32
  ```
* **Set Group**

  ```
  setgroup {fivem_live_id} vip
  ```
* **Set Job and Grade**

  ```
  setjob {fivem_live_id} police 1
  ```
* **Give Vehicle**\
  Requires: [esx\_givevehicle](https://github.com/minobear/esx_givevehicle)\
  Console prefix is `_`

  ```
  _givecar {fivem_live_id} t20
  ```

***

### 🛠️ Commands for QBCore Framework

✅ Requires [QBCore](https://github.com/qbcore-framework)

Set `Config.enable_custom_command = true` in `config.lua`

These commands are located in this file: `/server/commands.lua`

* **Give Money**

  ```
  giveaccountmoney {fivem_live_id} bank 5000
  ```
* **Set Gang**

  ```
  setplayergang {fivem_live_id} ballas 1
  ```
* **Set Job**

  ```
  setplayerjob {fivem_live_id} police 1
  ```
* **Set Permission**

  ```
  setplayerpermission {fivem_live_id} vip
  ```
* **Remove All Permissions**

  ```
  removeplayerpermission {fivem_live_id}
  ```
* **Give Item**

  ```
  giveinventoryitem {fivem_live_id} WEAPON_KNIFE 1
  ```
* **Give Vehicle**\
  Requires: [HH Vehextras](https://github.com/hhfw1/hh_vehextras)

  ```
  givevehicletoplayer {fivem_live_id} t20
  ```

***

### ➗ Quantity Multiplier

Let customers choose how much they want to buy.

Enable **“Allow quantity choice”** in the product settings.

**Example:**

```bash
giveaccountmoney {fivem_live_id} bank {quantity*100}
```

If a player buys it 4 times:

```bash
giveaccountmoney 14 bank 400
```

***

### Commands also run automatically

Useful if you are creating subscriptions with expiration commands.

Example: if the player unsubscribes, his VIP group will be removed.

To ensure player data is fully loaded, commands with `{fivem_live_id}` will only execute if the player has moved at least once since connecting to the server. This is to ensure that the player is not in the loading screen or in the character choice.

***

### Custom Console-Compatible Commands

If your framework lacks console commands, you can write your own using:

```lua
RegisterCommand(...)
```

Guide: [FiveM Command Docs](https://docs.fivem.net/docs/scripting-manual/migrating-from-deprecated/creating-commands/)

Example from Tip4Serv:\
[Tip4Serv GitHub – commands.lua (line 10)](https://github.com/Murgator/Tip4Serv/blob/master/tip4serv/server/commands.lua)


---

# 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://docs.tip4serv.com/games/fivem.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.
