RAHE Development
  • Welcome
  • General information
  • Common questions
  • OUR SCRIPTS
    • đŸŽī¸Racing
      • đŸ–Ĩī¸Installation
      • âš™ī¸Integration
      • â‰ī¸Common issues
      • ❔Common questions
      • â„šī¸Race types explained
    • 🚙Drifting
      • đŸ–Ĩī¸Installation
      • âš™ī¸Integration
    • 🚔Boosting
      • đŸ’ģInstallation
      • âš™ī¸Integration
      • ❔Common questions
      • â‰ī¸Common issues
    • đŸ“ģSpeakers
      • đŸ–Ĩī¸Installation
      • âš™ī¸Integration
      • ❔Common questions
    • đŸ’ģTablet
      • đŸ–Ĩī¸Installation
      • âš™ī¸Integration
Powered by GitBook
On this page
  • Introduction
  • 1ī¸âƒŖ Speaker creation
  • ī¸2ī¸âƒŖ Obtaining Youtube API key
  1. OUR SCRIPTS
  2. Speakers

Integration

Information about how to integrate our speaker system with your server's resources.

PreviousInstallationNextCommon questions

Last updated 8 months ago

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

  1. Speaker menu

Players can create new speakers through the speakers menu by default.

The default command for speakers menu is /speakers.

  1. 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

['speaker_retro'] = {
    name = 'speaker_retro',
    label = 'Speaker Retro',
    weight = 1000,
    type = 'item',
    image = 'speaker_retro.png',
    unique = true,
    useable = true,
    shouldClose = true,
    description = 'Low volume, range and quality.',
},
['speaker_vibe'] = {
    name = 'speaker_vibe',
    label = 'Speaker Vibe',
    weight = 1000,
    type = 'item',
    image = 'speaker_vibe.png',
    unique = true,
    useable = true,
    shouldClose = true,
    description = 'Good volume, range and quality.',
},
['speaker_beat'] = {
    name = 'speaker_beat',
    label = 'Speaker Beat',
    weight = 1000,
    type = 'item',
    image = 'speaker_beat.png',
    unique = true,
    useable = true,
    shouldClose = true,
    description = 'Great volume, range, quality and bass.',
},
['speaker_blast'] = {
    name = 'speaker_blast',
    label = 'Speaker Blast',
    weight = 1000,
    type = 'item',
    image = 'speaker_blast.png',
    unique = true,
    useable = true,
    shouldClose = true,
    description = 'Epic volume, range, quality, bass and filters.',
},

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

TriggerEvent('rahe-speakers:server:speakerItemUsed', source, item.metadata.typeId, item.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

TriggerEvent('rahe-speakers:server:itemUsedById', source, itemId)

🚩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

TriggerEvent('rahe-speakers:server:speakerItemUsed', source, item.metadata.typeId, item.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

TriggerEvent('rahe-speakers:server:itemUsedById', source, itemId)

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.

  1. Video tutorial

  1. Text tutorial

  1. Skip to step 7 if you already have an account

  2. Select your country and accept Terms of Service

  3. Navigate to APIs & Services > Credentials in the left sidebar

  4. Click Create Project, fill in details, and click Create

  5. Once project is set up, click Create Credentials

  6. Select API key

  7. Copy the key and insert it into editable_server/config.lua -> youtubeApiKey

  8. Go to Enabled APIs and Services in the left sidebar

  9. Click Enable APIs and Services at the top

  10. Search for YouTube Data API v3 and select it

  11. Click Enable

All done! The script will now use youtube API to fetch music related data!

Register or login into

đŸ“ģ
âš™ī¸
Google Console Cloud
speaker_retro.png
speaker_vibe.png
speaker_beat.png
speaker_blast.png