CUSTOMS

1. General Configuration

The general configuration section includes the framework settings, MySQL settings, and custom functions for vehicle modifications.

Customize = {
    Framework = "NewESX", -- QBCore | ESX | NewESX | OldQBCore (Write the framework you used as in the example)
    Mysql = "oxmysql", -- oxmysql | ghmattimysql | mysql-async (Write the sql script you use as in the example)
    RepairPrice = 250,

    CustomFunction = function(Vehicle, Porps)
        -- TriggerServerEvent('UpdateVehicleModifications', string.gsub(GetVehicleNumberPlateText(Vehicle), '^%s*(.-)%s*$', '%1'), exports['esc_carsave']:GetVehicleModifications(Vehicle))
    end,

    JobErrorNotify = function()
        print("profession mismatch")
    end,
    
    MoneyErrorNotify = function()
        print("No money received!")
    end,

    OpenCustoms = function()
        -- exports['script-hud']:SetHudVisibility(false)
    end,

    CloseCustoms = function()
        -- exports['script-hud']:SetHudVisibility(true)
    end
}

2. RGB and Standard Color Customization

Define the RGB and standard color options for vehicle customization.

CustomizeRGBColor = {
    ['Primary'] = true,
    ['Secondary'] = true,
    ['Xenon'] = true,
    ['Neon'] = true,
}

CustomizeColor = {
    {Label = "Chrome", ID = 120},
    {Label = "Black", ID = 0},
    {Label = "Carbon Black",  ID = 147},
    {Label = "Graphite",  ID = 1},
    {Label = "Anhracite Black",  ID = 11},
    {Label = "Black Steel",  ID = 2},
    {Label = "Dark Steel",  ID = 3},
    {Label = "Silver",  ID = 4},
    {Label = "Bluish Silver",  ID = 5},
    {Label = "Rolled Steel",  ID = 6},
    {Label = "Shadow Silver",  ID = 7},
    {Label = "Stone Silver",  ID = 8},
    {Label = "Midnight Silver",  ID = 9},
    {Label = "Cast Iron Silver",  ID = 10},
    {Label = "Red",  ID = 27},
    {Label = "Torino Red",  ID = 28},
    {Label = "Formula Red",  ID = 29},
    {Label = "Lava Red",  ID = 150},
    {Label = "Blaze Red",  ID = 30},
    {Label = "Grace Red",  ID = 31},
    {Label = "Garnet Red",  ID = 32},
    {Label = "Sunset Red",  ID = 33},
    {Label = "Cabernet Red",  ID = 34},
    {Label = "Wine Red",  ID = 143},
    {Label = "Candy Red",  ID = 35},
    {Label = "Hot Pink",  ID = 135},
    {Label = "Pfsiter Pink",  ID = 137},
    {Label = "Salmon Pink",  ID = 136},
    {Label = "Sunrise Orange",  ID = 36},
    {Label = "Orange",  ID = 38},
    {Label = "Bright Orange",  ID = 138},
    {Label = "Gold",  ID = 99},
    {Label = "Bronze",  ID = 90},
    {Label = "Yellow",  ID = 88},
    {Label = "Race Yellow",  ID = 89},
    {Label = "Dew Yellow",  ID = 91},
    {Label = "Dark Green",  ID = 49},
    {Label = "Racing Green",  ID = 50},
    {Label = "Sea Green",  ID = 51},
    {Label = "Olive Green",  ID = 52},
    {Label = "Bright Green",  ID = 53},
    {Label = "Gasoline Green",  ID = 54},
    {Label = "Lime Green",  ID = 92},
    {Label = "Midnight Blue",  ID = 141},
    {Label = "Galaxy Blue",  ID = 61},
    {Label = "Dark Blue",  ID = 62},
    {Label = "Saxon Blue",  ID = 63},
    {Label = "Blue",  ID = 64},
    {Label = "Mariner Blue", ID = 65},
    {Label = "Harbor Blue", ID = 66},
    {Label = "Diamond Blue", ID = 67},
    {Label = "Surf Blue", ID = 68},
    {Label = "Nautical Blue", ID = 69},
    {Label = "Racing Blue", ID = 73},
    {Label = "Ultra Blue", ID = 70},
    {Label = "Light Blue", ID = 74},
    {Label = "Chocolate Brown", ID = 96},
    {Label = "Bison Brown", ID = 101},
    {Label = "Creeen Brown", ID = 95},
    {Label = "Feltzer Brown", ID = 94},
    {Label = "Maple Brown", ID = 97},
    {Label = "Beechwood Brown", ID = 103},
    {Label = "Sienna Brown", ID = 104},
    {Label = "Saddle Brown", ID = 98},
    {Label = "Moss Brown", ID = 100},
    {Label = "Woodbeech Brown", ID = 102},
    {Label = "Straw Brown", ID = 99},
    {Label = "Sandy Brown", ID = 105},
    {Label = "Bleached Brown", ID = 106},
    {Label = "Schafter Purple", ID = 71},
    {Label = "Spinnaker Purple", ID = 72},
    {Label = "Midnight Purple", ID = 142},
    {Label = "Bright Purple", ID = 145},
    {Label = "Cream Purple", ID = 107},
    {Label = "Frost White", ID = 112},
    -- Matte
    {Label = "Black", ID = 12},
    {Label = "Gray", ID = 13},
    {Label = "Light Gray", ID = 14},
    {Label = "Ice White", ID = 131},
    {Label = "Blue", ID = 83},
    {Label = "Dark Blue", ID = 82},
    {Label = "Midnight Blue", ID = 84},
    {Label = "Midnight Purple", ID = 149},
    {Label = "Schafter Purple", ID = 148},
    {Label = "Red", ID = 39},
    {Label = "Dark Red", ID = 40},
    {Label = "Orange", ID = 41},
    {Label = "Yellow", ID = 42},
    {Label = "Lime Green", ID = 55},
    {Label = "Green", ID = 128},
    {Label = "Forest Green", ID = 151},
    {Label = "Foliage Green", ID = 155},
    {Label = "Olive Darb", ID = 152},
    {Label = "Dark Earth", ID = 153},
    {Label = "Desert Tan", ID = 154},
    -- Metals
    {Label = "Brushed Steel", ID = 117},
    {Label = "Brushed Black Steel", ID = 118},
    {Label = "Brushed Aluminum", ID = 119},
    {Label = "Pure Gold", ID = 158},
    {Label = "Brushed Gold", ID = 159},
}

3. Vehicle Customization Options

Define the customization options available for vehicles, including performance and cosmetic upgrades.

CustomizeCustoms = {
    ['Performance'] = {
        { ID = 11,  Name = 'Engine',         Label = 'Engine #',            Image = 'Engine.svg',          Price = {0,1200,1700,2100,2400}},  
        { ID = 12,  Name = 'Brakes',         Label = 'Brakes #',            Image = 'Brakes.svg',          Price = {0,1200,1700,2100,2400}},  
        { ID = 13,  Name = 'transmission',   Label = 'transmission #',      Image = 'Transmission.svg',    Price = {0,1200,1700,2100,2400}},  
        { ID = 15,  Name = 'suspension',     Label = 'suspension #',        Image = 'Suspension.svg',      Price = {0,1200,1700,2100,2400}},  
        { ID = 16,  Name = 'armor',          Label = 'armor #',             Image = 'Armor.svg',           Price = {0,1200,1700,2100,2400}},  
        { ID = 18,  Name = 'turbo',          Label = 'turbo #',             Image = 'Turbo.svg',           Price = {0,1200}},                 
    },
    ['VehicleCustomisation'] = {
        { ID = 0,   Name = 'spoiler',        Label = 'spoiler #',           Image = 'Spoiler.svg',          Price = {1200,1700,2100,2400}},   
        { ID = 4,   Name = 'Exhaust',        Label = 'Exhaust #',           Image = 'Exhaust.svg',          Price = {1200,1700,2100,2400}},   
        { ID = 29,  Name = 'Dashboard',      Label = 'Dashboard #',         Image = 'Dashboard.svg',        Price = {1200,1700,2100,2400}},   
        { ID = 28,  Name = 'Ornaments',      Label = 'Ornaments #',         Image = 'Ornaments.svg',        Price = {1200,1700,2100,2400}},   
        { ID = 48,  Name = 'Livery',         Label = 'Livery #',            Image = 'Livery.svg',           Price = {1200,1700,2100,2400}},   
        { ID = 10,  Name = 'Roof',           Label = 'Roof #',              Image = 'Roof.svg',             Price = {1200,1700,2100,2400}},   
        { ID = 5,   Name = 'Roll Cage',      Label = 'Roll Cage #',         Image = 'RollCage.svg',         Price = {1200,1700,2100,2400}},   
        { ID = 25,  Name = 'Vanity Plates',  Label = 'Vanity Plates #',     Image = 'Plates.svg',           Price = {1200,1700,2100,2400}},
        { ID = 6,   Name = 'Grille',         Label = 'Grille #',            Image = 'Grille.svg',           Price = {1200,1700,2100,2400}},   
        { ID = 1,   Name = 'Front Bumper',   Label = 'Front Bumper #',      Image = 'FrontBumper.svg',      Price = {1200,1700,2100,2400}},   
        { ID = 2,   Name = 'Rear Bumper',    Label = 'Rear Bumper #',       Image = 'RearBumper.svg',       Price = {1200,1700,2100,2400}},   
        { ID = 3,   Name = 'Side Skirt',     Label = 'Side Skirt #',        Image = 'SideSkirt.svg',        Price = {1200,1700,2100,2400}},   
        { ID = 7,   Name = 'Hood',           Label = 'Hood #',              Image = 'Hood.svg',             Price = {1200,1700,2100,2400}},   
        { ID = 8,   Name = 'Left Fender',    Label = 'Left Fender #',       Image = 'Fender.svg',           Price = {1200,1700,2100,2400}},   
        { ID = 9,   Name = 'Right Fender',   Label = 'Right Fender #',      Image = 'Fender.svg',           Price = {1200,1700,2100,2400}},   
        { ID = 27,  Name = 'Trim A',         Label = 'Trim A #',            Image = 'Trim.svg',             Price = {1200,1700,2100,2400}},
        { ID = 30,  Name = 'Dial',           Label = 'Dial #',              Image = 'Dial.svg',             Price = {1200,1700,2100,2400}},
        { ID = 31,  Name = 'Door Speaker',   Label = 'Door Speaker #',      Image = 'DoorSpeaker.svg',      Price = {1200,1700,2100,2400}},
        { ID = 32,  Name = 'Seats',          Label = 'Seats #',             Image = 'Seats.svg',            Price = {1200,1700,2100,2400}},
        { ID = 33,  Name = 'Steering Wheel', Label = 'Steering Wheel #',    Image = 'SteeringWheel.svg',    Price = {1200,1700,2100,2400}},
        { ID = 34,  Name = 'Shifter Leaver', Label = 'Shifter Leaver #',    Image = 'ShifterLeaver.svg',    Price = {1200,1700,2100,2400}},
        { ID = 35,  Name = 'Plaque',         Label = 'Plaque #',            Image = 'Plaque.svg',           Price = {1200,1700,2100,2400}},
        { ID = 36,  Name = 'Speaker',        Label = 'Speaker #',           Image = 'Speaker.svg',          Price = {1200,1700,2100,2400}},
        { ID = 37,  Name = 'Trunk',          Label = 'Trunk #',             Image = 'Spoiler.svg',          Price = {1200,1700,2100,2400}},
        { ID = 38,  Name = 'Hydraulic',      Label = 'Hydraulic #',         Image = 'Hydraulic.svg',        Price = {1200,1700,2100,2400}},
        { ID = 39,  Name = 'Engine Block',   Label = 'Engine Block #',      Image = 'EngineBlock.svg',      Price = {1200,1700,2100,2400}},
        { ID = 40,  Name = 'Air Filter',     Label = 'Air Filter #',        Image = 'AirFilter.svg',        Price = {1200,1700,2100,2400}},
        { ID = 41,  Name = 'Strut',          Label = 'Strut #',             Image = 'Strut.svg',            Price = {1200,1700,2100,2400}},
        { ID = 42,  Name = 'Arch Cover',     Label = 'Arch Cover #',        Image = 'Roof.svg',             Price = {1200,1700,2100,2400}},
        { ID = 43,  Name = 'Aerial',         Label = 'Aerial #',            Image = 'Roof.svg',             Price = {1200,1700,2100,2400}},
        { ID = 44,  Name = 'Trim B',         Label = 'Trim B #',            Image = 'Trim.svg',             Price = {1200,1700,2100,2400}},
        { ID = 45,  Name = 'Fuel Tank',      Label = 'Fuel Tank #',         Image = 'FuelTank.svg',         Price = {1200,1700,2100,2400}},
        { ID = 46,  Name = 'Window',         Label = 'Window #',            Image = '.svg',                 Price = {1200,1700,2100,2400}},
        { ID = 14,  Name = 'Horn',           Label = 'Horn #',              Image = 'Horn.svg',             Price = {1200,1700,2100,2400}},
        { ID = 23,  Name = 'Front Wheels',   Label = 'Front Wheels #',      Image = 'WheelColour.svg',      Price = {1200,1700,2100,2400}},
    },
    ['Plate'] = { ID = 'Plate',   Name = 'Plates',           Image = 'Plates.svg',          Price = {1200,1700,2100,2400,2800,4350}},
    ['WindowTintOptions'] = { Load = { { ID = 0,  Label = 'Window',      Price = 200}, { ID = 3,  Label = 'Lightsmoke',  Price = 250}, { ID = 2,  Label = 'Darksmoke',   Price = 320}, { ID = 1,  Label = 'Pure Black',  Price = 380}, }, Name = 'Window Tint', Label = 'Window Tint', Image = 'WindowTint.svg' },
    ['Extras'] = { ID = 'Extras',   Name = 'Extras',        Label = 'Extras #',           Image = 'Extras.svg',          Price = {1200,1700,2100,2400,2800,4350}}, 
    ['Neons'] = { Load = { { ID = 2,  Label = 'Front Neon',  Price = 200}, { ID = 3,  Label = 'Rear Neon',   Price = 250}, { ID = 0,  Label = 'Left Neon',   Price = 320}, { ID = 1,  Label = 'Right Neon',  Price = 380} }, Name = 'Neons', Label = 'Neons', Image = 'Neon.svg' },
    ['Xenons'] = { Load = { { ID = 1,  Label = 'Xenon Farver',  Price = 400}, { ID = 0,  Label = 'Forlygter',   Price = 20}, }, Name = 'Xenons', Label = 'Xenons', Image = 'Xenons.svg' },
    ['Pearlescent'] = { Name = 'Pearlescent Colours', Label = 'Pearlescent Colours', Image = 'PearlescentColor.svg', Price = 100 },
    ['Dashboard'] = { Name = 'Dashboard Colours', Label = 'Dashboard Colours', Image = 'DashboardColor.svg', Price = 100 },
    ['Interior'] = { Name = 'Interior Colours', Label = 'Interior Colours', Image = 'InteriorColour.svg', Price = 100 },
    ['Wheel'] = { Name = 'Wheel Colours', Label = 'Wheel Colours', Image = 'WheelColour.svg', Price = 100 } 
}

4. Custom Shop Locations

Define the locations for your custom vehicle shops, including blip settings and vehicle spawn positions.

Customs = {
    {
        BlipPos = vector3(318.44, -232.77, 53.37),              -- Represents NPC and Blip location
        BlipLabel = "Customs",                                  -- Specifies the name to appear on the map
        BlipSprite = 643,                                       -- (https://docs.fivem.net/docs/game-references/blips/#blips)
        BlipDisplay = 4,                                        -- (https://docs.fivem.net/natives/?_0x9029B2F3DA924928)
        BlipScale = 0.8,                                        -- Sets icon size
        BlipColour = 18,                                        -- (https://docs.fivem.net/docs/game-references/blips/#blip-colors)
        BlipDisplay = true,                                  
        VehOpenCustoms = {                                      -- Location where the car will be picked up from the Customs
            [1] = vector3(326.07, -241.48, 53.92),
            [2] = vector3(318.63, -232.05, 53.96),
            [3] = vector3(327.83, -212.17, 53.54),
        },
        Jobs = {'all'}
    },
    {
        BlipPos = vector3(110.93, 6626.27, 31.79),              -- Represents NPC and Blip location
        BlipLabel = "Customs",                                  -- Specifies the name to appear on the map
        BlipSprite = 643,                                       -- (https://docs.fivem.net/docs/game-references/blips/#blips)
        BlipDisplay = 4,                                        -- (https://docs.fivem.net/natives/?_0x9029B2F3DA924928)
        BlipScale = 0.8,                                        -- Sets icon size
        BlipColour = 18,                                        -- (https://docs.fivem.net/docs/game-references/blips/#blip-colors)
        BlipDisplay = true,                                  
        VehOpenCustoms = {                                      -- Location where the car will be picked up from the Customs
            [1] = vector3(110.93, 6626.27, 31.79),
        },
        Jobs = {'all'}
    },
    {
        BlipPos = vector3(-211.56, -1324.37, 30.27),              -- Represents NPC and Blip location
        BlipLabel = "Customs",                                  -- Specifies the name to appear on the map
        BlipSprite = 643,                                       -- (https://docs.fivem.net/docs/game-references/blips/#blips)
        BlipDisplay = 4,                                        -- (https://docs.fivem.net/natives/?_0x9029B2F3DA924928)
        BlipScale = 0.8,                                        -- Sets icon size
        BlipColour = 18,                                        -- (https://docs.fivem.net/docs/game-references/blips/#blip-colors)
        BlipDisplay = true,                                  
        VehOpenCustoms = {                                      -- Location where the car will be picked up from the Customs
            [1] = vector3(-211.56, -1324.37, 30.27),
        },
        Jobs = {'all'}
    },
}

5. Marker Configuration

Define the marker settings and interaction options for opening the customs menu.

CustomizeMarker = {
    MarkerDistance = 12.0,
    Marker = function(Position)
        DrawMarker(20, Position.x, Position.y, Position.z, 0, 0, 0, 0, 0, 0, 0.3, 0.3, 0.3, 36, 97, 241, 150, false, false, false, 1, false, false, false)
    end,
    
    DrawTextDisplay = false,
    DrawText = function(Text, Position)
        local text = "~g~ OPEN ~y~[E]~g~"
        local onScreen, _x, _y = World3dToScreen2d(Position.x, Position.y, Position.z+0.3)
        local px, py, pz = table.unpack(GetGameplayCamCoords())
        SetTextScale(0.25, 0.25)
        SetTextFont(8)
        SetTextProportional(1)
        SetTextEntry("STRING")
        SetTextCentre(1)
        AddTextComponentString(text)
        DrawText(_x, _y)
        DrawRect(_x, _y + 0.0125, 0.015 + (string.len(text)) / 330, 0.03, 41, 11, 41, 68)
    end,

    MarkerNuiOpenDistance = 2.0,
    Open = function()
        if IsControlJustPressed(0, 38) then
            return true
        end
    end
}

6. Framework and SQL Integration Functions

Functions to integrate the script with different frameworks like ESX, NewESX, and QBCore, and to execute SQL queries.

function GetFramework()
    local Get = nil
    if Customize.Framework == "ESX" then
        while Get == nil do
            TriggerEvent('esx:getSharedObject', function(Set) Get = Set end)
            Citizen.Wait(0)
        end
    end
    if Customize.Framework == "NewESX" then
        Get = exports['es_extended']:getSharedObject()
    end
    if Customize.Framework == "QBCore" then
        Get = exports["qb-core"]:GetCoreObject()
    end
    if Customize.Framework == "OldQBCore" then
        while Get == nil do
            TriggerEvent('QBCore:GetObject', function(Set) Get = Set end)
            Citizen.Wait(200)
        end
    end
    return Get
end

function ExecuteSql(query)
    local IsBusy = true
    local result = nil
    if Customize.Mysql == "oxmysql" then
        if MySQL == nil then
            exports.oxmysql:execute(query, function(data)
                result = data
                IsBusy = false
            end)
        else
            MySQL.query(query, {}, function(data)
                result = data
                IsBusy = false
            end)
        end
    elseif Customize.Mysql == "ghmattimysql" then
        exports.ghmattimysql:execute(query, {}, function(data)
            result = data
            IsBusy = false
        end)
    elseif Customize.Mysql == "mysql-async" then   
        MySQL.Async.fetchAll(query, {}, function(data)
            result = data
            IsBusy = false
        end)
    end
    while IsBusy do
        Citizen.Wait(0)
    end
    return result
end

Summary

This guide helps you configure a custom vehicle modification shop in your FiveM server by providing detailed examples for general configuration, color options, customization settings, location setup, marker configuration, and integration functions. Customize each section to fit your server's needs and integrate these configurations into your GitBook documentation for clear and comprehensive instructions for your users.

Last updated