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
openMenu
hookThis 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
ornil
boombox:
number
ornil
fromType:
string
ornil
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
createSound
hookThis 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
ornil
boombox:
number
ornil
fromType:
string
ornil
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)
Last updated