Tidas

Untitled

Jun 29th, 2013
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.52 KB | None | 0 0
  1. if !PS then print("Fatal error!") return end
  2.  
  3. PS.CurrentArea = PS.CurrentArea or 0
  4. PS.Progress = PS.Progress or 50
  5. PS.Elements = PS.Elements or {}
  6. PS.NextTime = PS.NextTime or CurTime()
  7.  
  8. TEXTURE_WHITE = surface.GetTextureID("vgui/white")
  9. TEXTURE_INNERDISK = Material("deviantgamers/PowerStruggle_InnerDisk.png","nocull")
  10. TEXTURE_OUTERDISK = Material("deviantgamers/PowerStruggle_OuterDisk.png","nocull")
  11.  
  12. net.Receive("PS_CurrentArea",function()
  13.  
  14. PS.CurrentArea = net.ReadDouble()
  15.  
  16. if PS.CurrentArea == 0 then PS.Elements = {} PS.LastPoint = 0 else
  17.  
  18. PS.LastPoint = CurTime()
  19. surface.PlaySound("deviantgamers/siren.mp3")
  20.  
  21. end
  22. end)
  23.  
  24. net.Receive("PS_Progress",function()
  25. PS.Progress = net.ReadDouble()
  26. end)
  27.  
  28. net.Receive("PS_Message",function()
  29. chat.AddText(Color(255,255,255),"[",Color(200,100,100),"PS",Color(255,255,255),"]: ",Color(255,255,255),net.ReadString())
  30. end)
  31.  
  32. net.Receive("PS_NextTime",function()
  33. PS.NextTime = net.ReadDouble()
  34. end)
  35.  
  36. net.Receive("PS_Win",function()
  37. PS.Win = {CurTime(),net.ReadDouble()}
  38.  
  39. if PS.Win[2] == PS.TEAM_EUROCONV then
  40. surface.PlaySound("deviantgamers/eurocov_vict.mp3")
  41. else
  42. surface.PlaySound("deviantgamers/westcon_vict.mp3")
  43. end
  44.  
  45. timer.Simple(10, function() surface.PlaySound("ambient/levels/streetwar/heli_distant1.wav") end)
  46. end)
  47.  
  48. function Check()
  49. return (LocalPlayer():Team() == PS.TEAM_EUROCONV or LocalPlayer():Team() == PS.TEAM_WESTCONV)
  50. end
  51.  
  52. surface.CreateFont("PowerStruggle_Font1",
  53. {
  54. font = "Trebuchet MS",
  55. size = 25
  56. }
  57. )
  58.  
  59.  
  60. hook.Add("HUDPaint","PS.Paint",function()
  61.  
  62. if PS.CurrentArea != 0 and Check() then
  63.  
  64. if LocalPlayer():Team() == PS.TEAM_EUROCONV then
  65. draw.RoundedBox(0,ScrW()/2-200,25,400,40,Color(150,50,50,200))
  66. draw.RoundedBox(0,ScrW()/2-200 + 3,25 + 3,400-6,40-6,Color(200,25,25,200))
  67.  
  68. end
  69.  
  70. if LocalPlayer():Team() == PS.TEAM_WESTCONV then
  71. draw.RoundedBox(0,ScrW()/2-200,25,400,40,Color(50,50,150,200))
  72. draw.RoundedBox(0,ScrW()/2-200 +3,25 + 3,400-6,40-6,Color(25,25,200,200))
  73. end
  74.  
  75. local val = math.AdvRound((PS.Progress-50)*2,0)
  76.  
  77. if val > 0 then
  78. surface.SetDrawColor(Color(150,0,0))
  79. surface.DrawRect(ScrW()/2,28,197*(val/100),34)
  80. else
  81. surface.SetDrawColor(Color(0,0,150))
  82. surface.DrawRect(ScrW()/2 - 197*(val*-1/100),28,197*(val*-1/100),34)
  83. end
  84.  
  85. draw.SimpleTextOutlined(math.abs(val).."%","Default",ScrW()/2,38,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
  86. draw.SimpleTextOutlined("Influence","Default",ScrW()/2,5,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
  87.  
  88. if PS.LastPoint then
  89. if CurTime()-PS.LastPoint < 10 and (math.Round(CurTime()%3) == 1 or math.Round(CurTime()%3)) == 2 then
  90. draw.SimpleTextOutlined("Capture Point Online: "..PS.Positions[PS.CurrentArea][3],"PowerStruggle_Font1",ScrW()/2,110,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
  91. elseif CurTime()-PS.LastPoint > 10 then
  92. draw.SimpleTextOutlined(PS.Positions[PS.CurrentArea][3],"Default",ScrW()/2,70,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
  93. end
  94. end
  95.  
  96. elseif PS.CurrentArea == 0 and Check() then
  97.  
  98. local tbl = string.FormattedTime(PS.NextTime-CurTime())
  99. if tostring(tbl.h):len() == 1 then tbl.h = "0"..tbl.h end
  100. if tostring(tbl.m):len() == 1 then tbl.m = "0"..tbl.m end
  101. if tostring(tbl.s):len() == 1 then tbl.s = "0"..tbl.s end
  102. draw.SimpleTextOutlined("Time until next Capture Point: "..tbl.h..":"..tbl.m..":"..tbl.s,"Default",ScrW()/2,5,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
  103.  
  104. if PS.Win then
  105. if CurTime()-PS.Win[1] < 10 then
  106. if PS.Win[2] == PS.TEAM_EUROCONV then
  107. draw.SimpleTextOutlined("EuroCov has captured the area!","PowerStruggle_Font1",ScrW()/2,40,Color(200,50,50),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
  108. else
  109. draw.SimpleTextOutlined("WestCon has captured the area!","PowerStruggle_Font1",ScrW()/2,40,Color(50,50,200),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
  110. end
  111. end
  112. end
  113.  
  114. end
  115.  
  116. end)
  117.  
  118. concommand.Add("Refresh",function() include("autorun/client/cl_core.lua") end)
  119.  
  120. local rad,sin,cos = math.rad,math.sin,math.cos
  121. function GeneratePoly(x,y,radius,quality)
  122. local circle = {};
  123. local tmp = 0;
  124. for i=1,quality do
  125. tmp = rad(i*360)/quality
  126. circle[i] = {x = x + cos(tmp)*radius,y = y + sin(tmp)*radius};
  127. end
  128. return circle;
  129. end
  130.  
  131. hook.Add("PostDrawOpaqueRenderables","PS.Opaque",function()
  132.  
  133. if PS.CurrentArea == 0 or Check() == false then return end
  134.  
  135. local pos = PS.Positions[PS.CurrentArea][1] + Vector(0,0,1)
  136. local radius = PS.Positions[PS.CurrentArea][2]*1.22
  137.  
  138. if PS.Elements["Circle1"] == nil then PS.Elements["Circle1"] = GeneratePoly(0,0,radius,36) end
  139.  
  140. cam.Start3D2D(pos,Angle(0,0,0),1)
  141.  
  142. surface.SetMaterial(TEXTURE_OUTERDISK)
  143. surface.SetDrawColor(Color(255,0,255,255))
  144. surface.DrawTexturedRectRotated(0,0,radius*2,radius*2,CurTime()*10)
  145.  
  146.  
  147. cam.End3D2D()
  148.  
  149. cam.Start3D2D(pos + Vector(0,0,3),Angle(0,0,0),1)
  150.  
  151.  
  152. surface.SetMaterial(TEXTURE_INNERDISK)
  153. surface.SetDrawColor(Color(255,255,255,255))
  154. surface.DrawTexturedRectRotated(0,0,radius*1.95,radius*1.95,CurTime()*-10)
  155.  
  156. cam.End3D2D()
  157.  
  158. end)
Advertisement
Add Comment
Please, Sign In to add comment