- FiveM: Works out of the box.
- RedM: Should work out of the box but since I can't test it out, if someone find any errors just open a ticket on our discord.
- Stop/Pause: Stop or Pause an audio thats already playing its not supported.
- Loop: Looping an audio is not supported.
Nah I just went through Manason code and adapt it for my own needs and likings, also I wanted to expand this to RedM soo yea, Ill leave the repo of his audio api bellow.
1. If you never worked with native audio before i advice you to check this FiveM Forum Thread.
2. You'll need a tool like the one below or just make everything on your own from scratch 🤓.
3. After you're done with you're files, create a new folder in audios folder with you're native audio content. The scructure of the audios folder should be as bellow.
/audios
/newAudioFolder1
/audiodirectory
/data
/newAudioFolder2
/audiodirectory
/data
/newAudioFolder3
/audiodirectory
/data
Plays an audio not located within the 3D world.
exports.pf_audio:PlayAudio({
bank = 'example_audiobank',
soundset = 'example_soundset'
name = 'example_audio'
})
Plays an audio from a specific coordinate located within the 3D world.
exports.pf_audio:PlayAudioFromCoords({
bank = 'example_audiobank',
soundset = 'example_soundset'
name = 'example_audio',
coords = vec3(0, 0, 0),
range = 10
})
Plays an audio from a specific entity located within the 3D world.
exports.pf_audio:PlayAudioFromEntity({
bank = 'example_audiobank',
soundset = 'example_soundset'
name = 'example_audio',
entity = PlayerPedId()
})
Plays an audio not located within the 3D world for a specific client or to all clients.
-- Specify the player source or leave it -1 to play the audio for all the clients.
exports.pf_audio:PlayAudio(source, {
bank = 'example_audiobank',
soundset = 'example_soundset'
name = 'example_audio'
})
Plays an audio from a specific coordinate located within the 3D world to all clients.
exports.pf_audio:PlayAudioFromCoords({
bank = 'example_audiobank',
soundset = 'example_soundset'
name = 'example_audio',
coords = vec3(0, 0, 0),
range = 10
})
Plays an audio from a specific entity located within the 3D world to all clients.
exports.pf_audio:PlayAudioFromEntity({
bank = 'example_audiobank',
soundset = 'example_soundset'
name = 'example_audio',
entity = GetPlayerPed(1)
})