Advertisement
LuckOake

Multifunctional Rune

Jan 23rd, 2013
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. function onUse(cid, item, fromPosition, itemEx, toPosition)
  2.     local access = 3 -- Acesso mínimo para usar a rune
  3.     local storage,stor2,stor3 = 5829,4982,4983
  4.     local stor = getPlayerStorageValue(cid, storage) == -1 and 0 or getPlayerStorageValue(cid, storage)
  5.    
  6.     if getPlayerAccess(cid) < access then
  7.         doPlayerSendCancel(cid, "Not enough access.") return true
  8.     elseif itemEx.uid == cid then
  9.         setPlayerStorageValue(cid, storage, stor == 3 and 0 or stor+1)
  10.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Function "..(stor == 0 and "Copy" or stor == 1 and "Cut" or stor == 2 and "Delete" or stor == 3 and "Paste").." actived.") return true
  11.     elseif isCreature(itemEx.uid) then
  12.         doPlayerSendCancel(cid, "You may only use this rune on items.") return true
  13.     elseif stor == 0 then
  14.         doPlayerSendCancel(cid, "Item copied.")
  15.     elseif stor == 1 then
  16.         doRemoveItem(itemEx.uid, itemEx.count)
  17.         doPlayerSendCancel(cid, "Item cutted.")
  18.     elseif stor == 2 then
  19.         doRemoveItem(itemEx.uid, itemEx.count)
  20.         doPlayerSendCancel(cid, "Item deleted.")
  21.         return true
  22.     elseif stor == 3 then
  23.         if getPlayerStorageValue(cid, stor2) < 1 then
  24.             doPlayerSendCancel(cid, "You must copy or cut something before pasting.") return true
  25.         end
  26.         doCreateItem(colar,colar2,topos)
  27.         doPlayerSendCancel(cid, "Item pasted.")
  28.         return true
  29.     end
  30.  
  31.     setPlayerStorageValue(cid, stor2, itemEx.itemid)
  32.     setPlayerStorageValue(cid, stor3, itemEx.count)
  33.     return true
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement