Server-side exports
These functions should be used in the server script files.
API for playing audio
Play3DPos(source, uniqueId, position, distance, sound, volume, looped)
Play3DPos(source, uniqueId, position, distance, sound, volume, looped)
Arguments
Can't be empty - *
1
source*
1
2
uniqueId*
"uniqueName"
3
position*
vector3(123.0, 123.0, 123.0)
4
distance
50.0
5
sound*
6
volume (0.0-1.0)
1.0
7
looped
false
This export function plays a sound at a specified position.
Play3DEntity(source, entityNetId, distance, sound, volume, looped)
Play3DEntity(source, entityNetId, distance, sound, volume, looped)
Arguments
Can't be empty - *
1
source*
1
2
entityNetId*
NetworkGetNetworkIdFromEntity(PlayerPedId())
3
distance
50.0
4
sound*
5
volume (0.0-1.0)
1.0
6
looped
false
This export function plays a sound on a specified entity.
Returned data in Play3D*
function variable
Play3D*
function variableid
Sound unique id / name
string/number
entity
Entity ID
entity
url
The source/URL of the sound
string
volume
Sound volume (0.0-1.0)
number
distance
Max distance of the sound
number
position
Position of the sound player
vector3
loop
Looped or not
boolean
playedAt
Current timestamp of the video
number
destroyOnFinish
Will the sound element be destroyed on finish
boolean
Entity player data (Yellow) Player at a position data (White)
Audio manipulation API
soundVar.modify(source, field, newValue, secondValue)
soundVar.modify(source, field, newValue, secondValue)
Arguments
Can't be empty - *
1
source*
1
2
field*
"volume"
3
newValue*
1.0
4
secondValue
500 Fading time in miliseconds.
Modifiable fields
volume
number (0.0-1.0)
1.0
500 Fading time in miliseconds.
distance
number
50.0
None
position
vector3
vector3(123.0, 123.0, 123.0)
None
loop
boolean
true
None
timeStamp
number (seconds)
60
None
destroyOnFinish
boolean
true
None
This export function modifies the specified sound value.
soundVar.destroy(source)
soundVar.destroy(source)
Arguments
Can't be empty - *
1
source*
1
This export function destroys the sound element.
soundVar.replay(source)
soundVar.replay(source)
Arguments
Can't be empty - *
1
source*
1
This export function replays the sound from the beginning.
Other API functions
getSound(uniqueId)
getSound(uniqueId)
This export function gets the sound object.
getSoundData(uniqueId, field)
getSoundData(uniqueId, field)
This export function gets a specified data field of the sound object.
Last updated