Merge pull request #8 from 0tt/master

Added Maestro support
This commit is contained in:
Júlio C. Oliveira 2016-07-29 15:10:05 -03:00 committed by GitHub
commit 9964ff2b5b
3 changed files with 42 additions and 5 deletions

View File

@ -0,0 +1,25 @@
--[[
SUI Scoreboard v2.6 by .Z. Nexus is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
----------------------------------------------------------------------------------------------------------------------------
Copyright (c) 2014 .Z. Nexus <http://www.nexusbr.net> <http://steamcommunity.com/profiles/76561197983103320>
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_US.
----------------------------------------------------------------------------------------------------------------------------
This Addon is based on the original SUI Scoreboard v2 developed by suicidal.banana.
Copyright only on the code that I wrote, my implementation and fixes and etc, The Initial version (v2) code still is from suicidal.banana.
----------------------------------------------------------------------------------------------------------------------------
$Id$
Version 2.6.2 - 12-06-2014 05:33 PM(UTC -03:00)
]]--
if SERVER then
AddCSLuaFile()
hook.Add("PlayerInitialSpawn", "SUISCOREBOARD-Spawn", Scoreboard.PlayerSpawn)
elseif CLIENT then
hook.Add("ScoreboardShow","SUISCOREBOARD-Show", Scoreboard.Show)
hook.Add("ScoreboardHide", "SUISCOREBOARD-Hide", Scoreboard.Hide)
end

View File

@ -25,6 +25,8 @@ Scoreboard.kick = function (ply)
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\"" )
end
end
end
@ -38,6 +40,8 @@ Scoreboard.pBan = function(ply)
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\"" )
end
end
end
@ -51,6 +55,8 @@ Scoreboard.ban = function(ply)
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
@ -75,6 +81,8 @@ Scoreboard.getGroup = function (ply)
return Scoreboard.getXGUITeamName(ply:GetUserGroup())
elseif evolve ~= nil then
return evolve.ranks[ ply:EV_GetRank() ].Title
elseif maestro ~= nil then
return maestro.userrank(ply)
end
end
@ -141,6 +149,8 @@ Scoreboard.getPlayerTime = function (ply)
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())
else
-- Get Time
return ply:GetNWInt( "Time_Fixed" ) + (CurTime() - ply:GetNWInt( "Time_Join" ))
@ -150,4 +160,4 @@ end
-- Get Local Player Color
Scoreboard.netGetPlayerColor = function(ply)
Scoreboard.playerColor = net.ReadTable()
end
end

View File

@ -17,10 +17,12 @@ Version 2.6.2 - 12-06-2014 05:33 PM(UTC -03:00)
]]--
Scoreboard.SendColor = function (ply)
if evolve == nil then
tColor = team.GetColor( ply:Team())
else
if evolve then
tColor = evolve.ranks[ ply:EV_GetRank() ].Color
elseif maestro then
tColor = maestro.rankcolor(maestro.userrank(ply)) or team.GetColor(ply:Team())
else
tColor = team.GetColor( ply:Team())
end
net.Start("SUIScoreboardPlayerColor")
@ -32,4 +34,4 @@ end
Scoreboard.PlayerSpawn = function ( ply )
timer.Simple( 5, function() Scoreboard.UpdatePlayerRatings( ply ) end) -- Wait a few seconds so we avoid timeouts.
Scoreboard.SendColor(ply)
end
end