Client-side exports
These functions should be used in the client script files.
Last updated
These functions should be used in the client script files.
Last updated
Play3DPos(uniqueId, position, distance, sound, volume, looped)
Can't be empty - *
Argument number | Argument name | Example value |
---|---|---|
This export function plays a sound at a specified position.
Play3DEntity(entityNetId, distance, sound, volume, looped)
Can't be empty - *
This export function plays a sound on a specified entity
Play3D*
function variableEntity player data (Yellow) Player at a position data (White)
soundVar.addEventListener(event, callback)
Can't be empty - *
This export function adds event listeners to the audio element.
soundVar.modify(field, newValue, secondValue)
Can't be empty - *
This export function modifies the given sound value.
soundVar.destroy()
This export function destroys the sound element.
soundVar.replay()
This export function replays the audio from the beginning.
getSound(uniqueId)
This export function gets the sound object.
getSoundData(uniqueId, field)
This export function gets a specified data field of the sound object.
Argument number | Argument name | Example value |
---|---|---|
Field | Description | Type |
---|---|---|
Argument number | Argument name | Example value |
---|---|---|
Event name | Description |
---|---|
Argument number | Argument name | Example value |
---|---|---|
Field | Type | Example value | Example second value |
---|---|---|---|
1
uniqueId*
"uniqueName"
2
position*
vector3(123.0, 123.0, 123.0)
3
distance
50.0
4
sound*
"fileName" OR "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
5
volume (0.0-1.0)
1.0
6
looped
false
1
entityNetId*
NetworkGetNetworkIdFromEntity(PlayerPedId())
2
distance
50.0
3
sound*
"fileName" OR "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
4
volume (0.0-1.0)
1.0
5
looped
false
id
Sound unique id / name
string/number
entity
Entity ID
entity
url
The source/URL of the sound
string
playing
Is the sound playing & loaded
boolean
volume
Sound volume (0.0-1.0)
number
distance
Max distance of the sound
number
position
Position of the sound player
vector3
vehicle
Is entity a vehicle
boolean
loop
Looped or not
boolean
timeStamp
Current timestamp of the video
number
duration
Audio duration in seconds
number
destroyOnFinish
Will the sound element be destroyed on finish
boolean
isConvertible
If entity is a vehicle, is it a convertible
boolean
vehicleClass
If entity is a vehicle, returns it's class
number
doorCount
If entity is a vehicle, returns it's door count
number
1
event*
"onPlay"
2
callback*
function() return true end
onPlay
Gets triggered when the sound is fully loaded and starts playing.
onFinished
Gets triggered when the sound finishes playing.
onCreated
Gets triggered right after the sound is created.
onPause
Gets triggered when the sound gets paused (most often with a function)
onResume
nGets triggered when the sound gets resumed (most often with a function)
1
field*
"volume"
2
newValue*
1.0
3
secondValue
500 Fading time in miliseconds.
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