Advertisement
Guest User

have?

a guest
Jul 13th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. local config = {
  2.  
  3.     [1445] = {
  4.  
  5.         str = 264017, -- Storage
  6.         uses = 2, -- Quantas vezes pode usar o barril
  7.         flask = 7636, -- ID flask
  8.         potion = 7618 -- ID potion
  9.     },
  10.     [3365] = {
  11.  
  12.         str = 264028,
  13.         uses = 2,
  14.         flask = 7636,
  15.         potion = 7620
  16.     }
  17. }
  18.  
  19. function onUse(cid, item, fromPosition, itemEx, toPosition)
  20.  
  21. local barrel = config[item.itemid]
  22.     if barrel then
  23.         if getPlayerStorageValue(cid, barrel.str) < barrel.uses then
  24.             local flasks = getPlayerItemCount(cid, barrel.flask)
  25.             if flasks > 0 then
  26.                 doPlayerRemoveItem(cid, barrel.flask, flasks)
  27.                 doPlayerAddItem(cid, barrel.potion, flasks)
  28.                 setPlayerStorageValue(cid, barrel.str, (getPlayerStorageValue(cid, barrel.str) + 1))
  29.             else
  30.                 doPlayerSendTextMessage(cid, 27, "You don't have empty potion flasks.")
  31.             end
  32.         else
  33.             doPlayerSendTextMessage(cid, 23, "It is empty.")
  34.         end
  35.     end
  36.     return true
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement