VIP Shop

Step-by-step installation guide, common issues & solutions, code snippets, error codes, config previews, locales previews, SQL previews, and changelogs; all in 1 easily accessible place.

Buy Here

FiveM Forums Post

YouTube Showcase Video

Translate

INSTALLATION GUIDE

Step 0 - First Steps

1. Download your resource from FiveM’s Keymaster.

2. Unzip the cd_vipshop.zip folder and place this folder in your server's resource folder.

3. Add the resource to your server start config (server.cfg): ensure cd_vipshop. If you are using a framework, it must be placed anywhere below your framework resource e.g., es_extended, not above.

ensure es_extended
ensure cd_vipshop

Step 0 - For existing customers

ALL EXISTING CUSTOMERS WHO WERE USING PREVIOUS VERSIONS ON ESX MUST FOLLOW THE 2 STEPS BELOW:

  • In the cd_vipshop database table replace the char1: with license: or steam: depending on what your Config.IdentifierType is set to in the config.lua.

Step 1 - Fxmanifest

Depending on your framework and dependencies, you may need to make some changes inside the [cd_vipshop/fxmanifest.lua]. We have made this easier by commenting on the lines you possibly need to change.

Step 2 - Configure Resource

You MUST read all configurable options inside the [cd_vipshop/configs/config.lua] file and configure them to suit your server's needs. Please read the ”commented out help text” at the end of each line so you can understand what each config option does.

The most important sections are the options under the Framework and Important sections at the top of the config.lua. Everything else is optional.

Step 3 - SQL Database

Insert Automatically?

If you set Config.AutoInsertSQL in the [cd_vipshop/configs/config.lua] to true, the resource will automatically insert the SQL for you. You can set this to false after the SQL has been inserted successfully.

Insert Manually?

Alternatively, if you want to insert the SQL queries manually, you can find them here.

Step 4 - Install Dependencies

Where can I find these dependencies?

Open the [cd_vipshop/dependencies] folder. The folders inside are the required dependencies. You will find a text file inside each folder that includes a GitHub download link. Alternatively, they are listed in the table below.

Where should I put these dependencies?

These resources should be placed in your resources folder like any other, but remember, you shouldn't put them in the cd_vipshop folder.

Do I need to add them to the server start config?

No, it will start automatically because it is listed as a dependency for this resource.

Resource NameDownloadDetails

cd_drawtextui

REQUIRED by default but can be replaced.

Step 5 - Create a Game Server

Create your game server on your Tebex Webstore to generate your secret key. Watch this Video Guide if you have not done this before.

Below is some important information from the Video guide above.

sv_tebexSecret CHANGE_ME

Step 6 - Create a Product

Create a product on your Tebex Webstore and use the command we have provided below. Watch this Video Guide if you have not done this before.

Below is the command we speak about in the video.

tebex_purchase {"transaction_id":"{transaction}", "package":"{packageName}", "date":"{time} {date}", "buyer_name":"{purchaserName}", "buyer_email":"{email}"}

Subscriptions: To allow compatibility with monthly subscriptions, read here - #Subscriptions.

Step 7 - Config.TebexListings

The name of the product on your tebex webstore MUST be exactly the same as the ProductName inside the Config.TebexListings table in the configs/config.lua. The amount is the number of coins a player will receive when they purchase this product.

Step 8 - Customise The UI

You can add or remove products in the Config.Shop config table in the configs/config.lua. There are commented-out examples at the bottom of the config.lua that will explain everything you need to know to create custom products that your server can sell in-game. You can also remove or add more products on the in-game shop UI.

If you are using QBCore and wish to sell "character name changes" or "phone number changes" in your shop UI, you must add this code snippet below into qb-core/server/player.lua.

RegisterServerEvent('cd_vipshop:UpdateCharInfo')
AddEventHandler('cd_vipshop:UpdateCharInfo', function(source, action, data)
	if action == 'charname' then
		QBCore.Players[source].PlayerData.charinfo.firstname = data.firstname
		QBCore.Players[source].PlayerData.charinfo.lastname = data.lastname
	elseif action == 'phone' then
		QBCore.Players[source].PlayerData.charinfo.phone = data.phone
	end
	QBCore.Player.Save(source)
	QBCore.Players[source].Functions.UpdatePlayerData()
end)

Step 9 - Redeem a Purchase

When a player has purchased a product from your tebex webstore, tebex will trigger a chat command on your server within 2-10 minutes to log the purchase information to your database. After this is done, the player can do the following chat command in-game - /redeem (tebex_transaction_id_here) , which will then save the player's donator coins to the database, and they will be available to spend.

OPTIONAL FEATURES

This section is to help you understand how the built-in features of this resource work and, if applicable, how you can make them compatible with other resources. These features are not required. They are optional and can be configured in the [configs/config.lua].

Subscriptions

To allow compatibility with reoccurring/monthly subscriptions, repeat the final part of #Step 6 where you add a command, but on the 2nd command, change when the command is sent - as seen in this screenshot. This will automatically add the same amount of donator tokens to a player when their subscription renews.

Vehicle Stock

How does vehicle stock work?

This allows you to limit each vehicle that can be sold through the VIP shop. The vehicle stock is saved in the database and can be changed anytime. Only the vehicles you add to the database will have limited stock. If a vehicle is not in the vehicle stock database, it can be sold unlimited times.

How do I use this vehicle stock feature?

  1. Make sure Config.VehicleStock is enabled in the [configs/config.lua].

  2. Go to your server's database and find the [cd_vipshop_vehiclestock] database table - EXAMPLE.

  3. Vehicle stock can only be changed in the database. You must add the vehicle spawn model and the vehicle stock amount to the database. Here is a VIDEO EXAMPLE.

zdiscord Integration

Add the 3 files in the download below into your zdiscord/server/commands folder. Then you can use the bot commands below in your discord. This is currently QBCore only unless you modify the code.

/pointlist [cid]

/pointadd [cid] [points_to_add]

/pointremove [cid] [points_to_remove]

INFORMATION

Chat Commands

These chat commands can be renamed and/or disabled in the Keys and Commands section of the [configs/config.lua].

The exact usage for each command will be displayed in the chat suggestions when using the commands in-game.

Command

Example

Description

/redeem

/redeem tbx-8832421a77453-etd002

The command to redeem donator coins after their purchase.

/add_balance

/add_balance 1 10

(Staff Command) The example command will add 10 donator coins to id 1.

/remove_balance

/remove_balance 2 20

(Staff Command) The example command will remove 20 donator tokens from id 2.

Exports

These exports are completely optional; you can use them if needed.

Get Balance

Returns a players balance (numberm).
exports['cd_vipshop']:GetBalance(source)

Add Balance

Adds tokens to a player.
exports['cd_vipshop']:AddBalance(source, amount)

Remove Balance

Removes tokens from a player.
exports['cd_vipshop']:RemoveBalance(source, amount)

Can Purchase Check

Checks if a player can afford to make a purchase.
exports['cd_vipshop']:CanPurchaseCheck(source, cost)

COMMON ISSUES

Please check out our Troubleshooting Guide before contacting our support.

🔔 Folder Name Make sure the name of the folder is cd_donatorshop.

Can’t Redeem a Purchase?

eg., if a player has made a purchase on your tebex store and the purchase is still not able to be redeemed in game after 10 minutes.

✔️ Assuming you have followed the steps above correctly; if tebex is not sending the purchase data to your server the problem might be that your sv_tebexSecret key is active on one of your test/dev/local host servers and therefore tebex is sending the data to the wrong server instead, so remove this sv_tebexSecret key from your other servers. Or the issue may simply be that tebex is having issues on their side.

SQL Unknown Column?

eg., if you see an SQL error in the server console similar to this example - ER_BAD_FIELD_ERROR: Unknown colum 'job_personalspawn' in 'where clause'.

✔️ You are missing one of the required database columns. The SQL file can be found in the "READ_ME_AFTER_PURCHASING" folder.

Tebex Secret Key?

eg., if you see this authentication error In your server console [cd_donatorshop] - Unable To Start (sv_tebexSecret is nil).

✔️ This means [] has not been completed correctly.

Redeemed 0 Balance?

eg., if a player redeems a purchase and it say they redeemed 0 balance in the notification when it should clearly be a higher number.

✔️ This can only happen if the Product Name on your tebex store does not match with the ProductName in the Config.TebexListings. They must match exactly - caps lock, spaces and punctuation marks.

Not All Display Vehicles Spawned?

eg., if some of the display vehicles just stopped spawning and the vehicle UI isnt visible.

✔️ This happens because the [Model] for one of the vehicles you added to the Config.Vehicle table in the [configs/config.lua] file was the wrong spawn name. An easy way to identify the problem vehicle is to look for the last vehicle that spawned successfully and it will be the next vehicle in the list.

ERROR CODES

If you see an error code not listed below, please open a script support ticket in the Codesign Discord.

0886 - The GetIdentifier function in the configs/server_customise_me.lua is returning a nil value instead of a string containing the player's identifier.

4454 - This means a player is trying to use the "tebex_purchase". This command is only supposed to be triggered from the server-side by tebex when a player makes a purchase on your tebex store.

7742 - This could mean you are triggering the "tebex_purchase" from the server console, which you shouldn't be. This command is only supposed to be triggered from the server-side by tebex when a player makes a purchase on your tebex store. The other reason is that tebex is not sending the correct data due to Step 2 - Configure Resource not being completed correctly.

0811 - This means the number of display vehicles you have configured to be on display in Config.DisplayVehicles.RandomizeVehicles.display_vehicle_count, is higher than the number of possible vehicle locations in Config.DisplayVehicles.VehicleCoords['manually_set'].

0822 - This means the number of display vehicles you have configured to be on display in Config.DisplayVehicles.Vehicles, is higher than the number of possible vehicle locations in Config.DisplayVehicles.VehicleCoords['manually_set'].

CHANGELOG

Files Changed

Not every update requires you to replace the whole folder. We do this because we understand it's a pain to redo the configs for every update.

  • All Files - This means you should delete your old cd_vipshop folder, download and add in the latest version, reconfigure the configs folder and restart your server.

  • All Files Except config.lua - This means you should do all of the above (in the All Files section) but additionally make a backup of the config.lua file and replace the new config.lua file with the one you made a backup of.

  • Specific Files - This means you can copy and paste the SPECIFIC new files over the old ones and restart the server.

Update Type

On rare occasions, you are forced to update to the latest version. Mostly due to authentication updates where the old versions will no longer work.

  • Mandatory - This means you MUST update to this new version, or the old versions will no longer work.

  • Optional - This means it's completely your choice whether you wish to update to the latest version. But we do not offer support for old versions for obvious reasons; they are old.

Skipping Updates

If you are attempting to update to the latest version but have skipped previous updates, you should update all files just to be safe. For example., let's say you are currently on v4.0.1, you did not update when v4.0.2 was released, and now v4.0.3 is released, and you want to update; you should always use the “All Files” update method.

17/03/2021 - 08/11/1021

v1.0.0 - v1.0.5

Files Changed:

Update Type:

Changelog:

STATUS

  • Development Stage: COMPLETE

  • Alpha Test Stage: COMPLETE

  • Beta Test Stage: COMPLETE

Add

  • Added ability to blacklist words in the plate change.

  • Added locales for the identifiers UI.

  • Added a server print to notify server owners when a purchase has been made.

  • Added a new shop product - Character Name Changes. There are several checks put in place to make sure players enter a first and last name and it also checks for blacklisted words.

  • Added a new shop product - Vehicle packs. Meaning full vehicle packs can be configured and sold through the main shop UI. Also added extra protection against lua injectors with discord webhooks.

  • Added a computer desk at the location of the donator shop UI to mark its location.

  • Added the ability to manually place each donator vehicles coords instead of the script automatically generating the coords. This is a config option so it can be toggled.

  • Added the ability to set a maximum allowed character slot limit in the config when using the Codesign Multicharacter script.

  • Added discord logs to the staff add/remove token command.

Edit

  • Notifications on the UI now stack.

  • Success notifications on the UI now display more info after a purchase has been made successfully.

Fix

  • Fixed vehicle plate change bug when not using cd_garage.

  • Fixed notification typo on the staff add/remove balance command.

  • Fixed esx perms check typo.

  • Fixed random linux crashing bug.

  • Fixed the purchase command so players cant use it.

  • Fixed missing locale for the item rewards on the UI notification.

  • Fixed the total cost when purchasing multiple character slots.

  • Fixed a random bug where you would see an visual error when exiting the donator shop referring to "VehicleTable".

  • Fixed various typos in the locales.lua.

  • Fixed bug where you could purchase a product with 0 quantity chosen and you would see the "NaN" error.

  • Fixed a typo in the previous version causing the 7784 error code.

  • Fixed the date not saving in the cd_donatorshp_logs database table.

  • Temporary fix for the canary issue until the new Tebex FiveM license system is ready to launch, when this is released we will be fully switching over to the new system.

Last updated

Logo

Codesign Software © All rights reserved