πLootboxes
Step by step installation guide for ESX and QB, common issues & solutions, troubleshooting guide, code snippets, changelog.
1 - Installation
1ΒΊ Import script.sql in your DB. This will add the table where the lootboxes will be registered when using or buying them.
2ΒΊ Add xex_lootbox folder to your resources folder and start it.
2 - Configuration
All the configuration can be done with the config.lua file and by manipulating the images in the images folder. The images of both boxes and items must go in the /ui/img folder.
Make sure to select your framework in the configuration file.
2.1 - Crates
All crates need the metadata filled in. You can create as many as you want, they are added in order from left to right.
name: internal name for lootbox, must be unique
label: name to be displayed to the user
img: image name with extension included
payFrom: account from which the box price will be withdrawn (bank, cash, money, black_money, vipcoin, etc)
price: item price on choosen accoun unit
2.2 - Items
Items must be added to the database or to our framework/inventory system in order for them to be delivered correctly.
There are 4 types of items, each one has its associated metadata: Weapons / Money / Items / Vehicles.
Take a look at this setup to see the required fields:
Ability to use crates as items.
To use the crates as an item, you must also add the item with the name of the box to your inventory. We attach the basic script examples for ESX with legacy inventory:
And for ox_inventory config file:
2.3 - Audio
Disable audio removing script.js line 20
2.4 - Translations
Translations are unified in the translation file, although there are some strings that are found in other files indicated below:
index.html - Line 25
script.js - Line 70 / 71 / 127 / 132 / 137 / 142
2.5 - Vehicle Rewards
QB Core
In QB-Core there is a functionality that integrates with the garage of the framework and in principle you don't have to touch anything for it to work correctly. Only if we have a personalized garage will we have to adapt the function that delivers the vehicles to that garage. Specifically in the event: xex_lootbox:RewardVehicle
ESX
Updated ESX function to be able to generate license plates. Depending on your license plate format, you may need to adapt 1 line of code, below I attach different examples:
Modify line 19 in the utils.lua file to match your license plate format:
Everything is based on using GetRandomLetter() and GetRandomNumber() with the length we want.
2.6 Webhooks
To setup your Discord hook, paste the url of your hook in the Config.Webhook variable and fill in the bot information (name, image, etc). You can also disable it.
Last updated