Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. local id_da_wand = 12345
  2. local tempo_de_exhaust = 30 -- em minutos (da spell)
  3. local tempo_de_wand = 30 -- em minutos (de duração da wand)
  4. local wandsto = 505090
  5. local storage = 505091
  6.    
  7. function doRemoveWand(cid)
  8.     if not isPlayer(cid) then return false end
  9.     if exhaustion.check(cid,wandsto) == true then
  10.         return false
  11.     end
  12.     for slot = 5,6 do
  13.         if getPlayerSlotItem(cid, slot).itemid == id_da_wand then
  14.             doPlayerRemoveItem(cid,id_da_wand,1)
  15.         end
  16.     end
  17.     return true
  18. end
  19.  
  20. function onCastSpell(cid, var) 
  21.     tempo_de_wand = tempo_de_wand * 60
  22.     tempo_de_exhaust = tempo_de_exhaust * 60
  23.    
  24.     if exhaustion.check(cid, storage) == false then
  25.         if exhaustion.check(cid,wandsto) == false then
  26.             if not getPlayerSlotItem(cid, 5).itemid or not getPlayerSlotItem(cid,6).itemid then
  27.                 doPlayerAddItem(cid,id_da_wand,1)
  28.                 doSendMagicEffect(getCreaturePosition(cid),12)
  29.                 exhaustion.set(cid,wandsto,tempo_de_wand)
  30.                 exhaustion.set(cid,storage,tempo_de_exhaust)
  31.                 addEvent(doRemoveWand,(tempo_de_wand*1000)+1000,cid)
  32.             else
  33.                 doPlayerSendCancel(cid,'You cannot use this spell with your hands full.')
  34.                 doSendMagicEffect(getCreaturePosition(cid),2)
  35.             end
  36.         else
  37.             doPlayerSendCancel(cid,'You are exhausted.')
  38.             doSendMagicEffect(getCreaturePosition(cid),2)
  39.         end
  40.     else
  41.         doSendMagicEffect(getCreaturePosition(cid),2)
  42.         doPlayerSendCancel(cid,'You are exhausted.')
  43.     end
  44.     return true
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement