Skip to content

Manason/mana_audio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mana_audio

API for playing native audio. Stopping audio early or looping are not supported.

Thanks to PrinceAlbert, Demi-Automatic, ChatDisabled, Joe Szymkowicz, and Zoo

ko-fi

Client

PlaySound

Plays a sound not located within the 3D world

exports.mana_audio:PlaySound({
    audioBank = 'myAudioBank',
    audioName = {'myAudioName1', 'myAudioName2'},
    audioRef = 'myAudioRef'
})

PlaySoundFromEntity

Plays a sound originating from an entity

exports.mana_audio:PlaySoundFromEntity({
    audioBank = 'myAudioBank',
    audioName = {'myAudioName1', 'myAudioName2'},
    audioRef = 'myAudioRef',
    entity = PlayerPedId()
})

PlaySoundFromCoords

Plays a sound originating from coordinates

exports.mana_audio:PlaySoundFromCoords({
    audioBank = 'myAudioBank',
    audioName = {'myAudioName1', 'myAudioName2'},
    audioRef = 'myAudioRef',
    coords = vec3(0, 0, 0),
    range = 10,
})

Server

PlaySound

Plays a sound not located within the 3D world to the given client or -1 for all clients

exports.mana_audio:PlaySound(-1, {
    audioBank = 'myAudioBank',
    audioName = {'myAudioName1', 'myAudioName2'},
    audioRef = 'myAudioRef'
})

PlaySoundFromEntity

Plays a sound originating from an entity to all clients

exports.mana_audio:PlaySoundFromEntity({
    audioBank = 'myAudioBank',
    audioName = {'myAudioName1', 'myAudioName2'},
    audioRef = 'myAudioRef',
    entity = GetPlayerPed(1)
})

PlaySoundFromCoords

Plays a sound originating from coordinates to all clients in range

exports.mana_audio:PlaySoundFromCoords({
    audioBank = 'myAudioBank',
    audioName = {'myAudioName1', 'myAudioName2'},
    audioRef = 'myAudioRef',
    coords = vec3(0, 0, 0),
    range = 10,
})