CS_AK

rewards.lua

Dec 14th, 2025 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. CS.addReward = function(player, reward, cb) -- you will get all options from the specified item in "Config.rewards"
  2.   if reward.type == "item" then
  3.  
  4.     if not player.canCarryItem(reward.name, reward.amount) then
  5.       return CS.send_notify(player.source, Config.Locales["notifications"]["cannot_carry"]) -- The treasure will not be collected because the player cannot carry the item.
  6.     end
  7.  
  8.     player.addInventoryItem(reward.name, reward.amount)
  9.  
  10.   elseif reward.type == "money" then
  11.     player.addAccountMoney(reward.account, reward.amount)
  12.  
  13.   elseif reward.type == "vehicle" then
  14.     player.addVehicle(reward)
  15.   end
  16.  
  17.   cb() -- Dont touch this, this callback will be triggered after the reward was added successfully, otherwise the treasure will not be collected.
  18. end
Advertisement
Add Comment
Please, Sign In to add comment