Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. local items =   {    -- if you want to disable mana.health.level make it to 0
  2.                                         [6119] = {spell = "thunderblast", mana = 0, health = 0, level = 0,storage = 934039}                                }
  3.  
  4. function onUse(cid, item, fromPosition, itemEx, toPosition)                            
  5.         local t = items[item.itemid]
  6.        
  7.         if t then
  8.                 if getPlayerStorageValue(cid,t.storage) > 0 then
  9.                         return doPlayerSendCancel(cid,"You have already used this before.")
  10.                 end
  11.                 if getCreatureMaxMana(cid) < t.mana then
  12.                         return doPlayerSendCancel(cid,"You need ".. t.mana .. " mana points to learn this spell.")
  13.                 end
  14.                 if getCreatureMaxHealth(cid) < t.health then
  15.                         return doPlayerSendCancel(cid,"You need ".. t.health .. " mana points to learn this spell.")
  16.                 end
  17.                 if getPlayerLevel(cid) < t.mana then
  18.                         return doPlayerSendCancel(cid,"You need to be more then  level [".. t.level .. "] to learn this spell.")
  19.                 end
  20.                 doPlayerLearnInstantSpell(cid, t.spell)
  21.                 setPlayerStorageValue(cid,t.storage,1)
  22.                 doPlayerSendTextMessage(cid,25,"You have learned a new spell [".. t.spell .."].")
  23.             doRemoveItem(item.uid,1)
  24.         end
  25.         return true
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement