Guest User

Untitled

a guest
Sep 22nd, 2013
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Credits:
  3. The Maw - For making this possible
  4. Me (Jova) - Writing everything except for a few little functions
  5. ]]
  6. function DrawText( text, font, x, y, col, align1, align2 )
  7. draw.SimpleText( text, font, x, y, col, align1, align2 )
  8. end
  9.  
  10. local chatshow = false
  11. local history = {}
  12. local spacing = 20
  13. local chatmessage = ""
  14. local GetColor = team.GetColor(LocalPlayer():Team())
  15. function textsize(t, f) local w = surface.GetTextSize(t, f); return w; end
  16.  
  17. local function SendText(text, msg)
  18. local hist = {
  19. Text = text,
  20. Time = RealTime()+8,
  21. Msg = msg
  22. }
  23. table.insert( history, 1, hist )
  24. table.remove( history, 21 )
  25. end
  26.  
  27. local y = ScrH()-130
  28. local x = 150
  29. hook.Add("HUDPaint", "ChatPaint", function()
  30. for k, v in pairs( history ) do
  31. if v.Time > RealTime() or chatshow then
  32. DrawText(v.Text, "Trebuchet24", x+1, (y-k*spacing)+1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT)
  33. DrawText(v.Text, "Trebuchet24", x, y-k*spacing, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
  34.  
  35. DrawText(v.Msg, "Trebuchet24", x+1, (y-k*spacing)+1, Color(0, 0, 0, 255), TEXT_ALIGN_RIGHT)
  36. DrawText(v.Msg, "Trebuchet24", x, y-k*spacing, Color(GetColor.r, GetColor.g, GetColor.b, 255), TEXT_ALIGN_RIGHT)
  37. else
  38. end
  39. end
  40.  
  41.  
  42. if chatshow then
  43. surface.SetTextColor( Color(math.sin(CurTime() * 2) * 255, 255, 255) )
  44. draw.RoundedBox(0, x-86, y+4, 80, 20, Color( 25, 25, 25, 255 ))
  45.  
  46. surface.SetDrawColor( 25, 25, 25, 255 )
  47. surface.SetTexture(surface.GetTextureID("gui/gradient"))
  48. surface.DrawTexturedRect(x+489, y+4, 100, 20)
  49. draw.RoundedBox(0, x-9, y+4, 499, 20, Color( 25, 25, 25, 255 ))
  50.  
  51. surface.SetDrawColor( 255, 255, 255, 255 )
  52. surface.SetTexture(surface.GetTextureID("gui/gradient"))
  53. surface.DrawTexturedRect(x+489, y+5, 100, 18)
  54. draw.RoundedBox(0, x-9, y+5, 498, 18, Color( 255, 255, 255, 255 ))
  55.  
  56. DrawText( "Chat>", "Trebuchet24", x-34, y+1, Color( 255, 255, 255, 255 ), TEXT_ALIGN_RIGHT )
  57. DrawText( chatmessage, "Default", x-7, y+8, Color( 25, 25, 25, 255 ), TEXT_ALIGN_LEFT )
  58. end
  59. end)
  60.  
  61. hook.Add("OnPlayerChat", "PlayerChat", function( pl, text, teamtext, alive )
  62. if (IsValid(pl)) then
  63. SendText(text, pl:Nick().."> ")
  64. else
  65. SendText(text, "Console> ")
  66. end
  67. end)
  68.  
  69. hook.Add("ChatText", "ChatText", function( filter, name, text )
  70. if (filter == 0) then
  71. SendText(text, "Server> ")
  72. end
  73. end)
  74.  
  75. hook.Add("StartChat", "StartChat", function() chatshow = true return true end)
  76. hook.Add("FinishChat", "FinishChat", function() chatshow = false return true end)
  77. hook.Add("ChatTextChanged", "TextChanged", function(text) chatmessage = text end)
RAW Paste Data