Installation

Downloading The Resource

Follow the steps below to gain access to the resources files

1

Log Into the CFX Portal

First, log in to the official CFX portal

2

Finding The Resource

After logging in, go to the Granted Assets section to view your purchased assets. Find Midnight Neon Controller, and simply click the download button.


Adding The Resource To Your Server

Follow the steps below to implement the resource onto your server

1

Placing The Resource

Unzip the md-neoncontroller.zip folder and place the extracted folder into your servers resources folder

2

Ensuring The Resource

Open your servers server.cfg file and write ensure md-neoncontrolleranywhere after your framework is ensured (unless the resource is placed in an already ensured folder)


Neon Controller Item Setup

This resource includes an item that server owners can optionally include into their server. If included, players must have this item in their inventory to be able to use the neon controller menu - follow the steps in INCLUDE ITEM. Otherwise, players can open the menu in any vehicle they want, at any time, with no item required - follow the steps in DON'T INCLUDE ITEM

Note: Its fully up to the server owner on how they would like to allow players to access the item (e.g. through certain shops)

INCLUDE ITEM

1

Config

Set Config.RequiresItem as true. Follow the steps below to set up the item according to your framework

shared/config.lua
-- Whether the neon controller item is required to open the neon controller menu in a vehicle
Config.FuelScript = 'true'    
2

Adding Item

Follow the steps to add the item, depending on your inventory script/framework. This script includes direct support for qb-inventory, ox_inventory and qs-inventory, however any inventory script can be used with some additional configuration.

QB-INVENTORY

Set Config

shared/config.lua
-- The inventory script to check if the player has the neon controller item. Not required if the config above is set to false
Config.InventoryScript = 'qb-inventory'

Adding the Item

  • Navigate to the qb-core resource directory and open up qb-core/shared/items.lua

  • Paste the following lines into the file and save it

  • ['neon_controller_device'] = { 
        name = 'neon_controller_device', 
        label = 'Coffee', 
        weight = 500, 
        type = 'item', 
        image = 'neon_controller_device.png', 
        unique = true, 
        useable = false, 
        shouldClose = false, 
        description = 'Unlocks advanced vehicle lighting control and animated effects for neon lights' 
    }

Adding the Image

  • Navigate to the qb-inventoryresource directory and find the qb-inventory/html/images folder

  • Add the image ('neon_controller_device.png') into the folder

Restart Your Server

OX_INVENTORY

Set Config

shared/config.lua
-- The inventory script to check if the player has the neon controller item. Not required if the config above is set to false
Config.InventoryScript = 'qb-inventory'

Adding the Item

  • Navigate to the ox-inventory resource directory and open upox-inventory/data/items.lua

  • Paste the following lines into the table defined in the return statement and save the file

    ['neon_controller_device'] = {
        label = 'Neon Controller Device',
        weight = 500,
        stack = false,
        description = 'Unlocks advanced vehicle lighting control and animated effects for neon lights'
    },

Adding the Image

  • Navigate to the ox-inventory/web/images folder

  • Add the image ('neon_controller_device.png') into the folder

Restart Your Server

QS_INVENTORY

Set Config

shared/config
-- The inventory script to check if the player has the neon controller item. Not required if the config above is set to false
Config.InventoryScript = 'qs-inventory'

Adding the Item

  • If using qb-core, navigate to the qb-core resource directory and open upqb-core/shared/items.lua.

  • If using esx, navigate to the qs-inventoryresource directory and open upqs-inventory/shared/items.lua.

  • Paste the following lines into the file and save it

     ['neon_controller_device'] = {
        name = 'neon_controller_device',
        label = 'Neon Controller Deice',
        weight = 500,
        type = 'item',
        image = 'neon_controller_device.png',
        unique = true,
        useable = false,
        shouldClose = false, 
        description = 'Unlocks advanced vehicle lighting control and animated effects for neon lights'
    }

Adding the Image

  • Navigate to the qs-inventory/html/images folder

  • Add the image ('neon_controller_device.png') into the folder

Restart Your Server

ANY OTHER INVENTORY

Set Config

shared/config.lua
-- The inventory script to check if the player has the neon controller item. Not required if the config above is set to false
Config.InventoryScript = 'other'

Add Custom Fuel Reading Code

  • Open up the shared functions file found in shared/functions.lua

  • Edit the last elseif statement in the givenGetFuelLevel function.

    • The vehicle being checked is provided as a paramater (veh).

    • shared/functions.lua
      
      
      function checkForNeonControllerItem(player)
          local hasItem
      
          -- qb inventory
          if Config.InventoryScript == 'qb-inventory' then
              hasItem = exports['qb-inventory']:HasItem(item, amount)
      
          -- ox_inventory
          elseif Config.InventoryScript == 'ox_inventory' then
              hasItem = exports.ox_inventory:GetItemCount('neon_controller_device', {}, false) > 0
          -- qs-inventory        
          elseif Config.InventoryScript == 'qs-inventory' then
              hasItem = exports['qs-inventory']:Search('neon_controller_device') > 0
      
          -- any other inventory   
          elseif Config.InventoryScript == ' other' then
              -- If you are using any other inventory script, just add the code that checks if the player has a 'neon_controller_device' item
              -- Set the boolean result equal to hasItem
          end
      
          return hasItem
      end
    • Utilize exports or any means from your inventory script to check if the player has a 'neon_controller_device' item, and set it equal to the hasItem variable

3

Notification

Set Config.RequiresItem as true. Follow the steps below to set up according to your framework

shared/config.lua
-- Whether the neon controller item is required to open the neon controller menu in a vehicle
Config.FuelScript = 'true'    
QB CORE

Set Config

shared/config.lua
-- The notification script used to inform the player if they do not have the neon controller item
Config.NotifyScript = 'qb-notify'
ESX_NOTIFY

Set Config

shared/config.lua
-- The notification script used to inform the player if they do not have the neon controller item
Config.NotifyScript = 'esx_notify'
OKOKNOTIFY

Set Config

shared/config.lua
-- The notification script used to inform the player if they do not have the neon controller item
Config.NotifyScript = 'okokNotify'
MYTHIC_NOTIFY

Set Config

shared/config.lua
-- The notification script used to inform the player if they do not have the neon controller item
Config.NotifyScript = 'mythic_notify'
ANY OTHER NOTIFY

Set Config

shared/config.lua
-- The notification script used to inform the player if they do not have the neon controller item
Config.NotifyScript = 'other'

Add Custom Fuel Reading Code

  • Open up the shared functions file found in shared/functions.lua

  • Edit the last elseif statement in the notifyUnableToOpenNeonController function.

    • shared/functions.lua
      function notifyUnableToOpenNeonController()
          -- qb-core
          if Config.NotifyScript == 'qb-notify' then
              local QBCore = exports['qb-core']:GetCoreObject()
              QBCore.Functions.Notify('You do not have a neon controller device!', 'error', 5000)
      
          -- esx-notify        
          elseif Config.NotifyScript == 'esx_notify' then
              exports['esx_notify']:Notify('error', 5000, 'You do not have a neon controller device!') 
      
          -- okokNotify
          elseif Config.NotifyScript == 'okokNotify' then
              exports['okokNotify']:Alert(nil, 'You do not have a neon controller device!', 5000, 'error', true)
      
          -- mythic_notify    
          elseif Config.NotifyScript == 'mythic_notify' then
              exports['mythic_notify']:DoLongHudText('error', 'You do not have a neon controller device!')
      
          -- any other inventory   
          elseif Config.NotifyScript == 'other' then
              -- If you are using any other notify script, just add the code here at notifies the player, using the message above
          end
              
      end
    • Utilize exports or any means from your notify script to notify the player that they do not have a neon controller item

DONT INCLUDE ITEM

1

Config

Set Config.RequiresItem as false. The rest of the configs can be left as is

shared/config.lua
-- Whether the neon controller item is required to open the neon controller menu in a vehicle
Config.RequiresItem = false

Database Setup

1

Installing oxmysql

This resource uses oxmysql for all database interactions. To install, follow the instructions listed at https://overextended.dev/oxmysql.

2

Initializing The Table

Execute the following SQL code found in database.sql , using your database software.

CREATE TABLE IF NOT EXISTS neon_controller_data (
    identifier VARCHAR(255) PRIMARY KEY,
    customEffects TEXT,
    specialColours TEXT,
    vehicleData TEXT,
    lastY FLOAT,
    lastX FLOAT,
    wasCompactView TINYINT(1)
);

Enabling Onesync

Follow this Guide by Quasar to enable onesync on your server. This is required to ensure proper synchronisation of underglow/headlights between playhers.


Configuring Your Resource

Read the pages in Configuration to configure the script as needed.

Last updated