Scripts/resources/[standalone]/RageUI/components/Audio.lua

36 lines
767 B
Lua
Raw Normal View History

2024-12-29 20:02:43 +00:00
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Dylan Malandain.
--- DateTime: 24/07/2019 03:38
---
---PlaySound
---
--- Reference : N/A
---
---@param Library string
---@param Sound string
---@param IsLooped boolean
---@return nil
---@public
function RageUI.PlaySound(Library, Sound, IsLooped)
local audioId
if not IsLooped then
PlaySoundFrontend(-1, Sound, Library, true)
else
if not audioId then
CreateThread(function()
audioId = GetSoundId()
PlaySoundFrontend(audioId, Sound, Library, true)
Wait(0.01)
StopSound(audioId)
ReleaseSoundId(audioId)
audioId = nil
end)
end
end
end