diff --git a/audio/data/oxdoorlock_sounds.dat54.rel b/audio/data/oxdoorlock_sounds.dat54.rel
new file mode 100644
index 00000000..d1229f2b
Binary files /dev/null and b/audio/data/oxdoorlock_sounds.dat54.rel differ
diff --git a/audio/data/oxdoorlock_sounds.dat54.rel.xml b/audio/data/oxdoorlock_sounds.dat54.rel.xml
new file mode 100644
index 00000000..519e0a72
--- /dev/null
+++ b/audio/data/oxdoorlock_sounds.dat54.rel.xml
@@ -0,0 +1,145 @@
+
+
+
+
+ - dlc_oxdoorlock\oxdoorlock
+
+
+
+ -
+ button_remote_simple
+
+ dlc_oxdoorlock/oxdoorlock
+ button_remote
+
+
+
+ -
+ door_bolt_simple
+
+ dlc_oxdoorlock/oxdoorlock
+ door_bolt
+
+
+
+ -
+ metal_locker_simple
+
+ dlc_oxdoorlock/oxdoorlock
+ metal_locker
+
+
+
+ -
+ metallic_creak_simple
+
+ dlc_oxdoorlock/oxdoorlock
+ metallic_creak
+
+
+
+
+
+
+ -
+ dlc_oxdoorlock_set
+
+
+
-
+ button_remote
+ button_remote_directional
+
+ -
+ door_bolt
+ door_bolt_directional
+
+ -
+ metal_locker
+ metal_locker_directional
+
+ -
+ metallic_creak
+ metallic_creak_directional
+
+
+
+
+ -
+ button_remote_directional
+
+ button_remote_simple
+
+
+
+
+
+
+
+ -
+ door_bolt_directional
+
+ door_bolt_simple
+
+
+
+
+
+
+
+ -
+ metal_locker_directional
+
+ metal_locker_simple
+
+
+
+
+
+
+
+ -
+ metallic_creak_directional
+
+ metallic_creak_simple
+
+
+
+
+
+
+
+
diff --git a/audio/dlc_oxdoorlock/oxdoorlock.awc b/audio/dlc_oxdoorlock/oxdoorlock.awc
new file mode 100644
index 00000000..1b5ef2b8
Binary files /dev/null and b/audio/dlc_oxdoorlock/oxdoorlock.awc differ
diff --git a/audio/dlc_oxdoorlock/oxdoorlock.awc.xml b/audio/dlc_oxdoorlock/oxdoorlock.awc.xml
new file mode 100644
index 00000000..112836d2
--- /dev/null
+++ b/audio/dlc_oxdoorlock/oxdoorlock.awc.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+ -
+ button_remote
+ button_remote.wav
+
+
-
+ peak
+
+ -
+ data
+
+ -
+ format
+ ADPCM
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ door_bolt
+ door_bolt.wav
+
+
-
+ peak
+
+ -
+ data
+
+ -
+ format
+ ADPCM
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ metal_locker
+ metal_locker.wav
+
+
-
+ peak
+
+ -
+ data
+
+ -
+ format
+ ADPCM
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ metallic_creak
+ metallic_creak.wav
+
+
-
+ peak
+
+ -
+ data
+
+ -
+ format
+ ADPCM
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/audio/dlc_oxdoorlock/oxdoorlock/button_remote.wav b/audio/dlc_oxdoorlock/oxdoorlock/button_remote.wav
new file mode 100644
index 00000000..1bcd010c
Binary files /dev/null and b/audio/dlc_oxdoorlock/oxdoorlock/button_remote.wav differ
diff --git a/audio/dlc_oxdoorlock/oxdoorlock/door_bolt.wav b/audio/dlc_oxdoorlock/oxdoorlock/door_bolt.wav
new file mode 100644
index 00000000..a27e3251
Binary files /dev/null and b/audio/dlc_oxdoorlock/oxdoorlock/door_bolt.wav differ
diff --git a/audio/dlc_oxdoorlock/oxdoorlock/metal_locker.wav b/audio/dlc_oxdoorlock/oxdoorlock/metal_locker.wav
new file mode 100644
index 00000000..dc640352
Binary files /dev/null and b/audio/dlc_oxdoorlock/oxdoorlock/metal_locker.wav differ
diff --git a/audio/dlc_oxdoorlock/oxdoorlock/metallic_creak.wav b/audio/dlc_oxdoorlock/oxdoorlock/metallic_creak.wav
new file mode 100644
index 00000000..a2bff3a9
Binary files /dev/null and b/audio/dlc_oxdoorlock/oxdoorlock/metallic_creak.wav differ
diff --git a/client/main.lua b/client/main.lua
index 5756bd27..932d27d9 100644
--- a/client/main.lua
+++ b/client/main.lua
@@ -175,17 +175,29 @@ RegisterNetEvent('ox_doorlock:setState', function(id, state, source, data)
end
if door.state == state and door.distance and door.distance < 20 then
- local volume = (0.01 * GetProfileSetting(300)) / (door.distance / 2)
- if volume > 1 then volume = 1 end
- local sound = state == 0 and door.unlockSound or door.lockSound or 'door-bolt-4'
-
- SendNUIMessage({
- action = 'playSound',
- data = {
- sound = sound,
- volume = volume
- }
- })
+ local useNativeAudio = GetConvarInt('doorlock:nativeaudio', 1) == 1
+
+ if useNativeAudio then
+ RequestScriptAudioBank('dlc_oxdoorlock/oxdoorlock', false)
+ local sound = state == 0 and door.unlockSound or door.lockSound or 'door_bolt'
+ local soundId = GetSoundId()
+
+ PlaySoundFromCoord(soundId, sound, door.coords.x, door.coords.y, door.coords.z, 'DLC_OXDOORLOCK_SET', true, 0, false)
+ ReleaseSoundId(soundId)
+ ReleaseNamedScriptAudioBank('dlc_oxdoorlock/oxdoorlock')
+ else
+ local volume = (0.01 * GetProfileSetting(300)) / (door.distance / 2)
+ if volume > 1 then volume = 1 end
+ local sound = state == 0 and door.unlockSound or door.lockSound or 'door-bolt-4'
+
+ SendNUIMessage({
+ action = 'playSound',
+ data = {
+ sound = sound,
+ volume = volume
+ }
+ })
+ end
end
end)
diff --git a/fxmanifest.lua b/fxmanifest.lua
index b980ac3f..28a455a3 100644
--- a/fxmanifest.lua
+++ b/fxmanifest.lua
@@ -34,9 +34,14 @@ ui_page 'web/build/index.html'
files {
'web/build/index.html',
'web/build/**/*',
- 'locales/*.json'
+ 'locales/*.json',
+ 'audio/data/oxdoorlock_sounds.dat54.rel',
+ 'audio/dlc_oxdoorlock/oxdoorlock.awc',
}
+data_file 'AUDIO_WAVEPACK' 'audio/dlc_oxdoorlock'
+data_file 'AUDIO_SOUNDDATA' 'audio/data/oxdoorlock_sounds.dat'
+
dependencies {
'oxmysql',
'ox_lib',
diff --git a/server/main.lua b/server/main.lua
index b99e4613..5e5c43e2 100644
--- a/server/main.lua
+++ b/server/main.lua
@@ -100,7 +100,12 @@ exports('editDoor', function(id, data)
end
end)
-local sounds = require 'server.utils'.getFilesInDirectory('web/build/sounds', '%.ogg')
+local useNativeAudio = GetConvarInt('doorlock:nativeaudio', 1) == 1
+
+local soundDirectory = useNativeAudio and 'audio/dlc_oxdoorlock/oxdoorlock' or 'web/build/sounds'
+local fileFormat = useNativeAudio and '%.wav' or '%.ogg'
+
+local sounds = require 'server.utils'.getFilesInDirectory(soundDirectory, fileFormat)
local function createDoor(id, door, name)
local double = door.doors