[Release] Disable siren-sound

That worked perfectly. Thanks!

This is still not working, at least not for me. Anyone have any suggestions?

Did you try the suggestion above? Works for me.

Yes, I think so, but apperantly have I missed something.
Can someone (that is really nice) post the code that works here? That would be great. :slight_smile:

Can someone please post their code here for both the client and server?

I’ve updated the code, should work fine.

Just tried it, and it doesn’t work for me. The fix provided by @Cosmo is what is currently working for me. Both __resource.lua and server.lua are correct, but client.lua is as follows:

function MyPed()
   return GetPlayerPed(-1)
end

SirenToggle = false
Citizen.CreateThread(function()
while true do
    Citizen.Wait(0)
	if IsControlJustPressed(1, 58) then -- G
            if IsPedInAnyVehicle(MyPed(), false) then
                Vehicle = GetVehiclePedIsUsing(MyPed())
				if GetPedInVehicleSeat(Vehicle, -1) == MyPed()then                      
                    if SirenToggle then                 
                        PlaySoundFrontend(-1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1)
                        SirenToggle = false
                        TriggerServerEvent('SilentSiren', SirenToggle)
                    else                                        
                        PlaySoundFrontend(-1, "NAV_LEFT_RIGHT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1)
                        SirenToggle = true
                        TriggerServerEvent('SilentSiren', SirenToggle)
                    end
                end
            end
        end
end
end)

-- Called by server to disable siren on any target vehicle
RegisterNetEvent('updateSirens')
AddEventHandler('updateSirens', function(PID, Toggle)
            local Veh = GetVehiclePedIsIn(GetPlayerPed(GetPlayerFromServerId(PID)), false)
            DisableVehicleImpactExplosionActivation(Veh, Toggle)
end)
1 Like

How do you install it

Holy necro batman!

I believe this was wrote for CitizenMP the previous version of FiveM - it’s now using FXServer.

Though by the looks of the thread previously, this didn’t work as intended originally, I’d recommend using Luxart Vehicle Control instead, you can find it here.