Skip to content

Commit

Permalink
Version 2.7.0
Browse files Browse the repository at this point in the history
Implemented a modular admin addon dependency. Removed lots of Ifs and moved the code to each admin addon folder. This way is more elegant, and should be easier to port this addon to other admin addons.
  • Loading branch information
juliocoliveira committed May 20, 2024
1 parent 22fd9e7 commit 7082dfe
Show file tree
Hide file tree
Showing 19 changed files with 251 additions and 136 deletions.
4 changes: 2 additions & 2 deletions addon.txt
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
6 changes: 3 additions & 3 deletions lua/autorun/_sui_scoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
46 changes: 44 additions & 2 deletions lua/ev_plugins/sh_sui_scoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 )
46 changes: 44 additions & 2 deletions lua/exsto/plugins/shared/sui_scoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]]--

Expand All @@ -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()
Expand All @@ -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()
45 changes: 44 additions & 1 deletion lua/maestro/plugins/sh_sui_scoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 34 additions & 2 deletions lua/mercury/client/sui_scoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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

13 changes: 11 additions & 2 deletions lua/mercury/core/extensions/sui_scoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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
2 changes: 1 addition & 1 deletion lua/sui_scoreboard/client/admin_buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]]--

Expand Down
Loading

0 comments on commit 7082dfe

Please sign in to comment.