Zyke Resources' Products
DiscordStore
  • Introduction
  • Common Issues
    • zyke_lib error
    • Lacking Entitlement
    • UI Not Working
    • Missing Files Via FTP
    • Resource Starting Sequence
    • Item Not Usable
    • Any other issues?
  • FAQ
  • Paid Resources
    • Consumables
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
      • Guides
      • Setup
    • Smoking
      • Resource Description
      • Config
      • Exports & Events
      • Examples
      • Dependencies
      • Changelog
      • Test Server
      • Setup
    • Garages
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
      • Setup
      • Common Issues
    • Drugdealer
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Crafting
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Plants
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Mugging
      • Resource Description
      • Config
      • Exports & Events
      • Changelog
    • Gangsystem
      • Resource Description
      • Config
      • Exports & Events
      • Examples
      • Dependencies
      • Changelog
  • Free Resources
    • Zyke Lib
      • Resource Description
      • Dependencies
      • Config
      • Setup
    • Status
      • Resource Description
      • Dependencies
      • Changelog
      • Setup
    • Propaligner
      • Resource Description
      • Exports & Events
      • Dependencies
      • Changelog
    • Vending Machines
      • Resource Description
      • Dependencies
      • Changelog
    • Sounds
      • Resource Description
      • Exports & Events
    • Key Minigame
      • Resource Description
      • Exports & Events
      • Changelog
    • Stabwheels
      • Resource Description
      • Dependencies
      • Changelog
    • Burncars
      • Resource Description
      • Dependencies
      • Changelog
    • Catalytic
      • Resource Description
      • Exports & Events
      • Config
      • Dependencies
      • Changelog
Powered by GitBook
On this page
  • Server Sided Exports
  • Play Sound On Entity
  • Stop Sound
  • Does File Exist
  • Does Sound Exist

Was this helpful?

  1. Free Resources
  2. Sounds

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:

---@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:

---@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:

---@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:

---@param fileName string
---@return boolean
exports["zyke_sounds"]:DoesSoundExist(fileName)
PreviousResource DescriptionNextKey Minigame

Last updated 25 days ago

Was this helpful?