onLoyaltyRewardClaimed
Last updated
Last updated
exports['sd-shops']:registerClientHook('onLoyaltyRewardClaimed', function(data)
-- Play reward sound
PlaySoundFrontend(-1, 'MEDAL_UP', 'HUD_MINI_GAME_SOUNDSET', true)
-- Show reward notification
lib.notify({
title = 'Reward Claimed!',
description = ('%s for %d points'):format(data.rewardName, data.pointsCost),
type = 'success'
})
-- Show coupon code if it's a coupon reward
if data.rewardType == 'coupon' and data.couponCode then
lib.notify({
title = 'Your Coupon Code',
description = data.couponCode,
type = 'inform',
duration = 10000
})
end
-- Log points update
print(('[LOYALTY] Claimed %s: %d -> %d points'):format(
data.rewardName, data.previousPoints, data.remainingPoints
))
end)