Advertisement
jdrecarp

Healing Item for Knight

Aug 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. local t = {
  2.     storage = 41902
  3. }
  4.  
  5. function onUse(cid, item, fromPosition, itemEx, toPosition)
  6.     if not isKnight(cid) then
  7.         doPlayerSendCancel(cid, 'Sorry, you cannot use this object.')
  8.         return false
  9.     end
  10.     if getPlayerStorageValue(cid, t.storage) > 0 then
  11.         doPlayerSendCancel(cid, 'You cannot use this during the event.')
  12.         return false
  13.     end
  14.  
  15.     local maxHealth = getCreatureMaxHealth(cid)
  16.     local formula = ((maxHealth / 100) * math.random(30, 50))
  17.     doCreatureAddHealth(cid, formula)
  18.     doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC)
  19.     return true
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement