local duty = getElementData(p, "duty")
local premium = getElementData(p, "premium")
local frakcja = getElementData(p, "player:faction")
local zycie = getElementHealth(p)
local isAFK=getElementData(p, 'afk') or false
local isChatTyping=getElementData(p, 'chat_typing') or false
local isPremium=getElementData(p, 'premium') or false
local isAdm=getElementData(p, 'player:admin') or false
local liczbaikonek = {}
zycie = string.format("%1d", zycie)
if isAFK==true then
table.insert(liczbaikonek, {grafika='afk.png', waznosc=10})
end
if isChatTyping==true then
table.insert(liczbaikonek, {grafika='czat.png', waznosc=10})
end
if isPremium then
table.insert(liczbaikonek, {grafika='premium.png', waznosc=50})
end
if isAdm then
table.insert(liczbaikonek, {grafika='admins.png', waznosc=60})
end
if #liczbaikonek == 1 then
dxDrawImage(sx-20, sy-45, 40, 40, 'ikonki/' ..liczbaikonek[1].grafika, 0, 0, 0, tocolor(255, 255, 255, 255))
elseif #liczbaikonek == 2 then
table.sort(liczbaikonek, function(a,b) return a.waznosc>b.waznosc end)
dxDrawImage(sx-40, sy-45, 40, 40, 'ikonki/' ..liczbaikonek[1].grafika, 0, 0, 0, tocolor(255, 255, 255, 255))
dxDrawImage(sx, sy-45, 40, 40, 'ikonki/' ..liczbaikonek[2].grafika, 0, 0, 0, tocolor(255, 255, 255, 255))
elseif #liczbaikonek > 2 then
table.sort(liczbaikonek, function(a,b) return a.waznosc>b.waznosc end)
dxDrawImage(sx-120/2, sy-45, 40, 40, 'ikonki/' ..liczbaikonek[1].grafika, 0, 0, 0, tocolor(255, 255, 255, 255))
dxDrawImage(sx-40/2, sy-45, 40, 40, 'ikonki/' ..liczbaikonek[2].grafika, 0, 0, 0, tocolor(255, 255, 255, 255))
dxDrawImage(sx+40/2, sy-45, 40, 40, 'ikonki/' ..liczbaikonek[3].grafika, 0, 0, 0, tocolor(255, 255, 255, 255))
end
end
end