โ๏ธIntegration
Information about how to integrate our speaker system with your server's resources.
Introduction
We have made the script very easy to use while also keeping it very customizable.
After successfully installing the resource, you should start by completing these following steps:
1๏ธโฃ Speaker creation
Speaker menu
Players can create new speakers through the speakers menu by default.
The default command for speakers menu is /speakers.
Inventory
If you don't want the players to be able to create new speakers through the command, this resource also supports inventory based speakers.
To make this feature work, you will need to change creationMethod to inventory in editable_server/config.lua and create the speaker item in your inventory resource.
All speakers use the same item. The difference is in item metadata (image, label, description).
Add this section to ox_inventory/data/items.lua
['speaker'] = {
label = 'Speaker',
weight = 0,
description = 'Speaker.',
consume = 0,
server = {
export = 'rahe-speakers.speaker'
}
},If you didn't name the item speaker, adjust the inventoryItemId in editable_server/config.lua accordingly.
When using qb-inventory, all created speaker types are automatically added and made usable by the resource.
However, inventory images must be added manually.
Add all speaker images to qb-inventory/html/images/.
For default seeded speaker images:
Add speaker_retro.png to qb-inventory/html/images/

Add speaker_vibe.png to qb-inventory/html/images/

Add speaker_beat.png to qb-inventory/html/images/

Add speaker_blast.png to qb-inventory/html/images/

When using qs-inventory, you need to add every speaker item to the correct items file. You also have to include every speaker image in the proper directory. Default speakers are already provided for you. If you create new speaker types, you'll need to add these yourself.
1. Adding items
๐ฉWhen using QB, add this section to qb-core/shared/items.lua
๐ฉWhen using ESX, add this section to qs-inventory/shared/items.lua
2. Adding images
Add the following image file as qs-inventory/html/images/speaker_retro.png

Add the following image file as qs-inventory/html/images/speaker_vibe.png

Add the following image file as qs-inventory/html/images/speaker_beat.png

Add the following image file as qs-inventory/html/images/speaker_blast.png

Check editable_server/framework.lua for ox_inventory, qb-inventory and es_extended examples.
Use these to develop your custom solution, heres' some pointers:
๐ฉFor inventories with registerUsableItem
โ๏ธ With metadata support (images and labels):
- Create item (itemId must match inventoryItemId in editable_server/config.lua)
- Make the item usable (prepareInventory function in editable_server/framework.lua)
- Fill out metadata function (getItemDataForSpeakerType in editable_server/framework.lua) - make sure label and image keys match your inventory
- When item is used, trigger event with player source, typeId from metadata and item's slot
โ๏ธ Without metadata support:
- Create items automatically (see example for QB in editable_server/framework.lua) or manually - up to you
- Each speaker type must have its own item id matching the one assigned when creating the speaker type in-game.
- Make each item usable (prepareInventory function in editable_server/framework.lua)
- When item is used, trigger event with player source and itemId that was used
๐ฉFor inventories without registerUsableItem
โ๏ธ With metadata support (images and labels):
- Create item (itemId must match inventoryItemId in editable_server/config.lua)
- Make item usable in your inventory resource
- Fill out metadata function (getItemDataForSpeakerType in editable_server/framework.lua)
- Make sure label and image keys match your inventory
- When item is used, trigger event with player source, typeId from metadata and item's slot
โ๏ธ Without metadata support:
- Create each item manually
- Each speaker type must have its own item id matching the one assigned when creating the speaker type in-game.
- Make each item usable in your inventory resource
- When item is used, trigger event with player source and itemId that was used
Note: When a player creates a new speaker type in-game, they assign it an item ID. This same ID must be used as the item ID in your inventory system. For example, if a player creates Club Speaker speaker type with item ID club_speaker, you must create an inventory item with the same ID for this speaker type.
If you didn't name the item speaker, adjust the inventoryItemId in editable_server/config.lua accordingly.
๏ธ2๏ธโฃ Obtaining Youtube API key
A YouTube API key is required for certain features like queues and music history.
We provide two detailed tutorials on how to obtain it: one text-based and one video.
Choose whichever you prefer.
Video tutorial
Text tutorial
Register or login into Google Console Cloud
Skip to step 7 if you already have an account
Select your country and accept Terms of Service
Navigate to APIs & Services > Credentials in the left sidebar
Click Create Project, fill in details, and click Create
Once project is set up, click Create Credentials
Select API key
Copy the key and insert it into editable_server/config.lua -> youtubeApiKey
Go to Enabled APIs and Services in the left sidebar
Click Enable APIs and Services at the top
Search for YouTube Data API v3 and select it
Click Enable
All done! The script will now use youtube API to fetch music related data!
Last updated