Advertisement
Guest User

health

a guest
Mar 21st, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. local exhaust = createConditionObject(CONDITION_EXHAUST)
  2. setConditionParam(exhaust, CONDITION_PARAM_TICKS, 750) -- time in seconds x1000
  3.  
  4. function onUse(cid, item, fromPosition, itemEx, toPosition)
  5.  
  6. local healthmax = getCreatureMaxHealth(cid)
  7. local min = 30 -- this means 30% minimum healing
  8. local max = 50 -- this means 50% maximum healing
  9. local health_add = math.random((healthmax * (min/100)), (healthmax * (max/100)))
  10.  
  11. if(hasCondition(cid, CONDITION_EXHAUST)) then
  12. doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  13. doPlayerSendCancel(cid, "You are exhausted")
  14. return true
  15. end
  16. doPlayerAddHealth(cid, health_add)
  17. doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
  18. doSendAnimatedText(getPlayerPosition(cid),"+"..health_add.."", TEXTCOLOR_LIGHTBLUE)
  19. doAddCondition(cid, exhaust)
  20. return true
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement