Client
Client hooks in hooks/client.lua.
Register these in hooks/client.lua. See Hooks for how gates, filters and notifies work.
Client hooks aren't a security boundary. Anything involving money is checked again on the server.
Opening and closing
canOpen
Gate. May the store open? Runs after the built-in checks (the store exists, the player is on foot), before the server is asked for anything. Return false, code to show the player a message, or just false to refuse silently.
- storeId:
string - store:
table— the store's config block
Hooks.on('canOpen', function(storeId, store)
if IsEntityDead(cache.ped) or LocalPlayer.state.isEscorted then
return false, 'no_access'
end
end)opened
Notify. The store UI is fully open.
- storeId:
string - store:
table
Hooks.on('opened', function(storeId, store)
exports.my_hud:hide()
end)closed
Notify. The player has left the store. Their camera and clothes are already restored.
- storeId:
string - keptLook:
boolean—trueif they walked out in something they bought
Hooks.on('closed', function(storeId, keptLook)
exports.my_hud:show()
end)The fitting room
worn
Notify. Fires on every try-on, owned or not.
- outfitId:
string - outfit:
table—{ id, label, gender, owned, data }
Hooks.on('worn', function(outfitId, outfit)
print(('trying on %s'):format(outfit.label))
end)Don't save appearance from here — the player might not own it, and their clothes are put back when they leave. Use woreOut.
woreOut
Notify. They left wearing an outfit they own, and the server has confirmed it. Save appearance from here. It doesn't fire when they leave in the clothes they arrived in.
- outfitId:
string— catalog id of the outfit they walked out in - worn:
table— the slots read off the ped,{ components, props }(seerw_fashion:outfitApplied)
Hooks.on('woreOut', function(outfitId, worn)
TriggerServerEvent('my_appearance:save', worn)
end)The rw_fashion:outfitApplied event fires at the same moment, for other resources.