Advertisement
Guest User

asdf

a guest
Jul 27th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 KB | None | 0 0
  1. local bosses = {'Trainer', 'Dragon'}
  2.  
  3.  
  4. function onThink(cid, interval, lastExecution, thinkInterval)
  5.     for _, name in ipairs(getOnlinePlayers()) do
  6.         local cid = getPlayerByName(name)
  7.         if getPlayerStorageValue(cid, 19937) == 1 then
  8.             local spec = getSpectators(getCreaturePosition(cid), 7, 5)
  9.             for z = 1, #spec do
  10.                 if isInArray(bosses, getCreatureName(spec[z])) then
  11.                 local hppc = Round(getCreatureHealth(spec[z]) / getCreatureMaxHealth(spec[z]) * 100)
  12.                 local color = hppc > 92 and 'green' or (hppc <= 92 and hppc > 56) and 'lightgreen' or (hppc <= 56 and hppc > 28) and 'yellow' or (hppc <= 28 and hppc > 8) and 'red' or (hppc <= 8 and hppc > 0) and 'darkred'
  13.                     if color == 'darkred' then
  14.                         doSendCreatureSquare(spec[z], TEXTCOLOR_DARKRED, cid)
  15.                         doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_DARKRED)
  16.                     elseif color == 'red' then
  17.                         doSendCreatureSquare(spec[z], TEXTCOLOR_RED, cid)
  18.                         doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_RED)
  19.                     elseif color == 'yellow' then
  20.                         doSendCreatureSquare(spec[z], TEXTCOLOR_YELLOW, cid)
  21.                         doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_YELLOW)
  22.                     elseif color == 'lightgreen' then
  23.                         doSendCreatureSquare(spec[z], TEXTCOLOR_LIGHTGREEN, cid)
  24.                         doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_LIGHTGREEN)
  25.                     elseif color == 'green' then
  26.                         doSendCreatureSquare(spec[z], TEXTCOLOR_GREEN, cid)
  27.                         doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_GREEN)
  28.                     end
  29.                 end
  30.             end
  31.         end
  32.     end
  33.     return true
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement