From 7a31161e59b34d34917a5c8826d5187fd63e844b Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Thu, 17 Aug 2017 20:08:23 -0400 Subject: Made console commands admin-only this was probably a big security bug or something lol --- gamemode/core/combat/cl_weaponswing.lua | 1 + gamemode/core/combat/sv_weaponswing.lua | 2 ++ gamemode/core/database/sv_setup.lua | 3 ++- gamemode/core/inventory/sv_invtracker.lua | 2 ++ gamemode/core/npc/sv_npcsystem.lua | 3 ++- gamemode/core/pac/sv_pac.lua | 8 ++++++-- 6 files changed, 15 insertions(+), 4 deletions(-) (limited to 'gamemode/core') diff --git a/gamemode/core/combat/cl_weaponswing.lua b/gamemode/core/combat/cl_weaponswing.lua index 74365b1..11557e5 100644 --- a/gamemode/core/combat/cl_weaponswing.lua +++ b/gamemode/core/combat/cl_weaponswing.lua @@ -84,6 +84,7 @@ net.Receive("artery_doanimation",function() end) concommand.Add("artery_startanimation",function(ply,cmd,args) + if not ply:IsAdmin() then return end swingtbl = {} ply:SetLuaAnimation(args[1]) timer.Simple(args[2],function() diff --git a/gamemode/core/combat/sv_weaponswing.lua b/gamemode/core/combat/sv_weaponswing.lua index 0b37c0a..29afd7a 100644 --- a/gamemode/core/combat/sv_weaponswing.lua +++ b/gamemode/core/combat/sv_weaponswing.lua @@ -91,6 +91,7 @@ end --Create a fake thing in front of the player, do the swing animations, and record them. concommand.Add("artery_recordanimations",function(ply,cmd,args) + if not ply:IsAdmin() then return end local e = ply e:SetAngles(Angle(0,0,0)) e:SetEyeAngles(Angle(0,0,0)) @@ -177,6 +178,7 @@ concommand.Add("artery_checkSwingable",function(ply,cmd,args) end) concommand.Add("artery_clearswingable",function(ply,cmd,args) + if not ply:IsAdmin() then return end swingable = {} end) diff --git a/gamemode/core/database/sv_setup.lua b/gamemode/core/database/sv_setup.lua index 743e19a..400473e 100644 --- a/gamemode/core/database/sv_setup.lua +++ b/gamemode/core/database/sv_setup.lua @@ -20,7 +20,7 @@ SELECT PlayerData, MetaData FROM playerdata WHERE SteamID=%.0f ]] local save_player_query = [[ -UPDATE playerdata SET MetaData='%s' PlayerData='%s' WHERE SteamID=%.0f +UPDATE playerdata SET MetaData=%s PlayerData=%s WHERE SteamID=%.0f ]] local function q_fai(err,query) @@ -120,6 +120,7 @@ function sql.SendPlayerToInstance(ply,ls,ll) end concommand.Add("DoQuery",function(ply,cmd,args) + if not ply:IsAdmin() then return end if args[1] == "create" then sql.CreatePlayerTable(ply) elseif args[1] == "get" then diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua index d4e7d79..c60298c 100644 --- a/gamemode/core/inventory/sv_invtracker.lua +++ b/gamemode/core/inventory/sv_invtracker.lua @@ -257,10 +257,12 @@ concommand.Add("artery_ShowMyInventories",function(ply,cmd,args) end) concommand.Add("artery_AddInventory",function(ply,cmd,args) + if not ply:IsAdmin() then return end track.GiveInventoryTo(ply,args[1]) end) concommand.Add("artery_GiveItem",function(ply,cmd,args) + if not ply:IsAdmin() then return end xpcall(function() ply:GiveItem(itm.GetItemByName(args[1])) end,function(err) diff --git a/gamemode/core/npc/sv_npcsystem.lua b/gamemode/core/npc/sv_npcsystem.lua index c53f6ae..0b250ac 100644 --- a/gamemode/core/npc/sv_npcsystem.lua +++ b/gamemode/core/npc/sv_npcsystem.lua @@ -99,7 +99,8 @@ hook.Add("InitPostEntity", "artery_spawnmapnpcs", function() loadMap() end) -concommand.Add("artery_reloadmap", function() +concommand.Add("artery_reloadmap", function(ply,cmd,args) + if not ply:IsAdmin() then return end for k, v in pairs(removeents) do local eot = ents.FindByClass(v) diff --git a/gamemode/core/pac/sv_pac.lua b/gamemode/core/pac/sv_pac.lua index ad54106..6b60340 100644 --- a/gamemode/core/pac/sv_pac.lua +++ b/gamemode/core/pac/sv_pac.lua @@ -69,7 +69,10 @@ local function loadhashes() end end loadhashes() -concommand.Add("artery_reload_pac_hashes",loadhashes) +concommand.Add("artery_reload_pac_hashes",function(ply,cmd,args) + if not ply:IsAdmin() then return end + loadhashes() +end) concommand.Add("artery_print_pac_hashes",function(ply,cmd,args) PrintTable(pachashes) end) @@ -187,7 +190,8 @@ net.Receive("artery_requestpac",function(ln,ply) end) --Does all the things needed to edit pac's live -concommand.Add("artery_reload_pacs",function() +concommand.Add("artery_reload_pacs",function(ply,cmd,args) + if not ply:IsAdmin() then return end pac_cache = {} pacs_in_cache = 0 loadhashes() -- cgit v1.2.3-70-g09d2