πŸ”₯All scripts on our website are 50% off!πŸ”₯
Logo

Configuration

[!CAUTION] Don't touch these lines:

Config = {}
Cat = {}

Framework Settings

-- Use "esx" or "qb"
Config.Framework = "qb"
-- If you are using one of the most recent versions of ESX, set the script name. Default = "es_extended"
Config.ESXExport = ""
-- Default ESX: "esx:getSharedObject" | Default QB: "qb-core"
Config.Core = "qb-core"
-- Select oxmysql, mysql-async or ghmattisql
Config.Mysql = "oxmysql"

General Settings

-- Modify if you have problems with the status bars of the vehicles (brakes, maximum speed, etc...)
Config.maxspeedBarMultiplier = 3
-- The first car that will be displayed when the menu is opened
Config.defaultcar = 'brioso'
-- Add if you want to receive logs by discord when users buy vehicles
Config.DiscordWebhookLink = ""
-- Activate if a driver's license is required to purchase
Config.licenserequired = false
-- Change only in case you want to add several stores
Config.prefix = "bit-dealership"
-- Enable to show errors in the log to detect faults
Config.debug = false
-- Change the source of the alert to enter the menu. Set to 0 if your language is Chinese
Config.alertTextFont = 4
-- Text to be displayed in the alert
Config.enterText = "Press ~r~E~s~ to access the dealership"
-- Delay spawn (milliseconds)
Config.delaySpawn = 5000

Keys Integration

Config.useKeys = false

function addKeys(vehicle)
    -- Insert here your trigger. EX:
    -- TriggerServerEvent("keyscar:server:addKey", GetVehicleNumberPlateText(vehicle), false)
end

Car Purchase Spawn Coordinates

Buycar = {
    x = -57.11,
    y = -1071.59,
    z = 26.88,
    heading = 69.66
}

function spawnShopVehicle(vehmodel)
    if Config.Framework == "esx" then
        ESX.Game.SpawnLocalVehicle(vehmodel, vector3(SpawnCarShop.x, SpawnCarShop.y, SpawnCarShop.z), SpawnCarShop.heading)
    elseif Config.Framework == "qb" then
        local coord = {x = SpawnCarShop.x, y = SpawnCarShop.y, z = SpawnCarShop.z, h = SpawnCarShop.heading}
        QBCore.Functions.SpawnVehicle(vehmodel, function(vehicle) end, coord, false)
    end
end

Car Remove Function

function delcar()
    local vehicle = nil
    while vehicle ~= 0 do
        local vehicle = GetClosestVehicle(GetEntityCoords(PlayerPedId()), 50.0, 0, 70)
        DeleteEntity(vehicle)
        if vehicle == 0 then
            vehicle = nil
            break
        end
    end
end

Test Drive Configuration

Testdrive = {
    -- Time allowed to test the vehicle (default: 3 minutes // 180 seconds)
    time = 180,
    -- Coordinates
    x = -57.11,
    y = -1071.59,
    z = 26.88,
    heading = 69.66
}

Exit Coordinates

ExitCoords = {
    x = -35.62,
    y = -1105.53,
    z = 26.42
}

Spawn Car Shop Coordinates

SpawnCarShop = {
    x = 231.77,
    y = -994.55,
    z = -99.42,
    heading = 61.95
}

Character Coordinates (Shop)

CharCarShop = {
    x = 223.16,
    y = -1004.42,
    z = -99.0,
    heading = 100.0
}

Camera Coordinates

CamCoords = {
    x = 227.94,
    y = -995.61,
    z = -98.5,
    rotx = 360.00,
    roty = 0.00,
    rotz = 0.00,
    fov = 60.00
}

Camera Point

CamPoint = {
    x = 231.82,
    y = -994.01,
    z = -99.0
}

Camera Rotation

CamRot = {
    x = -15.0,
    y = 0.0,
    z = 252.063
}

Blip Configuration

Blip = {
    title = "Dealership",
    x = -33.83,
    y = -1101.87,
    z = 26.42,
    color = 49,
    sprite = 225,
    scale = 0.9
}

Marker Configuration

Marker = {
    x = -33.83,
    y = -1101.87,
    z = 26.42,
    mtype = 23,
    -- RGB COLOR:
    r = 245,
    g = 14,
    b = 70
}

Save Vehicle Function

function saveVehicle(xPlayer, vehicleName, props)
    if Config.Framework == "esx" then
        SqlFunc(Config.Mysql, 'execute', 'INSERT INTO owned_vehicles (owner, plate, vehicle, stored) VALUES (@owner, @plate, @vehicle, @stored)', {
            ['@owner'] = xPlayer.identifier,
            ['@plate'] = props.plate,
            ['@vehicle'] = json.encode(props),
            ['@stored'] = 0
        })
    elseif Config.Framework == "qb" then
        SqlFunc(Config.Mysql, 'execute', 'INSERT INTO player_vehicles (license, vehicle, model, citizenid, plate, mods, state) VALUES (@license, @vehicle, @model, @citizenid, @plate, @mods, @state)', {
            ['@license'] = xPlayer.PlayerData.license,
            ['@vehicle'] = vehicleName,
            ['@model'] = props.model,
            ['@citizenid'] = xPlayer.PlayerData.citizenid,
            ['@plate'] = props.plate,
            ['@mods'] = json.encode(props),
            ['@state'] = 0
        })
    end
end

Remove Money Function

function removeMoney(payType, xPlayer, price)
    if Config.Framework == "esx" then
        if payType == "card" then
            xPlayer.removeAccountMoney('bank', tonumber(price))
        else
            xPlayer.removeMoney(tonumber(price))
        end
    elseif Config.Framework == "qb" then
        if payType == "card" then
            xPlayer.Functions.RemoveMoney('bank', tonumber(price), "Dealership")
        else
            xPlayer.Functions.RemoveMoney('cash', tonumber(price), "Dealership")
        end
    end
end