Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Config.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
return {
Controls = {
PoliceLights = 'Q',
policeLights = 'Q',
policeHorn = 'E',
sirenToggle = 'LMENU',
sirenCycle = 'R',
},
addonHorns = {
[`firetruk`] = 'VEHICLES_HORNS_FIRETRUCK_WARNING'
},

addonSirens = {},
sirenShutOff = true -- Set to true if you want the siren to automatically shut off when the player exits the vehicle
}
}
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ If you wish to change any keybinds you can do so in the client.lua
- Place both resources into your server (make sure ox_lib is started before renewed sirensync)
- and enjoy :)

## Addon Sirens

If you have a server sided siren pack you can replace the sirens used in the `Config.lua`. You will need to add an entry for each model, for example:

```lua
addonSirens = {
[`police5`] = {
ref = 'VEHAUD_LSPD_NEW_SOUNDSET',
horn = 'VEHAUD_LSPD_NEW_HORN',
a = 'VEHAUD_LSPD_NEW_SIREN_ADAM',
b = 'VEHAUD_LSPD_NEW_SIREN_BOY',
c = 'VEHAUD_LSPD_NEW_SIREN_CHARLES'
}
}
```

## Credits

* [AvarianKnight](https://github.com/AvarianKnight) Original creator of PMA Sirensync.
* [BerkieBb](https://github.com/BerkieBb) Maintained PMA Sirensync.
* [BerkieBb](https://github.com/BerkieBb) Maintained PMA Sirensync.
27 changes: 20 additions & 7 deletions client.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Config = require 'Config'
local Config = lib.load('Config')

-- soundId Tables --
local sirenVehicles = {}
Expand Down Expand Up @@ -141,7 +141,7 @@ end)
local policeLights = lib.addKeybind({
name = 'policeLights',
description = 'Press this button to use your siren',
defaultKey = Config.Controls.PoliceLights,
defaultKey = Config.Controls.policeLights,
onPressed = function()
if not isVehAllowed() then return end

Expand Down Expand Up @@ -179,9 +179,15 @@ stateBagWrapper('horn', function(veh, value)
local soundId = GetSoundId()

hornVehicles[veh] = soundId
local soundName = Config.addonHorns[GetEntityModel(veh)] or 'SIRENS_AIRHORN'
local modelName = GetEntityModel(veh)
local audioRef, soundName, addonSiren = 0, Config.addonHorns[modelName] or 'SIRENS_AIRHORN', Config.addonSirens[modelName]

PlaySoundFromEntity(soundId, soundName, veh, 0, false, 0)
if addonSiren then
audioRef = addonSiren.ref
soundName = addonSiren.horn
end

PlaySoundFromEntity(soundId, soundName, veh, audioRef, false, 0)
end)

local policeHorn = lib.addKeybind({
Expand Down Expand Up @@ -235,13 +241,20 @@ stateBagWrapper('sirenMode', function(veh, soundMode)

local soundId = GetSoundId()
sirenVehicles[veh] = soundId
local audioRef, addonSiren = 0, Config.addonSirens[GetEntityModel(veh)]
local soundA, soundB, soundC = 'VEHICLES_HORNS_SIREN_1', 'VEHICLES_HORNS_SIREN_2', 'VEHICLES_HORNS_POLICE_WARNING'

if addonSiren then
audioRef = addonSiren.ref
soundA, soundB, soundC = addonSiren.a, addonSiren.b, addonSiren.c
end

if soundMode == 1 then
PlaySoundFromEntity(soundId, 'VEHICLES_HORNS_SIREN_1', veh, 0, false, 0)
PlaySoundFromEntity(soundId, soundA, veh, audioRef, false, 0)
elseif soundMode == 2 then
PlaySoundFromEntity(soundId, 'VEHICLES_HORNS_SIREN_2', veh, 0, false, 0)
PlaySoundFromEntity(soundId, soundB, veh, audioRef, false, 0)
elseif soundMode == 3 then
PlaySoundFromEntity(soundId, 'VEHICLES_HORNS_POLICE_WARNING', veh, 0, false, 0)
PlaySoundFromEntity(soundId, soundC, veh, audioRef, false, 0)
end
end)

Expand Down