> For the complete documentation index, see [llms.txt](https://docs.justscripts.net/scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.justscripts.net/scripts/justcases/exports.md).

# Exports

This is a simple guide for how to use the JustCases exports for your custom actions

All of these exports are server-side exports and are usable only by server-side scripts

## AddCoin

You can add gold coins or silver coins directly from your other scripts as rewards for player

```lua
-- player: string|number - the online player server id
-- type: string - the coins type, can be gold or silver
-- amount: number - the amount of granting coins
exports.JustCases:AddCoin(player, type, amount)

-- Example
exports.JustCases:AddCoin(1, "gold", 99999999999)
```

## RemoveCoin

You can remove certain amount of coins from players

```lua
-- player: string|number - the online player server id
-- type: string - the coins type, can be gold or silver
-- amount: number - the amount of granting coins
exports.JustCases:RemoveCoin(player, type, amount)

-- Example
exports.JustCases:RemoveCoin(1, "gold", 99999999999)
```

## SetCoin

You can set the player coins to a specific amount (like resetting player coins on player death)

```lua
-- player: string|number - the online player server id
-- type: string - the coins type, can be gold or silver
-- amount: number - the amount of granting coins
exports.JustCases:SetCoin(player, type, amount)

-- Example
exports.JustCases:SetCoin(1, "silver", 0)
```

## AddCase

Add case to player inventories

```lua
-- player: string|number - the online player server id
-- case: string - the case id defined in Config.Cases
-- amount: number - the amount of granting cases
exports.JustCases:AddCase(player, case, amount)

-- Example
exports.JustCases:AddCase(1, "money_1", 1)
```

## CreateVoucher

You can create custom vouchers for players to redeem coins

```lua
-- code: string - Voucher code, this code must be unique otherwise 
-- the first founded code will be used for player 
-- type: string - the coins type, can be gold or silver
-- amount: number - the amount of granting coins
exports.JustCases:CreateVoucher(code, type, amount)

-- Example
exports.JustCases:CreateVoucher("xxx-yyy-zzz", "silver", 0)
```
