> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-daily-rewards/cas-daily-rewards.md).

# CAS Daily Rewards

A polished daily login reward system for **RedM**, built for both **VORP** and **RSG** frameworks. Players claim a reward every day, build streaks for bonus multipliers, and unlock upgraded VIP rewards — all from a clean in-game menu.

## Highlights

* **Daily reward cycles** — per-day money, gold, items and weapons.
* **Streak bonuses** — reward multipliers at the milestones you define (7, 14, 30…).
* **VIP tiers** — VIP players receive upgraded rewards, redeemable through generated VIP codes.
* **Missed-day recovery** — players buy back a missed day for cash or gold, up to a configurable cap.
* **Discord webhook logging** — claims, recoveries, VIP redemptions, admin actions and errors.
* **Full localization** — every UI string and notification is configurable.

## At a glance

|               |                                                                         |
| ------------- | ----------------------------------------------------------------------- |
| Frameworks    | VORP · RSG                                                              |
| Dependencies  | `oxmysql`, `vorp_core` / `rsg-core`, `vorp_inventory` / `rsg-inventory` |
| Database      | Yes — `sql/database.sql`                                                |
| Resource name | `cas-dailyrewards`                                                      |

## Requirements

* A supported framework: **VORP** (`vorp_core`) or **RSG** (`rsg-core`)
* `oxmysql`
* `vorp_inventory` / `rsg-inventory` for item rewards

## Installation

1. **Extract** the `cas-dailyrewards` folder into your `resources` directory.
2. **Import the database** — run `sql/database.sql` against your server database.
3. **Add to `server.cfg`** — `ensure cas-dailyrewards`, after your framework and inventory.
4. **Configure** — open `config.lua` and set your framework, rewards and options (below).

{% hint style="info" %}
Start `cas-dailyrewards` **after** `vorp_core` / `rsg-core` and your inventory so the framework and item rewards resolve correctly.
{% endhint %}

## Configuration

Everything is configured in `config.lua`.

### Framework

```lua
Config.Framework = 'vorp'  -- 'vorp' or 'rsg'
```

### Commands

```lua
Config.Commands = {
    dailyDetails  = { command = 'dailyreward',   description = 'Open daily rewards menu' },
    setVip        = { command = 'setvip',        description = 'Set VIP status for a player (Admin Only)', group = 'admin' },
    resetDaily    = { command = 'resetdaily',    description = 'Reset daily rewards for a player (Admin Only)', group = 'admin' },
    createVipCode = { command = 'createvipcode', description = 'Create a VIP code (Admin Only)', group = 'admin' }
}
```

### Discord webhook

```lua
Config.Discord = {
    enabled = true,
    webhook = "YOUR_WEBHOOK_URL",
    botName = "Daily Rewards Bot",
    logEvents = {
        claim = true, recover = true, vipRedeem = true, adminActions = true, errors = true
    }
}
```

### Missed-day recovery

```lua
Config.MissedDayRecovery = {
    enabled = true,
    cost = 50.0,             -- price to recover a missed day
    currencyType = 0,        -- 0 = money, 1 = gold
    maxRecoverableDays = 3
}
```

### Streak bonuses

```lua
Config.StreakBonuses = {
    [7] = {
        multiplier = 1.5,
        label = '7-Day Streak',
        rewards = { { type = 'money', amount = 200 }, { type = 'gold', amount = 5 } }
    },
    -- add more milestones: [14], [21], [30], ...
}
```

### VIP system

```lua
Config.Vip = {
    purchaseLink = 'https://your-store.com/vip',
    defaultDays = 30
}
```

### Daily rewards

```lua
Config.Rewards = {
    [1] = {
        day = 1, name = 'Day 1', description = 'Start your journey!',
        image = 'day1.png', rarity = 'common',            -- common, rare, epic, legendary
        rewards    = { { type = 'money', amount = 25 } },
        vipRewards = { { type = 'money', amount = 50 } }   -- VIP players receive these instead
    },
    -- continue for days 2-7 (or more)
}
```

**Reward types**

| Type   | Example                                                        |
| ------ | -------------------------------------------------------------- |
| money  | `{ type = 'money', amount = 100 }`                             |
| gold   | `{ type = 'gold', amount = 5 }`                                |
| item   | `{ type = 'item', item = 'consumable_breakfast', amount = 3 }` |
| weapon | `{ type = 'weapon', weapon = 'WEAPON_REVOLVER_CATTLEMAN' }`    |

### Localization

Every UI string and notification lives in `Config.Locale` and `Config.Notifications` — labels, the VIP section, streak info, reward types, popups and messages can all be translated.

## VIP via Tebex

Grant VIP automatically from a purchase using [Tebex command management](https://docs.tebex.io/creators/command-management/an-introduction-to-commands) — wire a Tebex command to the VIP flow so buyers are rewarded instantly.

## Support

Need a hand? Join the [CAS Discord](https://discord.gg/X8bTK9Stwk) or use the support channel on your product page.
