# Garry's Mod

## Connect your Gmod server

1. **Create a Tip4Serv account:** [Sign up here](https://tip4serv.com/)
2. **Add your Gmod server** from your [Tip4Serv dashboard](https://tip4serv.com/dashboard/my-servers) and copy your API KEY
3. Download and drag and drop the `tip4serv` folder into the `garrysmod/addons` directory
4. Open `garrysmod/data/tip4serv/config.json` and set your `key` to the Tip4Serv API key
5. Restart your server
6. Run the following in your server console:

   ```
   tip4serv connect
   ```

> ✅ You should see: **Server has been successfully connected**

***

## Configure commands to be executed after purchase

> Commands are executed via **server console**, not in-game.\
> You **must have at least one player online** during testing, or commands will not execute.

Set up your commands per product from your [product editor](https://docs.tip4serv.com/store-setup/server-commands). You can use any console command supported by your installed addons.

***

### Steam ID Variables

* `{steam_id2}` → Example: `STEAM_0:1:12345678`
* `{steam_id64}` → Example: `76561198000000000`

These placeholders will be replaced automatically during command execution.

***

### Command examples

#### Commands from the Tip4Serv Addon

* Give entity:\
  `tip4serv giveid {steam_id2} entity-name`
* Give ammo:\
  `tip4serv giveid {steam_id2} ammo-name quantity`
* Give armor:\
  `tip4serv givearmor {steam_id2} quantity`
* Broadcast message:\
  `tip4serv say Thank you {gmod_username} for your {total_paid} {currency} donation`

🔗 [View all supported entities](https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index30df.html)

***

### ULX Commands

* Add to group:\
  `ulx adduserid {steam_id2} group-name`
* Remove from group:\
  `ulx removeuserid {steam_id2} group-name`

🔗 [ULX Command Reference](https://ulyssesmod.net/ulx_docs/ulx-commands)

***

### DarkRP Commands

* Give money:\
  `tip4serv addmoneyid {steam_id2} 100000`
* Change job:\
  `tip4serv jobid {steam_id2} job-name`

***

### SAM Admin

* Set rank:\
  `sam setrankid {steam_id2} VIP`
* Remove rank:\
  `sam setrankid {steam_id2} user`

***

### sAdmin

* Add to group:\
  `sa Setrankid {steam_id2} group-name`
* Remove from group:\
  `sa Removeuser {steam_id2} group-name`
* Give ammo:\
  `sa Giveammo {steam_id2} ammo-name amount`
* Give entity:\
  `sa Give {steam_id2} entity-name`

***

### xAdmin

* Set group:\
  `xadmin_setgroup {steam_id2} group-name`

***

### VoidCases – Unboxing System

VoidCases is a sleek unboxing system with trading, marketplace, and in-game config.

* Give item:\
  `voidcases_giveitem {steam_id64} itemid amount`

🔗 [VoidCases on GmodStore](https://www.gmodstore.com/market/view/voidcases-unboxing-system)

***

### Permanent Weapons (SWEPS)

#### Option 1: Permanent SWEPS addon

`perm_sweps_add {steam_id2} swep_class1`\
🔗 [Steam Workshop](https://steamcommunity.com/sharedfiles/filedetails/?id=956066634)

#### Option 2: PermaWeapons addon

* Give: `pw_give {steam_id2} WEAPON_CLASS`
* Remove: `pw_take {steam_id2} WEAPON_CLASS`\
  🔗 [PermaWeapons on GmodStore](https://www.gmodstore.com/market/view/permaweapons-permanent-weapons-shop)

#### Option 3: Tip4Serv Database System (MySQL)

> Recommended for **subscription-based** products.

1. Install **MySQLOO**
2. Edit `garrysmod/data/tip4serv/config.json`:
   * Set `mysql_enabled` to `true`
   * Fill out all `mysql_` fields
3. Run `tip4serv connect` in your console
4. Go to [My Products](https://tip4serv.com/dashboard/my-products) and edit or create a product
5. Under your product, add a command with the option: **Run each time the player spawns**

***

### ➗ Quantity Multiplier

Allow customers to select quantity and scale your commands dynamically:

1. Enable **Allow Quantity Choice** in your product settings
2. Use `{quantity*value}` in your command:

Example:

```bash
tip4serv addmoneyid {steam_id2} {quantity*200}
```

If the customer buys it 4 times, the executed command would be:

```bash
tip4serv addmoneyid STEAM_0:1:35148628 800
```
