OCRP_Hints = {} OCRP_Hints.Messages = {} OCRP_Hints.LastAdded = 0 local Hint_Text_Height = draw.GetFontHeight("DefaultBold") or 10 function OCRP_AddHint(Hint) local HintTbl = {} HintTbl.Text = Hint Hint_Text_Height = Hint_Text_Height or 10 HintTbl.H = Hint_Text_Height + (6 * 2) HintTbl.Time = CurTime() if OCRP_Hints.LastAdded > (HintTbl.Time - 1) then HintTbl.Time = OCRP_Hints.LastAdded + 1 end table.insert(OCRP_Hints.Messages, 1, HintTbl) AddToChatLogTable("[HINT]-> " .. Hint) OCRP_Hints.LastAdded = HintTbl.Time end function OCRP_GetHint( um ) local Hint = um:ReadString() OCRP_AddHint(Hint) end usermessage.Hook( "OCRP_Hint", OCRP_GetHint) function OCRP_HintsDraw(client) local ry = ScrH() - 300 for _, Hint in pairs(OCRP_Hints.Messages) do if Hint.Time < CurTime() then local MY = -Hint.H local y = ry + 6 + MY MY = (MY < 0) and MY + 2 or 0 local delta = (Hint.Time + 12) - CurTime() delta = delta / 12 if _ >= 5 then delta = delta / 2 end local A = 200 if delta > 0.9 then A = math.Clamp( (1.0 - delta) * (255 / 0.1), 0, 200) elseif delta < 0.6 then A = math.Clamp( delta * (255 / 0.6), 0, 200) end local H = Hint.H surface.SetFont("DefaultBold") local x2,y2 = surface.GetTextSize(Hint.Text) x2 = x2 or 22 y2 = y2 or 4 Hint_Text_Height = y2 draw.RoundedBox(8, ScrW() - 6 - ( x2 + 40 ), y, x2 + 30, H, Color( OCRP_Options.Color.r, OCRP_Options.Color.g, OCRP_Options.Color.b, A ) ) surface.SetMaterial( OC_Alert ) surface.SetDrawColor( Color(0,0,0,A) ) surface.DrawTexturedRect( ScrW() - 6 - ( x2 + 50 ), y - 1, H, H + 2 ) local HintTEXTColor = Color(255,255,255,255) HintTEXTColor.a = math.Clamp(A, 0, HintTEXTColor.a) local HintText = {} HintText.font = "DefaultBold" HintText.xalign = ScrW() - 6 - (x2+20) HintText.yalign = TEXT_ALIGN_TOP HintText.color = HintTEXTColor HintText.text = Hint.Text local x3 = ScrW() - 6 - ( x2 + 20 ) local y3 = y + 5 + 1 * ( Hint_Text_Height - 13 ) HintText.pos = {x3, y3} draw.Text( HintText ) if A == 0 then OCRP_Hints.Messages[_] = nil end ry = y + H + 24 end end end