s=Vector2(guiGetScreenSize())
msgs={}
types={
[1]={"succes.png"},
[2]={"info.png"},
[3]={"error.png"},
}
function newNoti(el,txt,type)
if el==localPlayer then
if type>3 or type<0 or not tonumber(type) then
type=2
end
local type=types[type][1]
table.insert(msgs,{txt=txt,typ=type,easingFunction="Linear",startTime=getTickCount(),endTime=getTickCount()+5000})
end
end
addCommandHandler("dodaj",function(cmd,typ,...)
local msg=table.concat({...}," ")
newNoti(localPlayer,msg,tonumber(type))
end)
addEventHandler("onClientRender",root,function()
offset=0
for _,v in ipairs(msgs)do
local now = getTickCount()
local elapsedTime = now - v.startTime
local duration = v.endTime - v.startTime
local progress = elapsedTime / duration
local fAnimationTime = getEasingValue(progress, v.easingFunction)
local alpha = (1-fAnimationTime)*255
if alpha<0 then
table.remove(msgs,1)
end
dxDrawRectangle(15, 638+offset, 391, 62, tocolor(57, 57, 57, 182), false)
dxDrawImage(201, 676+offset, 0, 0, v.typ, 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(822, 428+offset, 0, 0,v.typ, 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(742, 393+offset, 0, 53, v.typ, 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(15, 636+offset, 391, 64, v.typ, 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawLine(85, 646+offset, 85, 687+offset, tocolor(255, 255, 255, 255), 3, false)
dxDrawText("Ban 30dni dla Kazik za bugowanie gry! essa byku", 99, 647+offset, 396, 686+offset, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, true, false, false, false)
offset=offset+70
end
end)
|