Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local X, Y = 30, 200
- local ShowLastMessage = 0
- local RecentMessages = {}
- hook.Add( "HUDPaint", "AdminNotify", function()
- for k, v in pairs( RecentMessages ) do
- if not v.Sent or v.Sent ~= 1 then
- if ShowLastMessage and ShowLastMessage + .5 > CurTime() then return end
- ShowLastMessage = CurTime()
- v.Sent = 1
- v.dietime = CurTime() + 10
- end
- if CurTime() >= v.dietime then
- table.remove( RecentMessages, k )
- else
- local remaining = math.ceil( v.dietime - CurTime() )
- local fade = math.Clamp( ( remaining * 255 ) / 2, 0, 255 )
- surface.SetFont( "Trebuchet18" )
- surface.SetTextColor( v.colour.r, v.colour.g, v.colour.b, fade )
- surface.SetTextPos( X, Y * k / 15 )
- surface.DrawText( v.text )
- end
- end
- end )
- usermessage.Hook( "AdminNotify", function( UMsg )
- local R = UMsg:ReadShort()
- local G = UMsg:ReadShort()
- local B = UMsg:ReadShort()
- local Text = UMsg:ReadString()
- local Date = os.date( "*t" )
- local Message = {}
- Message.colour = Color( R, G, B )
- Message.text = Format( "[%02i:%02i:%02i] %s", Date.hour, Date.min, Date.sec, Text )
- table.insert( RecentMessages, Message )
- Msg( Message.text .. "\n" )
- end )
Advertisement
Add Comment
Please, Sign In to add comment