EvoLabs
  • 👋Welcome
  • Scripts
    • 🔊evo_sound
      • Installation
      • Config
      • Exports
      • Sync System
    • 🔉evo_sound_player
      • Installation
      • Config
      • Exports
      • Hooks (client-side only)
Powered by GitBook
On this page
  • openMenu hook
  • createSound hook
  1. Scripts
  2. evo_sound_player

Hooks (client-side only)

You can use this feature to execute code on some events and modify the script behaviour.

Use RegisterHook export to add a hook and RemoveHook or RemoveResourceHooks exports to remove a hook

openMenu hook

This hook will be triggered when the user opens the sound player UI. The payload sent to the hook function will contain:

  • type: 'carRadio' or 'boombox' or 'zone'

  • vehicle: number or nil

  • boombox: number or nil

  • fromType: string or nil

By returning false, the action will be canceled

Example:

local hookId = exports["evo_sound_player"]:RegisterHook('openMenu', function(payload)
    print('Triggered openMenu hook.')
    print(' - Type: ', payload.type)
    print(' - Vehicle: ', payload.vehicle)
    print(' - Boombox: ', payload.boombox)
    print(' - Zone: ', payload.zone)

    return true
end)

createSound hook

This hook will be triggered when the user starts playing a sound The payload sent to the hook function will contain:

  • type: 'carRadio' or 'boombox' or 'zone'

  • vehicle: number or nil

  • boombox: number or nil

  • fromType: string or nil

By returning false, the action will be canceled

Example:

local hookId = exports["evo_sound_player"]:RegisterHook('createSound', function(payload)
    print('Triggered createSound hook.')
    print(' - Type: ', payload.type)
    print(' - Vehicle: ', payload.vehicle)
    print(' - Boombox: ', payload.boombox)
    print(' - Zone: ', payload.zone)

    return true
end)
PreviousExports

Last updated 7 months ago

🔉