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-VehicleMenu, 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_carcontrol.zip folder and place the extracted folder into your servers resources folder (or any sub folder)

2

Ensuring The Resource

Open your servers server.cfg file and write ensure md-carcontrol anywhere after your framework is ensured (or make sure the resource is in an ensured folder)


Integrating Your Servers Fuel Script

The vehicle control UI displays the amount of fuel a vehicle has. Follow the steps below to integrate your servers fuel script, depending on which one you have (if any). This script includes direct support for using no fuel script (standalone), cdn-fuel and legacy-fuel - however any fuel script can be added with some additional configuration.

NO FUEL SCRIPT

Set Config

shared/client-functions.lua
-- The fuel script used to display the vehicles fuel on the UI.
-- Supported: cdn-fuel, legacy-fuel, ox_fuel, nil.  Check documentation to learn how to include any other script
Config.FuelScript = nil
OX_FUEL

Set Config

shared/client-functions.lua
-- The fuel script used to display the vehicles fuel on the UI.
-- Supported: cdn-fuel, legacy-fuel, ox_fuel, nil.  Check documentation to learn how to include any other script
Config.FuelScript = 'ox_fuel'
CDN-FUEL

Set Config

shared/config.lua
Config.FuelScript = 'cdn-fuel'
LEGACY-FUEL

Set Config

shared/client-functions.lua
Config.FuelScript = 'legacy-fuel'
ANY OTHER FUEL SCRIPT

Set Config

shared/client-functions.lua
Config.FuelScript = '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/client-functions.lua
      function GetFuelLevel(vehicle)
          --standalone / ox_fuel
          if Config.FuelScript == 'ox_fuel' or Config.FuelScript == nil then 
              return GetVehicleFuelLevel(vehicle)
      
          --cdn fuel script
          elseif Config.FuelScript == 'cdn-fuel' then 
              return exports['cdn-fuel']:GetFuel(vehicle) 
      
          --legacy fuel script
          elseif Config.FuelScript == 'legacy-fuel' then
              return DecorGetFloat(vehicle, '_FUEL_LEVEL') 
          
          elseif Config.FuelScript == 'other' then
              -- If you are using any other fuel script, just add the code that gets the fuel amount right here
              -- Make sure the fuel amount is RETURNED as a number between 0 and 100 
          end
      end
      
    • Utilize exports or any means from your custom fuel script to check how much fuel the vehicle has, and return the amount as a number between 0 and 100


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 user_settings.sql , using your database software.

CREATE TABLE IF NOT EXISTS md_vehmenu_ui_settings (
    license2 VARCHAR(64) NOT NULL,  
    uiscale FLOAT NOT NULL DEFAULT 1.0,
    uileft INT NOT NULL DEFAULT 0,
    uitop INT NOT NULL DEFAULT 0,
    PRIMARY KEY (license2)
);

Enabling Onesync

Follow this Guide by Quasar to enable onesync on your server. This is required to ensure proper synchronisation of indicators between players.


Configuring Your Resource

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

Last updated