Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-----------------------------------------------------------
- In-Game Scoreboard
- Copyright © 2017 Patryk (Paxon57) Chruśniak
- All Rights Reserved
- -------------------------------------------------------------*/
- include("shared.lua")
- include("config.lua")
- include("scoreboard_fonts.lua")
- local joinTime = CurTime()
- local hUpTime = 0
- local mUpTime = 0
- local Connected = player.GetAll()
- local MaxScroll = math.Clamp(#Connected - 6,0,200)
- local AScroll = -MaxScroll
- local CurScroll = 0
- local AutoScroll = paxsbcfg.AutoScroll
- local UseKey = false
- local SortMode = 1
- local Inverted = false
- local function stringtime(time)
- if time >= 60 and time % 60 == 0 then
- hUpTime = math.floor(time / 3600)
- mUpTime = (time-(hUpTime*3600)) / 60
- end
- if hUpTime==1 then return tostring(hUpTime).." hour, "..tostring(mUpTime).." minutes!" end
- return tostring(hUpTime).." heures, "..tostring(mUpTime).." minutes!"
- end
- hook.Add( "KeyPress", "paxsb_keypressuse", function( ply, key )
- if !timer.Exists("waitforit") and ( key == IN_USE ) then
- UseKey = true
- timer.Create("waitforit",0.1, 1, function()end)
- end
- end )
- --function ENT:Initialize()
- -- local scale = Vector( 0.1, 1, 1 )
- -- local mat = Matrix()
- -- mat:Scale( scale )
- -- self:EnableMatrix( "RenderMultiply", mat )
- --end
- function ENT:Draw()
- self:DrawModel()
- local function GetCursorPos()
- local cursorpos = util.IntersectRayWithPlane(LocalPlayer():EyePos(),LocalPlayer():GetAimVector(),self:GetPos(),self:GetUp())
- if not isvector(cursorpos) then return Vector(0,0,0) end
- local m1 = self:GetBoneMatrix(0)
- local m2 = Matrix()
- m2:SetTranslation(cursorpos)
- local mlocal = m1:GetInverseTR()*m2
- cursorpos = mlocal:GetTranslation()
- cursorpos = cursorpos + Vector(145,150,0)
- cursorpos = Vector(0, cursorpos.y, cursorpos.x)
- return cursorpos
- end
- local cursorpos = GetCursorPos()
- local Connected = player.GetAll()
- local GroupConnected = Connected
- local MaxScroll = math.Clamp(#Connected - 6,0,200)
- --------------------------------------------------------------------------------------------------------------
- if UseKey == true then
- --AutoScrollSwitch
- if cursorpos.y >= 51.5 and cursorpos.y <= 61.5 and cursorpos.z >= 110 and cursorpos.z <= 120 then
- if AutoScroll == true then
- AutoScroll = false
- else
- AutoScroll = true
- end
- --Scroll Up
- elseif cursorpos.y >= 65.6 and cursorpos.y <= 74.6 and cursorpos.z >= 105.5 and cursorpos.z <= 114.5 then
- CurScroll = CurScroll - 1
- if CurScroll < 0 then CurScroll = 0 end
- --Scroll Down
- elseif cursorpos.y >= 65.6 and cursorpos.y <= 74.6 and cursorpos.z >= 115.5 and cursorpos.z <= 124.5 then
- CurScroll = CurScroll + 1
- if CurScroll > MaxScroll then CurScroll = MaxScroll end
- --Srting Modes
- elseif cursorpos.y >= 86.3 and cursorpos.y <= 106.3 and cursorpos.z >= 20.5 and cursorpos.z <= 33.5 then
- if SortMode == 0 and !Inverted then
- Inverted = true
- elseif SortMode == 0 and Inverted then
- Inverted = false
- else
- SortMode = 0
- Inverted = false
- end
- elseif cursorpos.y >= 204 and cursorpos.y <= 226 and cursorpos.z >= 20.5 and cursorpos.z <= 33.5 then
- if SortMode == 1 and !Inverted then
- Inverted = true
- elseif SortMode == 1 and Inverted then
- Inverted = false
- else
- SortMode = 1
- Inverted = false
- end
- elseif cursorpos.y >= 230 and cursorpos.y <= 246 and cursorpos.z >= 20.5 and cursorpos.z <= 33.5 then
- if SortMode == 2 and !Inverted then
- Inverted = true
- elseif SortMode == 2 and Inverted then
- Inverted = false
- else
- SortMode = 2
- Inverted = false
- end
- elseif cursorpos.y >= 248.5 and cursorpos.y <= 273.5 and cursorpos.z >= 20.5 and cursorpos.z <= 33.5 then
- if SortMode == 3 and !Inverted then
- Inverted = true
- elseif SortMode == 3 and Inverted then
- Inverted = false
- else
- SortMode = 3
- Inverted = false
- end
- elseif cursorpos.y >= 277.5 and cursorpos.y <= 294.5 and cursorpos.z >= 20.5 and cursorpos.z <= 33.5 then
- if SortMode == 4 and !Inverted then
- Inverted = true
- elseif SortMode == 4 and Inverted then
- Inverted = false
- else
- SortMode = 4
- Inverted = false
- end
- end
- UseKey = false
- end
- -------------------------------------------------------------------------------------------------------------
- if SortMode == 0 then
- if !Inverted then
- table.sort(Connected, function(a,b) return a:Name() > b:Name() end )
- else
- table.sort(Connected, function(a,b) return a:Name() < b:Name() end )
- end
- elseif SortMode == 2 then
- if !Inverted then
- table.sort(Connected, function(a,b) return a:Frags() > b:Frags() end )
- else
- table.sort(Connected, function(a,b) return a:Frags() < b:Frags() end )
- end
- elseif SortMode == 3 then
- if !Inverted then
- table.sort(Connected, function(a,b) return a:Deaths() > b:Deaths() end )
- else
- table.sort(Connected, function(a,b) return a:Deaths() < b:Deaths() end )
- end
- elseif SortMode == 4 then
- if !Inverted then
- table.sort(Connected, function(a,b) return a:Ping() < b:Ping() end )
- else
- table.sort(Connected, function(a,b) return a:Ping() > b:Ping() end )
- end
- end
- if AutoScroll == true then
- if !timer.Exists("scroll") then
- timer.Create("scroll", 1.5, 1, function()
- CurScroll = math.abs(AScroll)
- AScroll = AScroll + 1
- if AScroll >= MaxScroll then AScroll = -MaxScroll end
- end)
- end
- end
- local uptime = math.Round(CurTime() - joinTime)
- uptime = uptime * 180
- local time = SysTime()
- self:SetRenderBounds(Vector(-150,-150,-1),Vector(150,150,1))
- self:DrawModel()
- local pos = self:GetPos() + self:GetForward()*-144 + self:GetUp()*1 + self:GetRight()*150
- local ang = self:GetAngles()
- ang:RotateAroundAxis(self:GetUp(),-90)
- ang:RotateAroundAxis(self:GetRight(),180)
- ang:RotateAroundAxis(self:GetForward(),180)
- cam.Start3D2D(pos,ang,0.1)
- draw.RoundedBox(25,0,0,3000,1500,paxsbcfg.Color)
- draw.RoundedBox(15,15,15,2970,140,Color(paxsbcfg.Color.r + 15,paxsbcfg.Color.g + 15,paxsbcfg.Color.b + 15))
- draw.RoundedBox(15,15,180,800,320,Color(paxsbcfg.Color.r + 25,paxsbcfg.Color.g + 25,paxsbcfg.Color.b + 25))
- draw.RoundedBox(15,15,520,800,500,Color(paxsbcfg.Color.r + 35,paxsbcfg.Color.g + 35,paxsbcfg.Color.b + 35))
- draw.RoundedBox(15,835,175,2145,1310,Color(paxsbcfg.Color.r + 45,paxsbcfg.Color.g + 45,paxsbcfg.Color.b + 45))
- draw.RoundedBox(15,15,1285,800,200,Color(paxsbcfg.Color.r + 15,paxsbcfg.Color.g + 15,paxsbcfg.Color.b + 15))
- draw.RoundedBox(15,15,1050,800,200,Color(paxsbcfg.Color.r + 25,paxsbcfg.Color.g + 25,paxsbcfg.Color.b + 25))
- ----ARROWS
- draw.RoundedBox(15,15,1050,800,200,Color(paxsbcfg.Color.r + 25,paxsbcfg.Color.g + 25,paxsbcfg.Color.b + 25))
- draw.RoundedBox(15,656,1055,90,90,paxsbcfg.Color)
- draw.RoundedBox(15,656,1155,90,90,paxsbcfg.Color)
- if AutoScroll == true then
- draw.RoundedBox(15,515,1100,100,100,paxsbcfg.FontColor)
- else
- draw.RoundedBox(15,515,1100,100,100,paxsbcfg.FontColor)
- draw.RoundedBox(15,525,1110,80,80,Color(paxsbcfg.Color.r + 25,paxsbcfg.Color.g + 25,paxsbcfg.Color.b + 25))
- end
- draw.SimpleText("Bienvenue, "..LocalPlayer():GetName(),"paxwelcome",50,25,paxsbcfg.FontColor,TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP)
- draw.SimpleText("Joueurs en ligne:","paxwelcome",415,570,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP)
- draw.SimpleText(tostring(#Connected).."/"..tostring(game.MaxPlayers()),"paxplayers",415,770,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP)
- draw.SimpleText("Serveur: ","paxdata",415,200,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP)
- draw.SimpleText(GetHostName(),"paxservername",415,270,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP)
- draw.SimpleText("Gamemode: "..tostring(gmod.GetGamemode().Name),"paxdata",415,340,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP)
- draw.SimpleText("Map: "..game.GetMap(),"paxdata",415,410,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP)
- draw.SimpleText("En ligne depuis: "..stringtime(uptime),"paxwelcome",2975,25,paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- draw.SimpleText("AutoScroll","paxwelcome",50,1150,paxsbcfg.FontColor,TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
- draw.SimpleText("˄","paxclock",700,1090,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- draw.SimpleText("˅","paxclock",700,1190,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- draw.SimpleText(os.date( "%H:%M:%S" , os.time() ),"paxclock",415,1385,paxsbcfg.FontColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- draw.RoundedBox(15,850,190,2115,160,Color(paxsbcfg.Color.r + 15,paxsbcfg.Color.g + 15,paxsbcfg.Color.b + 15))
- ---Sort
- if SortMode == 0 then
- draw.RoundedBox(15,863,205,200,130,Color(paxsbcfg.Color.r + 35,paxsbcfg.Color.g + 35,paxsbcfg.Color.b + 35))
- elseif SortMode == 1 and paxsbcfg.GroupOrJob == 0 then
- draw.RoundedBox(15,2040,205,220,130,Color(paxsbcfg.Color.r + 35,paxsbcfg.Color.g + 35,paxsbcfg.Color.b + 35))
- elseif SortMode == 1 and paxsbcfg.GroupOrJob == 1 then
- draw.RoundedBox(15,2115,205,150,130,Color(paxsbcfg.Color.r + 35,paxsbcfg.Color.g + 35,paxsbcfg.Color.b + 35))
- elseif SortMode == 2 then
- draw.RoundedBox(15,2300,205,160,130,Color(paxsbcfg.Color.r + 35,paxsbcfg.Color.g + 35,paxsbcfg.Color.b + 35))
- elseif SortMode == 3 then
- draw.RoundedBox(15,2485,205,250,130,Color(paxsbcfg.Color.r + 35,paxsbcfg.Color.g + 35,paxsbcfg.Color.b + 35))
- elseif SortMode == 4 then
- draw.RoundedBox(15,2775,205,170,130,Color(paxsbcfg.Color.r + 35,paxsbcfg.Color.g + 35,paxsbcfg.Color.b + 35))
- end
- draw.SimpleText("Nom","paxplyinfo",865,225,paxsbcfg.FontColor,TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP)
- if paxsbcfg.GroupOrJob == 0 then
- draw.SimpleText("Groupe","paxplyinfo",2250,225,paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- else
- draw.SimpleText("Job","paxplyinfo",2250,225,paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- end
- draw.SimpleText("Ping","paxplyinfo",2935,225,paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- draw.SimpleText("Kills","paxplyinfo",2450,225,paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- draw.SimpleText("Deaths","paxplyinfo",2725,225,paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- for i, v in pairs(Connected) do
- if i % 2 == 0 then
- paxPlayerTileColor = Color(paxsbcfg.Color.r + 15,paxsbcfg.Color.g + 15,paxsbcfg.Color.b + 15)
- else
- paxPlayerTileColor = Color(paxsbcfg.Color.r + 25,paxsbcfg.Color.g + 25,paxsbcfg.Color.b + 25)
- end
- if i > CurScroll and i <= 6 + CurScroll then
- draw.RoundedBox(15,850,190 + 180*(i-CurScroll),2115,160,paxPlayerTileColor)
- draw.SimpleText(v:GetName(),"paxplyinfo",865,230 + 180*(i-CurScroll),paxsbcfg.FontColor,TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP)
- if paxsbcfg.GroupOrJob == 0 then
- draw.SimpleText(v:GetUserGroup(),"paxplyinfo",2250,230 + 180*(i-CurScroll),paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- else
- draw.SimpleText(v:getJobTable().name,"paxplyinfo",2250,230 + 180*(i-CurScroll),paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- end
- draw.SimpleText(v:Ping(),"paxplyinfo",2935,230 + 180*(i-CurScroll),paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- draw.SimpleText(v:Frags(),"paxplyinfo",2450,230 + 180*(i-CurScroll),paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- draw.SimpleText(v:Deaths(),"paxplyinfo",2725,230 + 180*(i-CurScroll),paxsbcfg.FontColor,TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP)
- end
- end
- cam.End3D2D()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement