Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. include("shared.lua")
  2. ENT.RenderGroup = RENDERGROUP_BOTH
  3.  
  4. for i = 1, 100 do
  5. surface.CreateFont("CV" .. tostring(i), {
  6. font = "coolvetica",
  7. size = i,
  8. weight = 400,
  9. antialias = false,
  10. outline = true
  11. })
  12. end
  13.  
  14. function ENT:Initialize()
  15. self:SetMaterial("models/effects/vol_light001")
  16. self:SetRenderMode(RENDERMODE_TRANSALPHA)
  17. self:SetColor(Color(255, 255, 255, 1))
  18. self.lines = self.lines or {}
  19. net.Start("textscreens_downlod")
  20. net.WriteEntity(self)
  21. net.SendToServer()
  22. end
  23.  
  24. function ENT:Draw()
  25. if self:GetPos():Distance(LocalPlayer():GetPos()) < 1500 then
  26. local ang = self:GetAngles()
  27. local pos = self:GetPos() + ang:Up()
  28. local camangle = Angle(ang.p, ang.y, ang.r)
  29. self.lines = self.lines or {}
  30. local totheight = 0
  31.  
  32. for k, v in pairs(self.lines) do
  33. v.size = tonumber(v.size) > 100 and 100 or v.size
  34. surface.SetFont("CV" .. math.Clamp(v.size, 1, 100))
  35. TextWidth, TextHeight = surface.GetTextSize(v.text)
  36. self.lines[k].width = TextWidth
  37. self.lines[k].height = TextHeight
  38. totheight = totheight + TextHeight
  39. end
  40.  
  41. cam.Start3D2D(pos, camangle, .25)
  42. render.PushFilterMin(TEXFILTER.ANISOTROPIC)
  43. local curheight = 0
  44.  
  45. for k, v in pairs(self.lines) do
  46. draw.DrawText(v.text, "CV" .. math.Clamp(v.size, 1, 100), 0, -(totheight / 2) + curheight, v.color, TEXT_ALIGN_CENTER)
  47. curheight = curheight + v.height
  48. end
  49.  
  50. render.PopFilterMin()
  51. cam.End3D2D()
  52. camangle:RotateAroundAxis(camangle:Right(), 180)
  53. cam.Start3D2D(pos, camangle, .25)
  54. render.PushFilterMin(TEXFILTER.ANISOTROPIC)
  55. local curheight = 0
  56.  
  57. for k, v in pairs(self.lines) do
  58. draw.DrawText(v.text, "CV" .. math.Clamp(v.size, 1, 100), 0, -(totheight / 2) + curheight, v.color, TEXT_ALIGN_CENTER)
  59. curheight = curheight + v.height
  60. end
  61.  
  62. render.PopFilterMin()
  63. cam.End3D2D()
  64. end
  65. end
  66.  
  67. function ENT:DrawTranslucent()
  68. self:Draw()
  69. end
  70.  
  71. function ENT:Think()
  72. end
  73.  
  74. net.Receive("textscreens_update", function(len)
  75. local ent = net.ReadEntity()
  76.  
  77. if IsValid(ent) and ent:GetClass() == "sammyservers_textscreen" then
  78. ent.lines = net.ReadTable()
  79. end
  80. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement