Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bosses = {'Trainer', 'Dragon'}
- function onThink(cid, interval, lastExecution, thinkInterval)
- for _, name in ipairs(getOnlinePlayers()) do
- local cid = getPlayerByName(name)
- if getPlayerStorageValue(cid, 19937) == 1 then
- local spec = getSpectators(getCreaturePosition(cid), 7, 5)
- for z = 1, #spec do
- if isInArray(bosses, getCreatureName(spec[z])) then
- local hppc = Round(getCreatureHealth(spec[z]) / getCreatureMaxHealth(spec[z]) * 100)
- 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'
- if color == 'darkred' then
- doSendCreatureSquare(spec[z], TEXTCOLOR_DARKRED, cid)
- doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_DARKRED)
- elseif color == 'red' then
- doSendCreatureSquare(spec[z], TEXTCOLOR_RED, cid)
- doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_RED)
- elseif color == 'yellow' then
- doSendCreatureSquare(spec[z], TEXTCOLOR_YELLOW, cid)
- doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_YELLOW)
- elseif color == 'lightgreen' then
- doSendCreatureSquare(spec[z], TEXTCOLOR_LIGHTGREEN, cid)
- doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_LIGHTGREEN)
- elseif color == 'green' then
- doSendCreatureSquare(spec[z], TEXTCOLOR_GREEN, cid)
- doSendAnimatedText(getCreaturePosition(spec[z]), ''..hppc..'%', TEXTCOLOR_GREEN)
- end
- end
- end
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement