onGiftReceived
Purpose
When It Triggers
Parameters
Parameter
Type
Description
Example
exports['sd-shops']:registerClientHook('onGiftReceived', function(data)
-- Play receive sound
PlaySoundFrontend(-1, 'MEDAL_UP', 'HUD_MINI_GAME_SOUNDSET', true)
-- Build item list
local itemList = {}
for _, item in ipairs(data.items) do
table.insert(itemList, ('%dx %s'):format(item.quantity, item.label))
end
-- Show gift notification
lib.notify({
title = 'Gift Received!',
description = ('%s sent you: %s'):format(data.senderName, table.concat(itemList, ', ')),
type = 'success',
duration = 10000
})
-- Log received gift
print(('[GIFT] Received gift from %s: %s'):format(
data.senderName, table.concat(itemList, ', ')
))
end)Last updated