For the complete documentation index, see llms.txt. This page is also available as Markdown.

💎Custom Currency in Pet Shop

💎Custom Currency in Pet Shop

📋 Overview

The Custom Currency system lets you define shop items that are paid only with a currency of your choice (e.g. crypto from Qbox, or your own VIP/points). When an item uses customCurrency, the player pays only that currency—no cash is charged. The pet shop (NPC shop / Tab Shop) displays the custom currency balance in the header next to cash, with a diamond icon (or your own icon), and shows “Buy [Currency Name]” on the button.

Perfect for:

  • 💎 VIP-only or premium items paid with a custom currency

  • 🪙 Crypto or other in-game currencies

  • 💰 Have profit on your server using our pet system.


✨ Key Features

Feature

📁 Custom currency per item

Description

In shop.lua, set customCurrency = { crypto = 50 } (or your key). Item is paid only with that currency.

Feature

💰 Header balance

Description

When the shop has custom-currency items, the header shows cash + custom currency balance (with icon).

Feature

📝 Single language key

Description

The name shown (e.g. “Crypto”, “VIP Coins”) comes from vip_coins in data/languages—one key for all.

Feature

🔧 Optional custom icon

Description

Use default diamond SVG or your own image via Shop.CustomCurrencyIcon in config.

Feature

🔃 Balance refresh after purchase

Description

After a successful purchase, the shop reopens with updated cash and custom currency balance.


🔧 How Setup Custom Currency & Preview


1. Open the file api.lua located at: cdev_lib > public > server > api.lua

2. Inside this file, we will modify the three functions shown below.

3. Now open the file config.lua located at: cdev_pets > public > config > config.lua

We will add a pet-type product to be sold using a custom currency. Locate the product you want to edit.

Note: In this example, I am using the crypto currency available in QBCore/QBox.

4. (Optional) Change the Custom Currency name

⚠️ Attention: I will use the en.lua file as an example, but you can use any file inside cdev_pets/data/languages. After opening it, simply search for the variable named vip_coins.


If you want to change the diamond icon in the Shop header, simply access the configuration file at:

cdev_pets > public > config > config.lua (Line 461)


❓ Frequently Asked Questions

Q1: Can an item use both cash and custom currency?

No. With the current design, if an item has `customCurrency`, it is paid **only** with that currency. Set `price = 0` so the item is clearly “custom currency only.” If you set both `price` and `customCurrency`, only the custom currency is charged; the cash price is ignored.

Q2: Where does the custom currency balance appear?

Only in the **NPC Pet Shop** (the one opened from the ped). The header shows cash and, when the shop has at least one custom-currency item, the custom currency balance with the diamond (or custom) icon. Player-owned pet shops do not show or use this.

Q3: How do I change the name “VIP Coins” (or “Crypto”) that the player sees?

Edit the **`vip_coins`** key in your language files under `cdev_pets/data/languages/` (e.g. `en.lua`, `pt.lua`). One key is used for the display name everywhere (button, price, header). You do not need a separate language key per currency type.

Q4: I use Qbox; how do I use “crypto” from players.money?

Ensure your framework exposes `money.crypto` (e.g. in `PlayerData.money.crypto` when the player is loaded). cdev_lib’s default implementation for QBCore/Qbox reads and writes `PlayerData.money[currencyType]`, so `customCurrency = { crypto = 50 }` in `shop.lua` will use that. Set `vip_coins` in languages to the label you want (e.g. “Crypto”).

Q5: Can I use my own icon instead of the diamond?

Yes. In `public/config/config.lua`, under `Shop`, set `CustomCurrencyIcon` to your image URL (e.g. `"nui://cdev_pets/html/icons/vip.png"`). If empty, the default diamond SVG is used.

Q6: Does the balance update after I buy an item?

Yes. After a successful purchase, the shop reopens and both cash and custom currency balances are refreshed before the shop is shown again.

Last updated