Jump to content

Help remove the siren sound when you turn it on.


Lenz

Recommended Posts

Posted
function removePoliceSirens()
    local policeCars = {523, 596, 597, 598, 599, 327}
    for i, id in ipairs(policeCars) do
        local vehicle = getVehicleByID(id)
        if vehicle then
            removeVehicleSirens(vehicle)
            addVehicleSirens(vehicle, 2, 1, false, false, false, true)
        end
    end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), removePoliceSirens)

That's the first thing that popped into my head. But it didn't help. I need to completely remove the sound of the standard GTA siren. Since I'm using the custom one.

Posted
8 minutes ago, Lenz said:
function removePoliceSirens()
    local policeCars = {523, 596, 597, 598, 599, 327}
    for i, id in ipairs(policeCars) do
        local vehicle = getVehicleByID(id)
        if vehicle then
            removeVehicleSirens(vehicle)
            addVehicleSirens(vehicle, 2, 1, false, false, false, true)
        end
    end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), removePoliceSirens)

That's the first thing that popped into my head. But it didn't help. I need to completely remove the sound of the standard GTA siren. Since I'm using the custom one.

Hello @Lenz 
 

function removePoliceSirens()
    local policeCars = {523, 596, 597, 598, 599, 327}
    for i, id in ipairs(policeCars) do
        local vehicle = getVehicleByID(id)
        if vehicle and getVehicleType(vehicle) == "Automobile" then
            setVehicleSirensOn(vehicle, false)
            addVehicleSirens(vehicle, 1, 2, true, false, true, false)
        end
    end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), removePoliceSirens)

 

Posted

I made a mistake in getVehicleByID(id).

function removePoliceSirens()
    local policeCars = {523, 596, 597, 598, 599, 327}
    for i, id in ipairs(policeCars) do
        local vehicle = getElementByID("vehicle_" .. id)
        if vehicle and getElementType(vehicle) == "vehicle" and getVehicleType(vehicle) == "Automobile" then
            setVehicleSirensOn(vehicle, false)
            addVehicleSirens(vehicle, 1, 2, true, false, true, true)
        end
    end
end
addEventHandler("onResourceStart", resourceRoot, removePoliceSirens)


Fixed it, but the result is the same.

Posted
function removePoliceSirens()
    local policeCars = getElementsByType("vehicle", root)
    for i, vehicle in ipairs(policeCars) do
        local model = getElementModel(vehicle)
        if model == 523 or model == 596 or model == 597 or model == 598 or model == 599 or model == 327 then
            setVehicleSirensOn(vehicle, false)
            -- addVehicleSirens(vehicle, 1, 2, true, false, true, true)
        end
    end
end
addEventHandler("onResourceStart", resourceRoot, removePoliceSirens)

Try this one 
Ive removed addVehicleSirens line

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...