Exports & Events
All exports and events available to integrate this resource into others.
#Server Sided Exports
#Play Sound On Entity
This export will play a sound on an entity, and regulate the volume based on your distance from it. It is dynamic and keeps following the entity.
Example:lua---@param entity integer ---@param id? string @Only needed if you want to manually stop the sound ---@param soundName string | string[] @Sound name, or list of them, will choose randomly from list every time PlaySound(JS) executes ---@param maxVolume number @0.0-1.0, the max volume for the sound, usually ~0.2 ---@param maxDistance number @0.0-x, the max distance to hear your sound, usually ~2.0 ---@param looped boolean | number | {[1]: number, [2]: number} @Basic looping, loop with time between, loop with random time between ---@param playCount? integer @If not looping, you can decide how many times the audio will play ---@return string @Sound id exports["zyke_sounds"]:PlaySoundOnEntity(entity, id, soundName, maxVolume, maxDistance, looped, playCount)
#Stop Sound
Manually stop a sound playing. Allows you to fade it out or keep playing it until it ends. We do un-register the audio when fading or forcing the full to be played, so the same id can be re-used.
Example:lua---@param soundId string ---@param fade? number @In milliseconds, how long to fade the sound out for to avoid abrupt interruption ---@param forceFull? boolean @Force the audio to play out fully instead of cutting off, ignores fade exports["zyke_sounds"]:StopSound(soundId, fade, forceFull)
#Does File Exist
Verify the existence of the sound file in zyke_sounds. This is more expensive than DoesSoundExist since we are fetching the actual file instead of a quick table lookup.
Example:lua---@param fileName string ---@return boolean exports["zyke_sounds"]:DoesFileExist(fileName)
#Does Sound Exist
Lightweight export to quickly validate if a sound has been loaded into memory on script start.
Example:lua---@param fileName string ---@return boolean exports["zyke_sounds"]:DoesSoundExist(fileName)
