Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Accessible files

Here you can find all the files which can be edite to make the asset compatible with your server.​

config.lua
----------------------------------------------------------------------------------------------
----------------------------------| BRUTAL VEHICLE SHOP :) |----------------------------------
----------------------------------------------------------------------------------------------

--[[

Hi, thank you for buying our script, We are very grateful!

For help join our Discord server:     https://discord.gg/85u2u5c8q9
More informations about the script:   https://docs.brutalscripts.com

--]]

Config = {} -- Don't touch it

Config['Core'] = 'ESX'  -- ESX / QBCore  | Other core setting on the 'core' folder
Config['BrutalNotify'] = true -- Buy here: (4€+VAT) https://store.brutalscripts.com | Or set up your own notify >> cl_utils.lua
Config['BrutalKeys'] = true -- Buy here: (15€+VAT) https://store.brutalscripts.com | Or set up your own vehiclekeys >> cl_utils.lua

-- You can add your own notify here >> cl_utils.lua

Config['VehicleShops'] = {
    -- Discord Webhook config in 'webhook.lua'
    ['MoneyForm'] = '$',  -- Please add your server money form | EXAMPLES: '$', '€', 'Ft', 'Lira', etc.
    ['Plate'] = 'LLL NNN',  -- L = Letter, N = Number, ' ' = SPACE | Maximum 8 character!!! Examples: 'LL NN LL', 'NN', 'LNLN' | Edit as you like
    ['TestDrive'] = {Use = true, price = 5000, time = 60},  -- Test drive config
    ['TestDriveCancel'] = {Use = true, command = 'cancel', Suggestion = 'Use the command to end the test drive'},  -- Testdrive command | true / false | command = 'COMMAND' | Suggestion = Chat label, to turn off: set ''
    ['TestDriveRevive'] = true,  -- Revive a player if he died during vehicle testing
    ['Metric'] = 'KMH', -- KMH / MPH
    ['UseScreenBlur'] = true,  -- true / false | Want to use Screen Blur?
    ['MenuOpenKey'] = 38,  -- More controls: https://docs.fivem.net/docs/game-references/controls/
    ['MaxVehiclesSpeed'] = 400, -- Max speed a vehicle can go at (it is only used for UI purposes, it does NOT change the speed of a vehicle)
    ['ColourExtraMoney'] = 2500, -- PRICE / false | The extra money what you have to pay if your car's color isn't black or white
    
    ['Tunings'] = {  -- Vehicle tunings
        ['Exist'] = true,  -- Want to use? | true / false
        ['Engine'] = {false, 15000, 2},  -- true/false, price/level , The maximum value of tuning you want to be able to put into the vehicle
        ['Brakes'] = {false, 8000, 5},
        ['Turbo'] = {false, 50000},
        ['Xeon'] = {true, 500},
        ['Livery'] = {true, 10000},
    },
    
    ['UseColorGTAID'] = false, -- Will set the vehicle color based on the color ID: https://wiki.rage.mp/index.php?title=Vehicle_Colors
    ['Colours'] = {  -- Vehicle Colours | You can't add more! (Only 10)
        [1] = {255, 255, 255, GTAID = 134},  -- R, G, B, GTA COLOUR | The GTA color is used by the script if ['UseColorGTAID'] is true
        [2] = {0, 0, 0, GTAID = 0},
        [3] = {150, 150, 150, GTAID = 4},      
        [4] = {255, 0, 0, GTAID = 27},
        [5] = {255, 150, 0, GTAID = 41},        
        [6] = {255, 230, 0, GTAID = 89},
        [7] = {0, 255, 0, GTAID = 55},          
        [8] = {0, 0, 255, GTAID = 79},
        [9] = {76, 0, 255, GTAID = 145},         
        [10] = {255, 0, 255, GTAID = 137},
    },
    
    ['Shops'] = {
        --------------------------------------------------------------------------
        -----------------------------| VEHICLE SHOP |-----------------------------
        --------------------------------------------------------------------------

        ['Vehicle Shop'] = {
            ['Use'] = true,  -- Want to use this shop? | true / false
            ['Coords'] = { x = -43.0507, y = -1104.0652, z = 26.4223}, -- Shop possition
            ['TextDistance'] = 1.3,  -- Open Menu Distance
            ['Marker'] = {Distance = 15, Sprite = 36, Rotation = true, UpAndDown = false, Brightness = 100, r = 260, g = 40, b = 40},  -- More sprites: https://docs.fivem.net/docs/game-references/markers/
            ['Cam'] = {x = -46.4095, y = -1102.0146, z = 27.2223, rotation = {-15.0,0.0,-20} },  -- Shop camera position
            ['PreviewVehicle'] = {x = -44.4230, y = -1096.9951, z = 26.4223, heading = 158.5431-45},  -- Preview vehicle position
            ['SpawnCoords'] = {x = -24.8248, y = -1082.5984, z = 26.6334, heading = 70.1315},  -- Vehicle Spawn Coords
            ['TestCoords'] = {x = -1695.7524, y = -2840.3235, z = 13.9444, heading = 328.2468},  -- Vehicle Test Coords
            ['Blip'] = {Use = true, colour = 0, label = 'Vehicle Shop', size = 0.8, sprite = 225 }, -- Blip config
            ['SeveralCategorys'] = true,  -- Want to use Categorys in this Shop? | true / false (If false, the first category will appear only)
            ['Caregorys'] = {  -- You can add endless amount of cagerorys
                {
                    title = "Super Sport",  -- Category name
                    vehicles = {
                        {model = "adder", label = "Adder", price = 900000, type = 'car'},  -- model = vehicle model, label = Vehicle Label, price = Vehicle Price, type = Vehicle type ('boat', 'car', 'heli', 'plane', etc.)
                        {model = "zentorno", label = "Zentorno", price = 765000, type = 'car'},
                        {model = "cheetah", label = "Cheetah", price = 375000, type = 'car'},
                        {model = "zeno", label = "Zeno", price = 560000, type = 'car'},
                        {model = "visione", label = "Visione", price = 640000, type = 'car'},
                        {model = "champion", label = "Champion", price = 200000, type = 'car'},
                        {model = "ignus", label = "Ignus", price = 330000, type = 'car'},
                        {model = "tigon", label = "Tigon", price = 265000, type = 'car'},
                        {model = "furia", label = "Furia", price = 399000, type = 'car'},
                        {model = "krieger", label = "Krieger", price = 534000, type = 'car'},
                        {model = "emerus", label = "Emerus", price = 760000, type = 'car'},
                        {model = "thrax", label = "Thrax", price = 1000000, type = 'car'},
                        {model = "autarch", label = "Autarch", price = 1500000, type = 'car'},
                        {model = "vagner", label = "Vagner", price = 489000, type = 'car'},
                        {model = "tempesta", label = "Tempesta", price = 345000, type = 'car'},
                        {model = "tyrus", label = "Tyrus", price = 850000, type = 'car'},
                        {model = "reaper", label = "Reaper", price = 120000, type = 'car'},
                        {model = "fmj", label = "FMJ", price = 280000, type = 'car'},
                        {model = "t20", label = "T20", price = 530000, type = 'car'},
                        {model = "osiris", label = "Osiris", price = 267000, type = 'car'},
                        {model = "banshee", label = "Banshee", price = 150000, type = 'car'},
                        {model = "vacca", label = "Vacca", price = 270000, type = 'car'},
                        {model = "infernus", label = "Infernus", price = 190000, type = 'car'}

                    }
                },
                {
                    title = "Sedans",
                    vehicles = {
                        {model = "ingot", label = "Ingot", price = 13400, type = 'car'},
                        {model = "premier", label = "Premier", price = 23000, type = 'car'},
                        {model = "regina", label = "Regina", price = 16000, type = 'car'},
                    }
                },
                {
                    title = "Compats",
                    vehicles = {
                        {model = "asbo", label = "Asbo", price = 8000, type = 'car'},
                        {model = "hellion", label = "Hellion", price = 29000, type = 'car'},
                    }
                },
                {
                    title = "Muscle",
                    vehicles = {
                        {model = "vamos", label = "Vamos", price = 50000, type = 'car'},
                    }
                },
                {
                    title = "Suvs",
                    vehicles = {
                        {model = "rocoto", label = "Rocoto", price = 76000, type = 'car'},
                        {model = "mesa", label = "Mesa", price = 100000, type = 'car'},
                    }
                },
                {
                    title = "Off Road",
                    vehicles = {
                        {model = "brawler", label = "Brawler", price = 99000, type = 'car'},
                        {model = "guardian", label = "Guardian", price = 160000, type = 'car'},
                    }
                },
                {
                    title = "Vans",
                    vehicles = {
                        {model = "speedo", label = "Speedo", price = 70000, type = 'car'},
                    }
                },
                -- You can add more categorys...
            }
        },
        --------------------------------------------------------------------------
        ------------------------------| BOAT SHOP |-------------------------------
        --------------------------------------------------------------------------
        ['Boat Shop'] = {
            ['Use'] = true,
            ['Coords'] = { x = -713.2616, y = -1297.8879, z = 5.1019},
            ['TextDistance'] = 1.3,
            ['Marker'] = {Distance = 15, Sprite = 35, Rotation = true, UpAndDown = false, Brightness = 100, r = 260, g = 40, b = 40},
            ['Cam'] = {x = -729.3079, y = -1357.8542, z = 4.9027, rotation = {-15.0,0.0,-40} },
            ['PreviewVehicle'] = {x = -719.5148, y = -1347.1199, z = 0.5714, heading = 140.7528-45},
            ['SpawnCoords'] = {x = -723.5148, y = -1351.1199, z = 0.5714, heading = 140.7528},
            ['TestCoords'] = {x = -853.1735, y = -1544.8879, z = 0.6218, heading = 135.6689},
            ['Blip'] = {Use = true, colour = 0, label = 'Boat Shop', size = 0.8, sprite = 427 },
            ['SeveralCategorys'] = false, 
            ['Caregorys'] = {
                {
                    title = "Boats",
                    vehicles = {
                        {model = "seashark", label = "Seashark", price = 160000, type = 'boat'},
                        {model = "speeder", label = "Speeder", price = 230000, type = 'boat'},
                        {model = "dinghy", label = "Dinghy", price = 340000, type = 'boat'},
                        {model = "toro", label = "Toro", price = 2000000, type = 'boat'},
                    }
                },
            }
        },
        --------------------------------------------------------------------------
        -----------------------| PLANE AND HELICOPTER SHOP |----------------------
        --------------------------------------------------------------------------
        ['Plane & Helicopter Shop'] = {
            ['Use'] = true,
            ['Coords'] = { x = -711.2363, y = -1459.9780, z = 5.0005},
            ['TextDistance'] = 1.3,
            ['Marker'] = {Distance = 15, Sprite = 34, Rotation = true, UpAndDown = false, Brightness = 100, r = 260, g = 40, b = 40},
            ['Cam'] = {x = -718.8840, y = -1436.9779, z = 7.0005, rotation = {-17.0,0.0,140} },
            ['PreviewVehicle'] = {x = -724.7278, y = -1444.2869, z = 5.0005, heading = 320.7925-45},
            ['SpawnCoords'] = {x = -750.1570, y = -1444.5887, z = 5.0005, heading = 228.2726},
            ['TestCoords'] = {x = -745.8632, y = -1469.1633, z = 5.0004, heading = 323.0506},
            ['Blip'] = {Use = true, colour = 0, label = 'Plane & Helicopter Shop', size = 0.8, sprite = 64 },
            ['SeveralCategorys'] = false,
            ['Caregorys'] = {
                {
                    title = "Plane & Helicopter",
                    vehicles = {
                        {model = "volatus", label = "Volatus", price = 10000000, type = 'heli'},
                        {model = "havok", label = "Havok", price = 4900000, type = 'heli'},
                    }
                },
            }
        },

        -- You can add more Shop
    },

    ['UseVehicleSell'] = true,  -- Want to use the Vehicle Sell function? true / false
    ['VehicleSellPercentage'] = 50,

    --------------------------------------------------------------------------
    ------------------------------| TRANSLATE |-------------------------------
    --------------------------------------------------------------------------

    ['OpenShop'] = 'Press [E] to Open Menu',

    ['TestNotify'] = {'Vehicle Test', 'You have', 'second to test the Vehicle!', 'Cancel command: /'},
    ['BuyNotify'] = {'Vehicle Purchase', 'You have bought a(n)', 'with', 'plate!'},
    ['SellNotify'] = {'Get in that vehicle which you want to sell<br>You have 30 sec to get in the vehicle!'},

    ['Notify'] = { 
        [1] = {"Vehicle Shop", "You don't have enought money!", 5000, "error"},  -- Type, Label, Time | 1000 = 1 sec
        [2] = {"Vehicle Shop", "The spawn space is not empty!", 5000, "error"},
        [3] = {"Vehicle Shop", "You are already testing a vehicle!", 5000, "error"},
        [4] = {"Vehicle Shop", "This vehicle model does not exist!", 5000, "error"},
        [5] = {"Vehicle Shop", "This is not your vehicle!", 5000, "error"},
        [6] = {"Vehicle Shop", "You have successfully sold your vehicle!", 5000, "success"},
        [7] = {"Vehicle Shop", "You can't be in the vehicle!", 5000, "error"},
    },
}
client-utils.lua
function notification(title, text, time, type) -- Buy here: (4€+VAT) https://store.brutalscripts.com
    if Config['BrutalNotify'] then
        exports['brutal_notify']:SendAlert(title, text, time, type)
    else
        -- Put here your own notify and set the Config['BrutalNotify'] to false
        SetNotificationTextEntry("STRING")
        AddTextComponentString(text)
        DrawNotification(0,1)

        -- Default ESX Notify:
        --TriggerEvent('esx:showNotification', text)

        -- Default QB Notify:
        --TriggerEvent('QBCore:Notify', text, 'info', 5000)

        -- OKOK Notify:
        -- exports['okokNotify']:Alert(title, text, time, type, false)

    end
end

RegisterNetEvent('brutal_vehicleshop:client:buyvehicle_utils')
AddEventHandler('brutal_vehicleshop:client:buyvehicle_utils', function(Vehicle, Plate, Model, Price, Label)
    SetVehicleMaxFuel(Vehicle)  -- Our special function
    -- You can add more function and trigger
end)

RegisterNetEvent('brutal_vehicleshop:client:GiveKeys')
AddEventHandler('brutal_vehicleshop:client:GiveKeys', function(vehicle, plate)
	-- Leave blank if you have no keys to give
	Citizen.Wait(1000)
	if Config['BrutalKeys'] and GetResourceState("brutal_keys") == "started" then exports.brutal_keys:addVehicleKey(plate, plate) end	

	--TriggerEvent('vehiclekeys:client:SetOwner', plate)  -- for QBCore (if not work, we can't help you with this)
end)

RegisterNetEvent('brutal_vehicleshop:client:GiveKeysTestDrive')
AddEventHandler('brutal_vehicleshop:client:GiveKeysTestDrive', function(vehicle, plate)
	-- Leave blank if you have no keys to give
    if Config['BrutalKeys'] and GetResourceState("brutal_keys") == "started" then exports.brutal_keys:addVehicleTemporaryKey(Config['VehicleShops']['TestDrive']['time'], plate, plate) end
	
	--TriggerEvent('vehiclekeys:client:SetOwner', plate)  -- for QBCore (if not work, we can't help you with this)
end)

RegisterNetEvent('brutal_vehicleshop:client:onMenuOpen')
AddEventHandler('brutal_vehicleshop:client:onMenuOpen', function()
	-- Code to execute when the player opens the vehicle shop
end)

RegisterNetEvent('brutal_vehicleshop:client:onMenuClose')
AddEventHandler('brutal_vehicleshop:client:onMenuClose', function()
	-- Code to execute when the player leaves the vehicle shop
end)

RegisterNetEvent('brutal_vehicleshop:client:onStartTestDrive')
AddEventHandler('brutal_vehicleshop:client:onStartTestDrive', function(vehicle)
	-- Code to execute when the player starts the test drive
end)

RegisterNetEvent('brutal_vehicleshop:client:onFinishTestDrive')
AddEventHandler('brutal_vehicleshop:client:onFinishTestDrive', function(vehicle)
	-- Code to execute when the player finishes the test drive
end)

RegisterNetEvent('brutal_vehicleshop:client:onSellVehicle')
AddEventHandler('brutal_vehicleshop:client:onSellVehicle', function(vehicle)
	if Config['BrutalKeys'] and GetResourceState("brutal_keys") == "started" then 
		local plate = GetVehicleNumberPlateText(vehicle)
		exports.brutal_keys:removeKey(plate, true) 
	end	
	DeleteEntity(vehicle)
	-- Code to execute when a vehicle is sold
end)

function SetVehicleMaxFuel(vehicle)  -- It fills the car's tank
    SetVehicleFuelLevel(vehicle, 100.0)
    DecorSetFloat(vehicle, "_FUEL_LEVEL", GetVehicleFuelLevel(vehicle))
end

function GPS_Enable()  -- if you don't want to use, comment out the line
    DisplayRadar(true)
end

function GPS_Disable()  -- if you don't want to use, comment out the line
    DisplayRadar(false)
end

function BuyAnimation()  -- Vehicle Buy animation
	local PP = PlayerPedId()
	FreezeEntityPosition(PP, true)
	local ad = "missheistdockssetup1clipboard@base"  
	local prop_name = 'prop_notepad_01'
	local secondaryprop_name = 'prop_pencil_01'
	loadAnimDict(ad)

	if not IsEntityDead(PP) then
		local x,y,z = table.unpack(GetEntityCoords(PP))
		prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2,  true,  true, true)
		secondaryprop = CreateObject(GetHashKey(secondaryprop_name), x, y, z+0.2,  true,  true, true)
		AttachEntityToEntity(prop, PP, GetPedBoneIndex(PP, 18905), 0.1, 0.02, 0.05, 10.0, 0.0, 0.0, true, true, false, true, 1, true)
		AttachEntityToEntity(secondaryprop, PP, GetPedBoneIndex(PP, 58866), 0.12, 0.0, 0.001, -150.0, 0.0, 0.0, true, true, false, true, 1, true)
		TaskPlayAnim(PP, ad, "base", 8.0, 1.0, -1, 49, 0, 0, 0, 0)
		Citizen.Wait(5000)
		FreezeEntityPosition(PP, false)
		ClearPedSecondaryTask(PP)
		DetachEntity(prop, 1, 1)
		DeleteObject(prop)
		DetachEntity(secondaryprop, 1, 1)
		DeleteObject(secondaryprop)
	end
end
server-utils.lua
local YourWebhook = 'WEBHOOK-HERE'  -- help: https://docs.brutalscripts.com/site/others/discord-webhook

function GetWebhook()
    return YourWebhook
end

RegisterNetEvent('brutal_vehicleshop:server:buyvehicle_utils')
AddEventHandler('brutal_vehicleshop:server:buyvehicle_utils', function(Vehicle, Plate, Model, Price, Label)
    SendDiscord('VEHICLE BOUGHT', '**Player:** '.. source ..' ['.. GetIdentifier(source) ..']\n**Vehicle:** '.. Label ..' ['.. Model ..']\n**Plate:** '.. Plate ..'\n**Price:** '.. Price ..' '.. Config['VehicleShops']['MoneyForm'] ..'\n\nPlayer bought a vehicle!', 1)
    -- You can add more function and trigger
end)

----------------------------------------------------------------------------------------------------------
--------------------------------------------------| SQL |-------------------------------------------------
----------------------------------------------------------------------------------------------------------

SoldVehicles = {}

if Config['Core'] == 'ESX' then
--------------------------------------------------------------------------
---------------------------------| ESX |----------------------------------
--------------------------------------------------------------------------

    RESCB('brutal_vehicleshop:server:isPlateTaken', function(source, cb, plate)
        MySQL.scalar('SELECT plate FROM owned_vehicles WHERE plate = ?', {plate},
        function(result)
            cb(result ~= nil)
        end)
    end)

    RegisterNetEvent('brutal_vehicleshop:server:InsertVehicle')
    AddEventHandler('brutal_vehicleshop:server:InsertVehicle', function(vehicle, plate, model, hash, vehicleProps, vehtype)
        MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle, type) VALUES (?, ?, ?, ?)', {
            GetIdentifier(source), 
            plate, 
            json.encode(vehicleProps),
            vehtype
        }, function(rowsChanged) end)
    end)

    RESCB('brutal_vehicleshop:server:CheckPlayerOwned', function(source, cb, modelhash, model, plate, price)
        MySQL.single('SELECT * FROM owned_vehicles WHERE owner = ? AND plate = ?', {GetIdentifier(source), plate},
        function(result)
            if result then
                
                if json.decode(result.vehicle).model == model or json.decode(result.vehicle).model == modelhash then
                    if string.gsub(json.decode(result.vehicle).plate, '%s+', '') == string.gsub(plate, '%s+', '') then
                        MySQL.update('DELETE FROM owned_vehicles WHERE plate = ?', {plate})
                        SendDiscord('VEHICLE SELLED', '**Player:** '.. source ..' ['.. GetIdentifier(source) ..']\n**Plate:** '.. plate ..' \n**Model:** '.. model ..'\n**For that price:** '.. price ..' '.. Config['VehicleShops']['MoneyForm'] ..'\n\nThe player has sold his vehicle!', 2)
                        table.insert(SoldVehicles, plate)
                        cb(true)
                    else
                        SendDiscord('HACKER', '**Player:** '.. source ..' ID ['.. GetIdentifier(source) ..']\n**Reason:** Attempted To Resell Vehicle With Invalid Plate\nTried to make a lot of money', 3)
                        cb(false)
                    end
                else
                    SendDiscord('HACKER', '**Player:** '.. source ..' ID ['.. GetIdentifier(source) ..']\n**Reason:** Attempted To Resell Vehicle With Invalid Model\nTried to make a lot of money', 3)
                    cb(false)
                end
            else
                cb(false)
            end
        end)
    end)

elseif Config['Core'] == 'QBCore' then
--------------------------------------------------------------------------
--------------------------------| QBCore |--------------------------------
--------------------------------------------------------------------------
    RESCB('brutal_vehicleshop:server:isPlateTaken', function(source, cb, plate)
        MySQL.scalar('SELECT plate FROM player_vehicles WHERE plate = ?', {plate},
        function(result)
            cb(result ~= nil)
        end)
    end)
    
    RegisterNetEvent('brutal_vehicleshop:server:InsertVehicle')
    AddEventHandler('brutal_vehicleshop:server:InsertVehicle', function(vehicle, plate, model, hash, vehicleProps, vehtype)
        MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
            GetIdentifier(source),
            GetCitizenID(source),
            model,
            hash,
            json.encode(vehicleProps),
            plate,
            'pillboxgarage',
            0
        })
    end)
    
    RESCB('brutal_vehicleshop:server:CheckPlayerOwned', function(source, cb, modelhash, model, plate, price)
        MySQL.single('SELECT * FROM player_vehicles WHERE license = ? AND plate = ?', {GetIdentifier(source), plate},
        function(result)
            if result then

                if result.vehicle == model or result.hash == string.gsub(modelhash, '%s+', '') then
                    if string.gsub(result.plate, '%s+', '') == string.gsub(plate, '%s+', '') then
                        MySQL.update('DELETE FROM player_vehicles WHERE plate = ?', {plate})
                        SendDiscord('VEHICLE SELLED', '**Player:** '.. source ..' ['.. GetIdentifier(source) ..']\n**Plate:** '.. plate ..' \n**Model:** '.. model ..'\n**For that price:** '.. price ..' '.. Config['VehicleShops']['MoneyForm'] ..'\n\nThe player has sold his vehicle!', 2)
                        table.insert(SoldVehicles, plate)
                        cb(true)
                    else
                        SendDiscord('HACKER', '**Player:** '.. source ..' ID ['.. GetIdentifier(source) ..']\n**Reason:** Attempted To Resell Vehicle With Invalid Plate\nTried to make a lot of money', 3)
                        cb(false)
                    end
                else
                    SendDiscord('HACKER', '**Player:** '.. source ..' ID ['.. GetIdentifier(source) ..']\n**Reason:** Attempted To Resell Vehicle With Invalid Model\nTried to make a lot of money', 3)
                    cb(false)
                end
            else
                cb(false)
            end
        end)
    end)

end
client-core.lua
Core = nil

if Config['Core'] == 'ESX' then
    
    Core = exports['es_extended']:getSharedObject()

    LoadedEvent = 'esx:playerLoaded'
    ReviveEvent = 'esx_ambulancejob:revive'
    PlayerDiedHealth = 0
    TSCB = Core.TriggerServerCallback

    function GetVehicleProperties(vehicle)
        return Core.Game.GetVehicleProperties(vehicle)
    end

elseif Config['Core'] == 'QBCore' then

    Core = exports['qb-core']:GetCoreObject()
    
    LoadedEvent = 'QBCore:Client:OnPlayerLoaded'
    ReviveEvent = 'hospital:client:Revive'
    PlayerDiedHealth = 150
    TSCB = Core.Functions.TriggerCallback

    function GetVehicleProperties(vehicle)
        return Core.Functions.GetVehicleProperties(vehicle)
    end

end
server-core.lua
Core = nil

if Config['Core'] == 'ESX' then
--------------------------------------------------------------------------
---------------------------------| ESX |----------------------------------
--------------------------------------------------------------------------

    Core = exports['es_extended']:getSharedObject()

    RESCB = Core.RegisterServerCallback
    GETPFI = Core.GetPlayerFromId
    RUI = Core.RegisterUsableItem
    Accounts = {'money', 'bank'}

    function GetIdentifier(xPlayer)
        if type(xPlayer) == 'number' then
            local xPlayer = GETPFI(xPlayer)
            return xPlayer.identifier
        else
            return xPlayer.identifier
        end
    end

    function GetAccountMoney(xPlayer,account)
        return xPlayer.getAccount(account).money
    end

    function RemoveAccountMoney(xPlayer, account, amount)
        xPlayer.removeAccountMoney(account, amount)
    end

    function AddAccountMoney(xPlayer, account, amount)
        xPlayer.addAccountMoney(account, amount)
    end

elseif Config['Core'] == 'QBCore' then
--------------------------------------------------------------------------
--------------------------------| QBCore |--------------------------------
--------------------------------------------------------------------------

    Core = exports['qb-core']:GetCoreObject()
    
    RESCB = Core.Functions.CreateCallback
    GETPFI = Core.Functions.GetPlayer
    RUI = Core.Functions.CreateUseableItem
    Accounts = {'cash', 'bank'}

    function GetIdentifier(xPlayer)
        if type(xPlayer) == 'number' then
            local xPlayer = GETPFI(xPlayer)
            return xPlayer.PlayerData.license
        else
            return xPlayer.PlayerData.license
        end
    end

    function GetCitizenID(xPlayer)
        if type(xPlayer) == 'number' then
            local xPlayer = GETPFI(xPlayer)
            return xPlayer.PlayerData.citizenid
        else
            return xPlayer.PlayerData.citizenid
        end
    end

    function GetAccountMoney(xPlayer, account)
        if account == Accounts[1] then
            return xPlayer.PlayerData.money['cash']
        elseif account == Accounts[2] then
            return xPlayer.PlayerData.money['bank']
        end
    end

    function RemoveAccountMoney(xPlayer, account, amount)
        xPlayer.Functions.RemoveMoney(account, amount)
    end

    function AddAccountMoney(xPlayer, account, amount)
        xPlayer.Functions.AddMoney(account, amount)
    end
    
end

Last updated