Advertisement
Guest User

[ACTION] Buy item with other item

a guest
Feb 4th, 2013
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. function onUse(cid, item)
  2.  
  3. local itemWin, itemWinCount = 2394, 10
  4. local itemRemove, itemRemoveCount = 2160, 10
  5. local messageBuy = "You have purchased " .. itemWinCount .. " " .. getItemNameById(itemWin) .. "."
  6. local messageNoHaveItem = "Sorry, you need " .. itemRemoveCount .. " " .. getItemNameById(itemRemove) .. " to buy this."
  7.  
  8. if doPlayerRemoveItem(cid, itemRemove, itemRemoveCount) then
  9.      doPlayerSendTextMessage(cid, 27, messageBuy)
  10.          doPlayerAddItem(cid, itemWin, itemWinCount)
  11.             doSendMagicEffect(getThingPos(cid), math.random(28, 30)
  12.                else
  13.                    doPlayerSendCancel(cid, messageNoHaveItem)
  14.                    doSendMagicEffect(getThingPos(cid), 9)
  15.                end
  16.     return true
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement