Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if !PS then print("Fatal error!") return end
- PS.CurrentArea = PS.CurrentArea or 0
- PS.Progress = PS.Progress or 50
- PS.Elements = PS.Elements or {}
- PS.NextTime = PS.NextTime or CurTime()
- TEXTURE_WHITE = surface.GetTextureID("vgui/white")
- TEXTURE_INNERDISK = Material("deviantgamers/PowerStruggle_InnerDisk.png","nocull")
- TEXTURE_OUTERDISK = Material("deviantgamers/PowerStruggle_OuterDisk.png","nocull")
- net.Receive("PS_CurrentArea",function()
- PS.CurrentArea = net.ReadDouble()
- if PS.CurrentArea == 0 then PS.Elements = {} PS.LastPoint = 0 else
- PS.LastPoint = CurTime()
- surface.PlaySound("deviantgamers/siren.mp3")
- end
- end)
- net.Receive("PS_Progress",function()
- PS.Progress = net.ReadDouble()
- end)
- net.Receive("PS_Message",function()
- chat.AddText(Color(255,255,255),"[",Color(200,100,100),"PS",Color(255,255,255),"]: ",Color(255,255,255),net.ReadString())
- end)
- net.Receive("PS_NextTime",function()
- PS.NextTime = net.ReadDouble()
- end)
- net.Receive("PS_Win",function()
- PS.Win = {CurTime(),net.ReadDouble()}
- if PS.Win[2] == PS.TEAM_EUROCONV then
- surface.PlaySound("deviantgamers/eurocov_vict.mp3")
- else
- surface.PlaySound("deviantgamers/westcon_vict.mp3")
- end
- timer.Simple(10, function() surface.PlaySound("ambient/levels/streetwar/heli_distant1.wav") end)
- end)
- function Check()
- return (LocalPlayer():Team() == PS.TEAM_EUROCONV or LocalPlayer():Team() == PS.TEAM_WESTCONV)
- end
- surface.CreateFont("PowerStruggle_Font1",
- {
- font = "Trebuchet MS",
- size = 25
- }
- )
- hook.Add("HUDPaint","PS.Paint",function()
- if PS.CurrentArea != 0 and Check() then
- if LocalPlayer():Team() == PS.TEAM_EUROCONV then
- draw.RoundedBox(0,ScrW()/2-200,25,400,40,Color(150,50,50,200))
- draw.RoundedBox(0,ScrW()/2-200 + 3,25 + 3,400-6,40-6,Color(200,25,25,200))
- end
- if LocalPlayer():Team() == PS.TEAM_WESTCONV then
- draw.RoundedBox(0,ScrW()/2-200,25,400,40,Color(50,50,150,200))
- draw.RoundedBox(0,ScrW()/2-200 +3,25 + 3,400-6,40-6,Color(25,25,200,200))
- end
- local val = math.AdvRound((PS.Progress-50)*2,0)
- if val > 0 then
- surface.SetDrawColor(Color(150,0,0))
- surface.DrawRect(ScrW()/2,28,197*(val/100),34)
- else
- surface.SetDrawColor(Color(0,0,150))
- surface.DrawRect(ScrW()/2 - 197*(val*-1/100),28,197*(val*-1/100),34)
- end
- draw.SimpleTextOutlined(math.abs(val).."%","Default",ScrW()/2,38,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
- draw.SimpleTextOutlined("Influence","Default",ScrW()/2,5,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM,1,Color(0,0,0))
- if PS.LastPoint then
- if CurTime()-PS.LastPoint < 10 and (math.Round(CurTime()%3) == 1 or math.Round(CurTime()%3)) == 2 then
- 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))
- elseif CurTime()-PS.LastPoint > 10 then
- 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))
- end
- end
- elseif PS.CurrentArea == 0 and Check() then
- local tbl = string.FormattedTime(PS.NextTime-CurTime())
- if tostring(tbl.h):len() == 1 then tbl.h = "0"..tbl.h end
- if tostring(tbl.m):len() == 1 then tbl.m = "0"..tbl.m end
- if tostring(tbl.s):len() == 1 then tbl.s = "0"..tbl.s end
- 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))
- if PS.Win then
- if CurTime()-PS.Win[1] < 10 then
- if PS.Win[2] == PS.TEAM_EUROCONV then
- 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))
- else
- 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))
- end
- end
- end
- end
- end)
- concommand.Add("Refresh",function() include("autorun/client/cl_core.lua") end)
- local rad,sin,cos = math.rad,math.sin,math.cos
- function GeneratePoly(x,y,radius,quality)
- local circle = {};
- local tmp = 0;
- for i=1,quality do
- tmp = rad(i*360)/quality
- circle[i] = {x = x + cos(tmp)*radius,y = y + sin(tmp)*radius};
- end
- return circle;
- end
- hook.Add("PostDrawOpaqueRenderables","PS.Opaque",function()
- if PS.CurrentArea == 0 or Check() == false then return end
- local pos = PS.Positions[PS.CurrentArea][1] + Vector(0,0,1)
- local radius = PS.Positions[PS.CurrentArea][2]*1.22
- if PS.Elements["Circle1"] == nil then PS.Elements["Circle1"] = GeneratePoly(0,0,radius,36) end
- cam.Start3D2D(pos,Angle(0,0,0),1)
- surface.SetMaterial(TEXTURE_OUTERDISK)
- surface.SetDrawColor(Color(255,0,255,255))
- surface.DrawTexturedRectRotated(0,0,radius*2,radius*2,CurTime()*10)
- cam.End3D2D()
- cam.Start3D2D(pos + Vector(0,0,3),Angle(0,0,0),1)
- surface.SetMaterial(TEXTURE_INNERDISK)
- surface.SetDrawColor(Color(255,255,255,255))
- surface.DrawTexturedRectRotated(0,0,radius*1.95,radius*1.95,CurTime()*-10)
- cam.End3D2D()
- end)
Advertisement
Add Comment
Please, Sign In to add comment