dominique120

Untitled

Jan 28th, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. local config = {
  2.     itemOrg = 5432 --Item id of the item that is going to be used
  3.     itemAdd = 1234 --Item id of the item that will be added
  4.     itemRem = 9876 --Item id of the item that will be removed, considering it is a specific item
  5. }
  6.  
  7. function onUse(cid, item, toPosition, itemEx, fromPosition)
  8.     for i,v in pairs(config) do
  9.         if itemEx.itemid == i then
  10.             doPlayerAddItem(cid, config.itemAdd, 1)
  11.             doRemoveItem(config.itemOrg, 1)
  12.             doRemoveItem(cid, config.itemRem, 1)
  13.             doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
  14.             doSendAnimatedText(fromPosition, "Congratz!", COLOR_GREEN)      
  15.             doPlayerSendCancel(cid,"Successfully Crafted!")
  16.         elseif
  17.         not(itemEx.itemid) == i then
  18.             doPlayerSendCancel(cid,"Sorry This item cannot be crafted.")
  19.             doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  20.         end
  21.     end
  22.     return true
  23. end
Advertisement
Add Comment
Please, Sign In to add comment