Hello, i’ve been trying to get my self into the Fivem scripting(since modding the base game is like shooting your on foot). I got some code working super ok but now i’m having A LOT of trouble in the sound part.
For some reason the game just doesnt find or recognizes the audio files that i just referenced on the manifest and requested on the code.
For the sake of organization i made a simple script just to play a sound as soon as the code is started.
Here’s the manifest:
fx_version 'cerulean'
game 'gta5'
client_scripts {
'client/client.lua'
}
files {
'stream/*ogg'
}
data_file 'AUDIO_WAVEPACK' 'stream/snd_01'
And here’s the client.lua code i made
Citizen.CreateThread(function ()
Wait(0)
local snd_id = GetSoundId()
RequestScriptAudioBank("AUDIO_WAVEPACK", false)
LoadStream("snd_01","AUDIO_WAVEPACK")
PlaySound(snd_id, "snd_01", "AUDIO_WAVEPACK", true, 0, true)
end)
The code just don’t recognizes it for some unknown reason. i’ve searched some third party library who makes that possible, but they don’t work as intended (Either the sound doesnt play or plays without being in a 3D space).
If any one can help me with this i would be very happy. Like explaining the nuances of the function or how the game regonizes the files, anything that i should know in order to do this propelly.
Thanks in advance