From 91b518976fa70f7bce87943c434f565746e90ad3 Mon Sep 17 00:00:00 2001 From: Jacob Date: Sat, 31 Oct 2015 02:41:06 -0400 Subject: [PATCH 1/6] Fixed current map check A previous logic error, the command was not checking to see if the map was currently what the players were on. Fixed to check it. --- lua/moderator/commands/sh_map.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lua/moderator/commands/sh_map.lua b/lua/moderator/commands/sh_map.lua index e2ebfd8..82283ea 100644 --- a/lua/moderator/commands/sh_map.lua +++ b/lua/moderator/commands/sh_map.lua @@ -1,3 +1,9 @@ +--[[ + Moderator Map Command + Last Updated: 10/31/2015 + Purpose: A command that allows the client to change the map to an existing one on the server. +]] + local COMMAND = {} COMMAND.name = "Map" COMMAND.icon = "map" @@ -10,15 +16,15 @@ local COMMAND = {} local map = arguments[1] local currentmap = game.GetMap() - if map && file.Exists("maps/"..map..".bsp", "GAME") then + if map && file.Exists("maps/"..map..".bsp", "GAME") && map != currentmap then -- Need to see if the file exists naturally, and we also need to check to see if the current map is the one they're trying to change it to. moderator.NotifyAction(client, nil, "has changed the map to "..map) - timer.Simple(0.5, function() + timer.Simple(0.5, function() -- We do a timer just to add a slight delay. RunConsoleCommand("changelevel", map) end) elseif map == currentmap then client:ChatPrint("You can't change the map to the map we're already on!") - else + else -- If all else fails, the map just doesn't exist. client:ChatPrint("That is not a valid map!") end end From 7ba7decb86c51ae8ac81376cc1a722f7d469d476 Mon Sep 17 00:00:00 2001 From: Jacob Date: Sat, 31 Oct 2015 11:40:53 -0400 Subject: [PATCH 2/6] Remove current map check. Seeing as players should be able to restart the map, no need for a current map check. --- lua/moderator/commands/sh_map.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/moderator/commands/sh_map.lua b/lua/moderator/commands/sh_map.lua index 82283ea..37a8800 100644 --- a/lua/moderator/commands/sh_map.lua +++ b/lua/moderator/commands/sh_map.lua @@ -14,18 +14,15 @@ local COMMAND = {} function COMMAND:OnRun(client, arguments) local map = arguments[1] - local currentmap = game.GetMap() - if map && file.Exists("maps/"..map..".bsp", "GAME") && map != currentmap then -- Need to see if the file exists naturally, and we also need to check to see if the current map is the one they're trying to change it to. + if map && file.Exists("maps/"..map..".bsp", "GAME") then -- Need to see if the file exists naturally. moderator.NotifyAction(client, nil, "has changed the map to "..map) timer.Simple(0.5, function() -- We do a timer just to add a slight delay. RunConsoleCommand("changelevel", map) end) - elseif map == currentmap then - client:ChatPrint("You can't change the map to the map we're already on!") else -- If all else fails, the map just doesn't exist. client:ChatPrint("That is not a valid map!") end end -moderator.commands.map = COMMAND \ No newline at end of file +moderator.commands.map = COMMAND From 5f3c0c4aeb7c0c0d1b5bcd82c4f1479dd25319f9 Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 27 Nov 2015 03:06:18 -0500 Subject: [PATCH 3/6] Added player colour as a setting Updated the default groups as well as the template group with this change, and added the option under groups. Replaced the player's tab colour with their group colour as well. --- lua/moderator/derma/menus/cl_groups.lua | 17 +++++++++++++++++ lua/moderator/derma/menus/cl_players.lua | 4 ++-- lua/moderator/libs/sh_groups.lua | 14 ++++++++++---- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/lua/moderator/derma/menus/cl_groups.lua b/lua/moderator/derma/menus/cl_groups.lua index 333c12c..6dab819 100644 --- a/lua/moderator/derma/menus/cl_groups.lua +++ b/lua/moderator/derma/menus/cl_groups.lua @@ -90,6 +90,16 @@ local CATEGORY = {} name:SetTall(24) name:DockMargin(4, 0, 4, 4) panel.name = name + + panel:AddHeader("Colour", content) + + local colour = content:Add("DColorMixer") + colour:Dock(TOP) + colour:SetTall(186) + colour:DockMargin(4, 0, 4, 4) + colour:SetPalette(false) + colour:SetAlphaBar(false) + panel.colour = colour panel:AddHeader("Icon", content) @@ -167,6 +177,13 @@ local CATEGORY = {} choose:SetValue(value) lastName = value end + + print(groupTable.colour) + colour:SetColor(groupTable.colour or Color(255, 255, 255)) + + colour.ValueChanged = function(this) + moderator.UpdateGroup(data, "colour", colour:GetColor()) + end icons:SelectIcon("icon16/"..(groupTable.icon or "user")..".png") icons:ScrollToSelected() diff --git a/lua/moderator/derma/menus/cl_players.lua b/lua/moderator/derma/menus/cl_players.lua index 9e6363c..fc037d6 100644 --- a/lua/moderator/derma/menus/cl_players.lua +++ b/lua/moderator/derma/menus/cl_players.lua @@ -264,9 +264,9 @@ local CATEGORY = {} surface.DrawOutlinedRect(0, 0, w, h) if (self.playerSet) then - local teamColor = team.GetColor(self.player:Team()) + local rankcolour = moderator.GetGroupTable(moderator.GetGroup(self.player)).colour - surface.SetDrawColor(teamColor) + surface.SetDrawColor(rankcolour) surface.DrawRect(w - 7, 1, 6, h - 2) end end diff --git a/lua/moderator/libs/sh_groups.lua b/lua/moderator/libs/sh_groups.lua index b4c6cca..db7389e 100644 --- a/lua/moderator/libs/sh_groups.lua +++ b/lua/moderator/libs/sh_groups.lua @@ -4,16 +4,18 @@ if (!moderator.groups) then moderator.groups = {} moderator.groups.owner = { - immunity = 99, name = "Owner", + icon = "key", + colour = Color(41, 128, 185), access = true, - icon = "key" + immunity = 99 } moderator.groups.superadmin = { name = "Super Admin", inherit = "admin", icon = "shield", + colour = Color(115, 30, 171), immunity = 15 } @@ -21,6 +23,7 @@ if (!moderator.groups) then name = "Admin", inherit = "moderator", icon = "star", + colour = Color(149, 15, 15), access = { ["arm"] = true, ["armor"] = true, @@ -38,7 +41,9 @@ if (!moderator.groups) then moderator.groups.moderator = { name = "Moderator", + inherit = "user", icon = "wrench", + colour = Color(216, 128, 26), access = { ["goto"] = true, ["tp"] = true, @@ -47,13 +52,13 @@ if (!moderator.groups) then ["freeze"] = true, ["return"] = true }, - inherit = "user", immunity = 5 } moderator.groups.user = { name = "User", immunity = 0, + colour = Color(166, 166, 166), access = { ["report"] = true } @@ -70,7 +75,8 @@ moderator.defaultGroups["user"] = true moderator.templateGroup = { name = "New Group", immunity = 0, - icon = "user" + icon = "user", + colour = Color(255, 255, 255) } if (SERVER) then From 9bfb1184de07aa997cea320a6d4a706cd3b34b5f Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 31 Oct 2016 20:10:11 -0400 Subject: [PATCH 4/6] Fixed Kicking Error --- lua/moderator/commands/sh_kick.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/moderator/commands/sh_kick.lua b/lua/moderator/commands/sh_kick.lua index 5373ae0..2985eef 100644 --- a/lua/moderator/commands/sh_kick.lua +++ b/lua/moderator/commands/sh_kick.lua @@ -9,7 +9,11 @@ local COMMAND = {} local reason = "no reason" if (#arguments > 0) then - reason = table.concat(arguments, " ") + if (isstring(arguments[1])) then + reason = table.concat(arguments, " ") + else + reason = arguments[2] + end end local oldReason = reason @@ -69,4 +73,4 @@ local COMMAND = {} end) end end -moderator.commands.kick = COMMAND \ No newline at end of file +moderator.commands.kick = COMMAND From 004abbc97c8bc7aabd2313ca49ee205f4481f7a7 Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 31 Oct 2016 20:10:46 -0400 Subject: [PATCH 5/6] Fixed OnClick error The menu nor the client were being sent to the OnClick function, which was preventing menus from appearing. --- lua/moderator/derma/menus/cl_players.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/moderator/derma/menus/cl_players.lua b/lua/moderator/derma/menus/cl_players.lua index fc037d6..b5436a5 100644 --- a/lua/moderator/derma/menus/cl_players.lua +++ b/lua/moderator/derma/menus/cl_players.lua @@ -92,7 +92,7 @@ local CATEGORY = {} Send(...) end - v:OnClick() + v:OnClick(v.menu, LocalPlayer()) v.menu:Open() v.menu = nil else @@ -322,4 +322,4 @@ moderator.menus.players = CATEGORY concommand.Add("mod_clearselected", function() moderator.selected = {} -end) \ No newline at end of file +end) From ff762826af56d89d1c28f17c85d6efbc5516e28c Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 31 Oct 2016 20:18:20 -0400 Subject: [PATCH 6/6] Fixed Ban Error You already use target as an argument in the function, no need to search for it in the players. --- lua/moderator/commands/sh_ban.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/moderator/commands/sh_ban.lua b/lua/moderator/commands/sh_ban.lua index 19eb6d1..a361e74 100644 --- a/lua/moderator/commands/sh_ban.lua +++ b/lua/moderator/commands/sh_ban.lua @@ -9,8 +9,6 @@ local COMMAND = {} COMMAND.example = "!ban Troll 1w \"being a troll, banned for a week\" - Bans a troll for one week." function COMMAND:OnRun(client, arguments, target) - local target = moderator.FindPlayerByName(arguments[1], false, 1) - if (!target and !arguments[1]:match("STEAM_[0-5]:[0-9]:[0-9]+") and arguments[1]:lower() != "bot") then return false, "you need to provide a valid player or steamID." end