GetSoundLength
How long one of your sound files plays.
Read from the file itself - no game needed. Use it to time what follows a line.
Syntax
Section titled “Syntax”GetSoundLength(file)| Parameter | Type | |
|---|---|---|
file |
string | the file’s path in the sounds folder |
Returns
Section titled “Returns”number - seconds; nil and the reason when the file cannot be played
Example
Section titled “Example”local seconds = GetSoundLength("elder_story.ogg")if seconds then SetTimer(function() SendClientMessage(pid, COLOR_GOLD, "The elder falls silent.") end, math.floor(seconds * 1000)) endSee also
Section titled “See also”PlayEntitySound · OnEntitySoundEnd · the Sound files group of the index
