Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. local t = {
  2.     [itemId] = {
  3.         spell = "name"
  4.     },
  5.     [itemId] = {
  6.         spell = "name"
  7.     },
  8. }
  9.  
  10. function onUse(cid, item, fromPosition, itemEx, toPosition)
  11.     local k, pos = t[item.itemid], getThingPos(cid)
  12.     if k then
  13.         if getPlayerLearnedInstantSpell(cid, k.spell) then
  14.             doPlayerSendCancel(cid, "You already know this spell.")
  15.             doSendMagicEffect(pos, CONST_ME_POFF)
  16.         else
  17.             doRemoveItem(cid, item.uid, 1)
  18.             doPlayerLearnInstantSpell(cid, k.spell)
  19.             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have successfully learned " .. k.spell .. "!")
  20.             doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
  21.         end
  22.     end
  23.     return true
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement