diff --git a/addon.txt b/addon.txt index 6345448..3d14f49 100644 --- a/addon.txt +++ b/addon.txt @@ -1,8 +1,8 @@ "AddonInfo" { "name" "SUI Scoreboard" - "version" "2.6.9" - "up_date" "2024-05-19" + "version" "2.7.0" + "up_date" "2024-05-20" "author_name" "Dathus [BR]" "author_url" "http://www.juliocesar.me" "info" "This is a Scoreboard based on SUI Scoreboard v2 developed by suicidal.banana, was modified, fixed, improved and ported to Garry's Mod 13, to work with ULX v3, Exsto, Maestro and Mercury." diff --git a/lua/autorun/_sui_scoreboard.lua b/lua/autorun/_sui_scoreboard.lua index f2cb3d6..d940f87 100644 --- a/lua/autorun/_sui_scoreboard.lua +++ b/lua/autorun/_sui_scoreboard.lua @@ -12,14 +12,14 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2024-05-19 10:24 PM (UTC -03:00) +Version 2.7 - 2024-05-20 12:17 PM (UTC -03:00) ]]-- -- Setup Class Scoreboard = {} -- Scoreboard version -Scoreboard.version = "2.6.9" +Scoreboard.version = "2.7.0" --Setup Loading Log Formatation function loadingLog (text) @@ -41,7 +41,7 @@ Msg( "\n/====================================\\\n") Msg( "|| SUI Scoreboard ||\n" ) Msg( "||----------------------------------||\n" ) loadingLog("Version " .. Scoreboard.version) -loadingLog("Updated on 2024-05-19 10:24 PM") +loadingLog("Updated on 2024-05-20 12:17 PM") Msg( "\\====================================/\n\n" ) if SERVER then diff --git a/lua/ev_plugins/sh_sui_scoreboard.lua b/lua/ev_plugins/sh_sui_scoreboard.lua index 67afb43..2127b14 100644 --- a/lua/ev_plugins/sh_sui_scoreboard.lua +++ b/lua/ev_plugins/sh_sui_scoreboard.lua @@ -12,14 +12,14 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-05 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-05 8:00 PM(UTC -03:00) ]]-- local PLUGIN = {} PLUGIN.Title = "SUI Scoreboard v2.6 for Evolve" PLUGIN.Description = "SUI Scoreboard v2.6 ported for Evolve!" -PLUGIN.Author = ".Z. Nexus" +PLUGIN.Author = "Dathus [BR]" function PLUGIN:ScoreboardShow() return Scoreboard.Show() @@ -34,4 +34,46 @@ function PLUGIN:PlayerInitialSpawn( ply ) Scoreboard.PlayerSpawn( ply ) end +if CLIENT then + -- Kick player + Scoreboard.kick = function (ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ev kick \"".. ply:Nick().. "\" \"Kicked By Administrator\"" ) + end + end + + -- Permanent ban player + Scoreboard.pBan = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ev ban \"".. ply:Nick().. "\" 0 \"Kicked By Administrator\"" ) + end + end + + -- Ban player + Scoreboard.ban = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ev ban \"".. ply:Nick().. "\" 60 \"Kicked By Administrator\"" ) + end + end + + -- Get player's Team Name + Scoreboard.getGroup = function (ply) + return evolve.ranks[ ply:EV_GetRank() ].Title + end + + -- Get player's Played time + Scoreboard.getPlayerTime = function (ply) + return evolve:Time() - ply:GetNWInt( "EV_JoinTime" ) + ply:GetNWInt( "EV_PlayTime" ) + end + +elseif SERVER then + Scoreboard.SendColor = function (ply) + tColor = evolve.ranks[ ply:EV_GetRank() ].Color + + net.Start("SUIScoreboardPlayerColor") + net.WriteTable(tColor) + net.Send(ply) + end +end + evolve:RegisterPlugin( PLUGIN ) \ No newline at end of file diff --git a/lua/exsto/plugins/shared/sui_scoreboard.lua b/lua/exsto/plugins/shared/sui_scoreboard.lua index e6b0d21..070a549 100644 --- a/lua/exsto/plugins/shared/sui_scoreboard.lua +++ b/lua/exsto/plugins/shared/sui_scoreboard.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-05 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-05 8:00 PM(UTC -03:00) ]]-- @@ -22,7 +22,7 @@ PLUGIN:SetInfo({ Name = "SUI Scoreboard v2.6 for Exsto", ID = "sui-scoreboard-v2-6", Desc = "SUI Scoreboard v2.6 ported for Exsto!", - Owner = ".Z. Nexus" + Owner = "Dathus [BR]" }) function PLUGIN:Init() @@ -40,4 +40,46 @@ function PLUGIN:PlayerInitialSpawn( ply ) Scoreboard.PlayerSpawn( ply ) end +if CLIENT then + -- Kick player + Scoreboard.kick = function (ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "exsto kick \"".. ply:Nick().. "\" \"Kicked By Administrator\"" ) + end + end + + -- Permanent ban player + Scoreboard.pBan = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "exsto ban \"".. ply:Nick().. "\" 0 \" Banned permanently by Administrator\"" ) + end + end + + -- Ban player + Scoreboard.ban = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "exsto ban \"".. ply:Nick().. "\" 60 \" Banned for 1 hour by Administrator\"" ) + end + end + + -- Get player's Team Name + Scoreboard.getGroup = function (ply) + return exsto.Ranks[ply:GetRank()].Name + end + + -- Get player's Played time + Scoreboard.getPlayerTime = function (ply) + -- Get Time + return ply:GetNWInt( "Time_Fixed" ) + (CurTime() - ply:GetNWInt( "Time_Join" )) + end +elseif SERVER then + Scoreboard.SendColor = function (ply) + tColor = team.GetColor( ply:Team()) + + net.Start("SUIScoreboardPlayerColor") + net.WriteTable(tColor) + net.Send(ply) + end +end + PLUGIN:Register() \ No newline at end of file diff --git a/lua/maestro/plugins/sh_sui_scoreboard.lua b/lua/maestro/plugins/sh_sui_scoreboard.lua index 8c772b5..9a07421 100644 --- a/lua/maestro/plugins/sh_sui_scoreboard.lua +++ b/lua/maestro/plugins/sh_sui_scoreboard.lua @@ -12,14 +12,57 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-05 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-05 8:00 PM(UTC -03:00) ]]-- if SERVER then AddCSLuaFile() hook.Add("PlayerInitialSpawn", "SUISCOREBOARD-Spawn", Scoreboard.PlayerSpawn) + + Scoreboard.SendColor = function (ply) + tColor = maestro.rankcolor(maestro.userrank(ply)) or team.GetColor(ply:Team()) + + net.Start("SUIScoreboardPlayerColor") + net.WriteTable(tColor) + net.Send(ply) + end elseif CLIENT then hook.Add("ScoreboardShow","SUISCOREBOARD-Show", Scoreboard.Show) hook.Add("ScoreboardHide", "SUISCOREBOARD-Hide", Scoreboard.Hide) + + -- Kick player + Scoreboard.kick = function (ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ms kick \"$" .. ply:SteamID() .. "\" \"Kicked By Administrator\"" ) + end + end + + -- Permanent ban player + Scoreboard.pBan = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ms ban \"$" .. ply:SteamID() .. "\" 0 \"Banned permanently by Administrator\"" ) + end + end + + -- Ban player + Scoreboard.ban = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ms ban \"$" .. ply:SteamID() .. "\" 1h \"Banned permanently by Administrator\"" ) + end + end + -- Get player's Team Name + Scoreboard.getGroup = function (ply) + return maestro.userrank(ply) + end + -- Get player's Played time + Scoreboard.getPlayerTime = function (ply) + if maestro_promote then + return CurTime() - ply:GetNWInt("maestro-promote", CurTime()) + else + -- Get Time + return ply:GetNWInt( "Time_Fixed" ) + (CurTime() - ply:GetNWInt( "Time_Join" )) + end + end + end diff --git a/lua/mercury/client/sui_scoreboard.lua b/lua/mercury/client/sui_scoreboard.lua index 5709309..239ba56 100644 --- a/lua/mercury/client/sui_scoreboard.lua +++ b/lua/mercury/client/sui_scoreboard.lua @@ -12,9 +12,41 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2024-05-19 10:47 AM(UTC -03:00) +Version 2.7 - 2024-05-19 10:47 AM(UTC -03:00) ]]-- hook.Add("ScoreboardShow","SUISCOREBOARD-Show", Scoreboard.Show) -hook.Add("ScoreboardHide", "SUISCOREBOARD-Hide", Scoreboard.Hide) \ No newline at end of file +hook.Add("ScoreboardHide", "SUISCOREBOARD-Hide", Scoreboard.Hide) + +-- Kick player +Scoreboard.kick = function (ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "hg kick \"" .. ply:SteamID() .. "\" \"Kicked By Administrator\"" ) + end +end + +-- Permanent ban player +Scoreboard.pBan = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "hg ban \"" .. ply:SteamID() .. "\" 0 \"Quick ban via scoreboard\"" ) + end +end + +-- Ban player +Scoreboard.ban = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "hg ban \"" .. ply:SteamID() .. "\" 60 \"Quick ban via scoreboard\"" ) + end +end + +-- Get player's Team Name +Scoreboard.getGroup = function (ply) + return team.GetName(ply:Team()) +end + +-- Get player's Played time +Scoreboard.getPlayerTime = function (ply) + return ply:GetNWInt("ranktime", 0) +end + \ No newline at end of file diff --git a/lua/mercury/core/extensions/sui_scoreboard.lua b/lua/mercury/core/extensions/sui_scoreboard.lua index 3a2a2cd..42550af 100644 --- a/lua/mercury/core/extensions/sui_scoreboard.lua +++ b/lua/mercury/core/extensions/sui_scoreboard.lua @@ -12,8 +12,17 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2024-05-19 10:47 AM(UTC -03:00) +Version 2.7 - 2024-05-19 10:47 AM(UTC -03:00) ]]-- -hook.Add("PlayerInitialSpawn", "SUISCOREBOARD-Spawn", Scoreboard.PlayerSpawn) \ No newline at end of file +hook.Add("PlayerInitialSpawn", "SUISCOREBOARD-Spawn", Scoreboard.PlayerSpawn) + +Scoreboard.SendColor = function (ply) + + tColor = Mercury.Ranks.RankTable[ply:GetNWString("UserRank")].color + + net.Start("SUIScoreboardPlayerColor") + net.WriteTable(tColor) + net.Send(ply) + end \ No newline at end of file diff --git a/lua/sui_scoreboard/client/admin_buttons.lua b/lua/sui_scoreboard/client/admin_buttons.lua index 5e39014..c5a94e7 100644 --- a/lua/sui_scoreboard/client/admin_buttons.lua +++ b/lua/sui_scoreboard/client/admin_buttons.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-05 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-05 8:00 PM(UTC -03:00) ]]-- diff --git a/lua/sui_scoreboard/client/library.lua b/lua/sui_scoreboard/client/library.lua index 5ba7464..ab5516b 100644 --- a/lua/sui_scoreboard/client/library.lua +++ b/lua/sui_scoreboard/client/library.lua @@ -12,86 +12,10 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-06 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-06 8:00 PM(UTC -03:00) ]]-- --- Kick player -Scoreboard.kick = function (ply) - if ply:IsValid() then - if exsto ~= nil then - LocalPlayer():ConCommand( "exsto kick \"".. ply:Nick().. "\" \"Kicked By Administrator\"" ) - elseif ulx ~= nil then - LocalPlayer():ConCommand( "ulx kick \"".. ply:Nick().. "\" \"Kicked By Administrator\"" ) - elseif evolve ~= nil then - LocalPlayer():ConCommand( "ev kick \"".. ply:Nick().. "\" \"Kicked By Administrator\"" ) - elseif maestro ~= nil then - LocalPlayer():ConCommand( "ms kick \"$" .. ply:SteamID() .. "\" \"Kicked By Administrator\"" ) - elseif Mercury~=nil then - LocalPlayer():ConCommand( "hg kick \"" .. ply:SteamID() .. "\" \"Kicked By Administrator\"" ) - end - end -end - --- Permanent ban player -Scoreboard.pBan = function(ply) - if ply:IsValid() then - if exsto ~= nil then - LocalPlayer():ConCommand( "exsto ban \"".. ply:Nick().. "\" 0 \" Banned permanently by Administrator\"" ) - elseif ulx ~= nil then - LocalPlayer():ConCommand( "ulx ban \"".. ply:Nick().. "\" 0 \" Banned permanently by Administrator\"" ) - elseif evolve ~= nil then - LocalPlayer():ConCommand( "ev ban \"".. ply:Nick().. "\" 0 \"Kicked By Administrator\"" ) - elseif maestro ~= nil then - LocalPlayer():ConCommand( "ms ban \"$" .. ply:SteamID() .. "\" 0 \"Banned permanently by Administrator\"" ) - elseif Mercury ~=nil then - LocalPlayer():ConCommand( "hg ban \"" .. ply:SteamID() .. "\" 0 \"Quick ban via scoreboard\"" ) - end - end -end - --- Ban player -Scoreboard.ban = function(ply) - if ply:IsValid() then - if exsto ~= nil then - LocalPlayer():ConCommand( "exsto ban \"".. ply:Nick().. "\" 60 \" Banned for 1 hour by Administrator\"" ) - elseif ulx ~= nil then - LocalPlayer():ConCommand( "ulx ban \"".. ply:Nick().. "\" 60 \" Banned for 1 hour by Administrator\"" ) - elseif evolve ~= nil then - LocalPlayer():ConCommand( "ev ban \"".. ply:Nick().. "\" 60 \"Kicked By Administrator\"" ) - elseif maestro ~= nil then - LocalPlayer():ConCommand( "ms ban \"$" .. ply:SteamID() .. "\" 1h \"Banned permanently by Administrator\"" ) - end - end -end - --- Get XGUI Team Name by group -Scoreboard.getXGUITeamName = function (check_group) - for _, team in ipairs( ulx.teams ) do - for _, group in ipairs( team.groups ) do - if group == check_group then - return team.name - end - end - end - return check_group -end - --- Get player's Team Name -Scoreboard.getGroup = function (ply) - if exsto ~= nil then - return exsto.Ranks[ply:GetRank()].Name - elseif ulx ~= nil then - return Scoreboard.getXGUITeamName(ply:GetUserGroup()) - elseif evolve ~= nil then - return evolve.ranks[ ply:EV_GetRank() ].Title - elseif maestro ~= nil then - return maestro.userrank(ply) - elseif Mercury ~= nil then - return team.GetName(ply:Team()) - end -end - -- Create Scoreboard VGUI Scoreboard.CreateVGUI = function() if Scoreboard.vgui then @@ -147,24 +71,6 @@ Scoreboard.formatTime = function (time) return string.format( str.."%02ih %02im %02is", h, m, s ) end --- Get player's Played time -Scoreboard.getPlayerTime = function (ply) - -- Check if ULX and uTime is Installed - if ulx ~= nil and ply:GetNWInt( "TotalUTime", -1 ) ~= -1 then - -- Get player's played time - return math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())) - elseif evolve ~= nil then - return evolve:Time() - ply:GetNWInt( "EV_JoinTime" ) + ply:GetNWInt( "EV_PlayTime" ) - elseif maestro_promote then - return CurTime() - ply:GetNWInt("maestro-promote", CurTime()) - elseif Mercury~=nil then - return ply:GetNWInt("ranktime", 0) - else - -- Get Time - return ply:GetNWInt( "Time_Fixed" ) + (CurTime() - ply:GetNWInt( "Time_Join" )) - end -end - -- Get Local Player Color Scoreboard.netGetPlayerColor = function(ply) Scoreboard.playerColor = net.ReadTable() diff --git a/lua/sui_scoreboard/client/net_client.lua b/lua/sui_scoreboard/client/net_client.lua index a982c4b..3e61542 100644 --- a/lua/sui_scoreboard/client/net_client.lua +++ b/lua/sui_scoreboard/client/net_client.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-06 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-06 8:00 PM(UTC -03:00) ]]-- diff --git a/lua/sui_scoreboard/client/player_frame.lua b/lua/sui_scoreboard/client/player_frame.lua index 0c2473b..d5d1640 100644 --- a/lua/sui_scoreboard/client/player_frame.lua +++ b/lua/sui_scoreboard/client/player_frame.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-06 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-06 8:00 PM(UTC -03:00) ]]-- diff --git a/lua/sui_scoreboard/client/player_infocard.lua b/lua/sui_scoreboard/client/player_infocard.lua index cdff1d8..c5b43c7 100644 --- a/lua/sui_scoreboard/client/player_infocard.lua +++ b/lua/sui_scoreboard/client/player_infocard.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-06 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-06 8:00 PM(UTC -03:00) ]]-- diff --git a/lua/sui_scoreboard/client/player_row.lua b/lua/sui_scoreboard/client/player_row.lua index 286c518..682119a 100644 --- a/lua/sui_scoreboard/client/player_row.lua +++ b/lua/sui_scoreboard/client/player_row.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2024-05-19 11:25 AM (UTC -03:00) +Version 2.7 - 2024-05-19 11:25 AM (UTC -03:00) ]]-- diff --git a/lua/sui_scoreboard/client/scoreboard.lua b/lua/sui_scoreboard/client/scoreboard.lua index 03f27d6..c0d47e9 100644 --- a/lua/sui_scoreboard/client/scoreboard.lua +++ b/lua/sui_scoreboard/client/scoreboard.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2024-05-19 11:25 AM(UTC -03:00) +Version 2.7 - 2024-05-19 11:25 AM(UTC -03:00) ]]-- diff --git a/lua/sui_scoreboard/client/tooltips.lua b/lua/sui_scoreboard/client/tooltips.lua index 3907b8a..16a9510 100644 --- a/lua/sui_scoreboard/client/tooltips.lua +++ b/lua/sui_scoreboard/client/tooltips.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-06 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-06 8:00 PM(UTC -03:00) ]]-- diff --git a/lua/sui_scoreboard/client/vote_button.lua b/lua/sui_scoreboard/client/vote_button.lua index 62ebf40..0e797dd 100644 --- a/lua/sui_scoreboard/client/vote_button.lua +++ b/lua/sui_scoreboard/client/vote_button.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-06 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-06 8:00 PM(UTC -03:00) ]]-- diff --git a/lua/sui_scoreboard/server/library.lua b/lua/sui_scoreboard/server/library.lua index 23d121f..ac1ab59 100644 --- a/lua/sui_scoreboard/server/library.lua +++ b/lua/sui_scoreboard/server/library.lua @@ -12,28 +12,12 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2024-05-19 10:24 PM (UTC -03:00) +Version 2.7 - 2024-05-19 10:24 PM (UTC -03:00) ]]-- util.AddNetworkString( "SUIScoreboardPlayerConnecting" ) -Scoreboard.SendColor = function (ply) - if evolve then - tColor = evolve.ranks[ ply:EV_GetRank() ].Color - elseif maestro then - tColor = maestro.rankcolor(maestro.userrank(ply)) or team.GetColor(ply:Team()) - elseif Mercury then - tColor = Mercury.Ranks.RankTable[ply:GetNWString("UserRank")].color - else - tColor = team.GetColor( ply:Team()) - end - - net.Start("SUIScoreboardPlayerColor") - net.WriteTable(tColor) - net.Send(ply) -end - --- When the player joins the server we need to restore the NetworkedInt's Scoreboard.PlayerSpawn = function ( ply ) timer.Simple( 5, function() Scoreboard.UpdatePlayerRatings( ply ) end) -- Wait a few seconds so we avoid timeouts. diff --git a/lua/sui_scoreboard/server/rating.lua b/lua/sui_scoreboard/server/rating.lua index f4babca..a367177 100644 --- a/lua/sui_scoreboard/server/rating.lua +++ b/lua/sui_scoreboard/server/rating.lua @@ -12,7 +12,7 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-06 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-06 8:00 PM(UTC -03:00) ]]-- diff --git a/lua/ulx/modules/sh/sui_scoreboard.lua b/lua/ulx/modules/sh/sui_scoreboard.lua index 8acb7cb..aa236c8 100644 --- a/lua/ulx/modules/sh/sui_scoreboard.lua +++ b/lua/ulx/modules/sh/sui_scoreboard.lua @@ -12,14 +12,71 @@ Copyright only on the code that I wrote, my implementation and fixes and etc, Th ---------------------------------------------------------------------------------------------------------------------------- $Id$ -Version 2.6 - 2023-06-06 8:00 PM(UTC -03:00) +Version 2.7 - 2023-06-06 8:00 PM(UTC -03:00) ]]-- if SERVER then AddCSLuaFile() hook.Add("PlayerInitialSpawn", "SUISCOREBOARD-Spawn", Scoreboard.PlayerSpawn) + Scoreboard.SendColor = function (ply) + tColor = team.GetColor( ply:Team()) + + net.Start("SUIScoreboardPlayerColor") + net.WriteTable(tColor) + net.Send(ply) + end elseif CLIENT then hook.Add("ScoreboardShow","SUISCOREBOARD-Show", Scoreboard.Show) hook.Add("ScoreboardHide", "SUISCOREBOARD-Hide", Scoreboard.Hide) + -- Kick player + Scoreboard.kick = function (ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ulx kick \"".. ply:Nick().. "\" \"Kicked By Administrator\"" ) + end + end + + -- Permanent ban player + Scoreboard.pBan = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ulx ban \"".. ply:Nick().. "\" 0 \" Banned permanently by Administrator\"" ) + end + end + + -- Ban player + Scoreboard.ban = function(ply) + if ply:IsValid() then + LocalPlayer():ConCommand( "ulx ban \"".. ply:Nick().. "\" 60 \" Banned for 1 hour by Administrator\"" ) + end + end + + -- Get XGUI Team Name by group + Scoreboard.getXGUITeamName = function (check_group) + for _, team in ipairs( ulx.teams ) do + for _, group in ipairs( team.groups ) do + if group == check_group then + return team.name + end + end + end + return check_group + end + + -- Get player's Team Name + Scoreboard.getGroup = function (ply) + return Scoreboard.getXGUITeamName(ply:GetUserGroup()) + end + + -- Get player's Played time + Scoreboard.getPlayerTime = function (ply) + -- Check if ULX and uTime is Installed + if ply:GetNWInt( "TotalUTime", -1 ) ~= -1 then + -- Get player's played time + return math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())) + else + -- Get Time + return ply:GetNWInt( "Time_Fixed" ) + (CurTime() - ply:GetNWInt( "Time_Join" )) + end + end + end \ No newline at end of file