# Custom Rewards

> 

## Overview

Coinsystem can send custom shop rewards to `Functions.GiveCustomReward` inside `sky_base/config/sv_functions.lua`.
Use this hook for rewards that are not handled by the default item, money, weapon, coin, or vehicle integrations.

---

## Reward Structure

Every custom reward uses the same reward table structure:

```lua
{
    label = "Pet Dog",
    sort = "pet",
    name = "dog",
    amount = 1,
    img = "dog.png"
}
```

<table>
<thead>
  <tr>
    <th>
      Key
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      Display name shown to the player.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        sort
      </code>
    </td>
    
    <td>
      Custom reward type. Use this value in <code>
        GiveCustomReward
      </code>
      
       to decide what should happen.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      Internal reward name, item name, vehicle model, pet id, or any identifier your integration needs.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        amount
      </code>
    </td>
    
    <td>
      Amount to give.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        img
      </code>
    </td>
    
    <td>
      Image used in the UI or configurator.
    </td>
  </tr>
</tbody>
</table>

---

## Server Hook

Add your custom delivery logic in `sky_base/config/sv_functions.lua`:

```lua [sky_base/config/sv_functions.lua]
function Functions.GiveCustomReward(source, reward)
    if reward.sort == "pet" then
        exports["some_petscript"]:GivePet(source, reward.name, reward.amount)
        return
    end

    if reward.sort == "license" then
        exports["some_license_script"]:AddLicense(source, reward.name)
        return
    end
end
```

<tip>

Keep custom reward logic server-side. The `source` argument is the player receiving the reward.

</tip>

---

## Config Example

Create a reward in the Coinsystem config or configurator with the same `sort` value:

```lua
{
    label = "Police Dog",
    sort = "pet",
    name = "police_dog",
    amount = 1,
    img = "police_dog.png"
}
```

<warning>

The `sort` value in the reward config must match the value you check in `Functions.GiveCustomReward`.

</warning>
