onPurchaseFailed
Last updated
Last updated
exports['sd-shops']:registerClientHook('onPurchaseFailed', function(data)
-- Hide loading indicator
lib.hideTextUI()
-- Play error sound
PlaySoundFrontend(-1, 'ERROR', 'HUD_FRONTEND_DEFAULT_SOUNDSET', true)
-- Show error notification
lib.notify({
title = 'Purchase Failed',
description = data.reasonMessage,
type = 'error'
})
-- Handle specific failure reasons
if data.reason == 'insufficient_funds' then
print(('[PURCHASE] Not enough money. Need $%d'):format(data.cartTotal))
elseif data.reason == 'inventory_full' then
lib.notify({
description = 'Clear some inventory space and try again',
type = 'warning'
})
end
end)