
/*
    Addon id: e7709ac2-cc0b-41b1-845d-7528015000ee
    Version: v1.7.8 (stable)
*/

Realistic_Police.Notify = Realistic_Police.Notify or {}
function RealisticPoliceNotify(msg, time)
    if not isnumber(time) then time = 5 end
    
    if not Realistic_Police.UseDarkRPNotify then
        Realistic_Police.Notify[#Realistic_Police.Notify + 1] = {
            ["msg"] = msg,
            ["time"] = CurTime() + (time or 5),
            ["mat"] = Material("jail.png"), 
        }
    else
        notification.AddLegacy(msg, NOTIFY_GENERIC, time)
    end
end

function Realistic_Police.DrawNotification()
    if Realistic_Police.Notify and #Realistic_Police.Notify > 0 then 
        for k,v in ipairs(Realistic_Police.Notify) do 
            surface.SetFont("rpt_font_20")

            local sizeText = surface.GetTextSize(v.msg)

            local RPS, RPTScrH = ScrW(), ScrH()

            if not isnumber(v.RLerp) then v.RLerp = -sizeText end 
            if not isnumber(v.RLerpY) then v.RLerpY = (RPTScrH*0.055*k)-RPTScrH*0.038 end

            if v.time > CurTime() then
                v.RLerp = Lerp(FrameTime()*3, v.RLerp, RPS*0.02)
            else
                v.RLerp = Lerp(FrameTime()*3, v.RLerp, (-RPS*0.25 - sizeText))
                if v.RLerp < (-RPS*0.15 - sizeText) then 
                    Realistic_Police.Notify[k] = nil 
                    Realistic_Police.Notify = table.ClearKeys(Realistic_Police.Notify) 
                end
            end 
            
            v.RLerpY = Lerp(FrameTime()*8, v.RLerpY, (RPTScrH*0.055*k)-RPTScrH*0.038)
local posy = v.RLerpY
            local incline = RPTScrH*0.055

            local leftPart = {
                {x = v.RLerp, y = posy},
                {x = v.RLerp + incline + sizeText + RPTScrH*0.043, y = posy},
                {x = v.RLerp + RPTScrH*0.043 + sizeText + RPTScrH*0.043, y = posy + RPTScrH*0.043},
                {x = v.RLerp, y = posy + RPTScrH*0.043},
            }
surface.SetDrawColor(Realistic_Police.Colors["darkblue"])
            draw.NoTexture()
            surface.DrawPoly(leftPart)

            local rightPart = {
                {x = v.RLerp, y = posy},
                {x = v.RLerp + incline, y = posy},
                {x = v.RLerp + RPTScrH*0.043, y = posy + RPTScrH*0.043},
                {x = v.RLerp, y = posy + RPTScrH*0.043},
            }
            
            surface.SetDrawColor(Realistic_Police.Colors["lightblue"])
            draw.NoTexture()
            surface.DrawPoly(rightPart)

            surface.SetDrawColor(Realistic_Police.Colors["white"])
            surface.SetMaterial(v.mat)
            surface.DrawTexturedRect(v.RLerp + RPS*0.006, v.RLerpY + RPTScrH*0.007, RPTScrH*0.027, RPTScrH*0.027)
draw.SimpleText(v.msg, "rpt_font_20", v.RLerp + RPS*0.037, v.RLerpY + RPTScrH*0.041/2, Realistic_Police.Colors["white"], TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
        end 
    end
end
hook.Add("HUDPaint", "Realistic_Police:DrawNotification", function()
    Realistic_Police.DrawNotification()
end)


