[FREE] Lightbar Creator / Control

I’m wondering how ?

1 Like

I messaged you in regards to this

1 Like

Very neat idea and great execution from what I saw so far!

Is there a way to implement carcols data for environmental lighting too? It’d add a ton to overall experience!

This script uses light bars designed to function like vehicles, which sets them apart from regular props. For more detailed and visually appealing models, you can check out @OfficialD3 creations. They offer free and high-quality models that could enhance script.

1 Like

Can you show how to add the code to loaf_garages so i can save the lightbars, thanks

In the garage script you are using, find the function responsible for creating the car when you take it out of the garage. Add the car object as a parameter and use the export I provided.

exports.nakres_lightbar:loadLightbarInCar(vehicle);

Here’s an example from the qb-garages

Is there a way to make this work with luxart vehicle control?

How did you do this?

No, there’s already a custom siren control system within the script. To use it with an external script, you’ll need to make changes in both scripts.

May I ask how this saves? Where can I go through “saved sirens”? Thanks in advance

How do i add more lightbars? like custom ones for an example from D3lta Developtment Studios. Cause they won’t show up in the menu after installing them onto the server

@NnakresS i have added the export to qb-garages.
when i pull the vehicle out the garage i can activate the sirens but the lightbar wont load when spawning vehicle.
here is the code:

RegisterNetEvent(‘qb-garages:client:takeOutGarage’, function(data)
local type = data.type
local vehicle = data.vehicle
local garage = data.garage
local plate = data.plate
local stats = data.stats
QBCore.Functions.TriggerCallback(‘qb-garages:server:IsSpawnOk’, function(spawn)
if spawn then
local location = GetSpawnPoint(garage)
QBCore.Functions.TriggerCallback(‘qb-garages:server:spawnvehicle’, function(netId, properties)
while not DoesEntityExist(NetToVeh(netId)) do Wait(10) end
local veh = NetToVeh(netId)
QBCore.Functions.SetVehicleProperties(veh, properties)
exports[Config.FuelResource]:SetFuel(veh, vehicle.fuel)
TriggerServerEvent(‘qb-garages:server:updateVehicleState’, 0, plate)
TriggerEvent(‘vehiclekeys:client:SetOwner’, plate)
if Config.VisuallyDamageCars then doCarDamage(veh, stats, properties) end
SetVehicleEngineOn(veh, true, true, false)
exports.nakres_lightbar:loadLightbarInCar(vehicle);
end, plate, vehicle, location, true)
else
QBCore.Functions.Notify(Lang:t(‘error.not_depot’), ‘error’, 5000)
end
end, plate, type)
end)

You will find a JSON file within the script; the data is stored in JSON format along with the vehicle plate number.


add the name of the model you have added to the Value section enough to add it as an option under the select element in HTML

exports.nakres_lightbar:loadLightbarInCar(veh); → The variable sent should be ‘veh’ instead of ‘vehicle’; they represent different things.

RegisterNetEvent("qb-garages:client:takeOutGarage", function(data)
    local type = data.type
    local vehicle = data.vehicle
    local garage = data.garage
    local plate = data.plate
    local stats = data.stats
    QBCore.Functions.TriggerCallback("qb-garages:server:IsSpawnOk", function(spawn)
        if spawn then
            local location = GetSpawnPoint(garage)
            QBCore.Functions.TriggerCallback("qb-garages:server:spawnvehicle", function(netId, properties)
                while not DoesEntityExist(NetToVeh(netId)) do Wait(10) end
                local veh = NetToVeh(netId)
                QBCore.Functions.SetVehicleProperties(veh, properties)
                exports[Config.FuelResource]:SetFuel(veh, vehicle.fuel)
                TriggerServerEvent("qb-garages:server:updateVehicleState", 0, plate)
                TriggerEvent("vehiclekeys:client:SetOwner", plate)
                if Config.VisuallyDamageCars then doCarDamage(veh, stats, properties) end
                SetVehicleEngineOn(veh, true, true, false)
                exports.nakres_lightbar:loadLightbarInCar(veh);
            end, plate, vehicle, location, true)
        else
            QBCore.Functions.Notify(Lang:t("error.not_depot"), "error", 5000)
        end
    end, plate, type)
end)