diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-17 20:08:23 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-17 20:08:23 -0400 |
| commit | 7a31161e59b34d34917a5c8826d5187fd63e844b (patch) | |
| tree | 85694d3dc3429f2a3c2183f03b5e7c7a818958b3 | |
| parent | fcffbc1ff27a7cb28bab85b223be7060c481bf8b (diff) | |
| download | artery-7a31161e59b34d34917a5c8826d5187fd63e844b.tar.gz artery-7a31161e59b34d34917a5c8826d5187fd63e844b.tar.bz2 artery-7a31161e59b34d34917a5c8826d5187fd63e844b.zip | |
Made console commands admin-only
this was probably a big security bug or something lol
| -rw-r--r-- | entities/entities/art_droppeditem/init.lua | 1 | ||||
| -rw-r--r-- | entities/weapons/hands.lua | 4 | ||||
| -rw-r--r-- | gamemode/core/combat/cl_weaponswing.lua | 1 | ||||
| -rw-r--r-- | gamemode/core/combat/sv_weaponswing.lua | 2 | ||||
| -rw-r--r-- | gamemode/core/database/sv_setup.lua | 3 | ||||
| -rw-r--r-- | gamemode/core/inventory/sv_invtracker.lua | 2 | ||||
| -rw-r--r-- | gamemode/core/npc/sv_npcsystem.lua | 3 | ||||
| -rw-r--r-- | gamemode/core/pac/sv_pac.lua | 8 | ||||
| -rw-r--r-- | gamemode/nrequire.lua | 2 | ||||
| -rw-r--r-- | gamemode/server/sv_mapconfig.lua | 3 |
10 files changed, 24 insertions, 5 deletions
diff --git a/entities/entities/art_droppeditem/init.lua b/entities/entities/art_droppeditem/init.lua index 7d5ad2f..a403dd0 100644 --- a/entities/entities/art_droppeditem/init.lua +++ b/entities/entities/art_droppeditem/init.lua @@ -76,6 +76,7 @@ end print("Remove the concommand in art_droppeditem/init.lua") concommand.Add("dropmellon",function(ply,cmd,args) + if not ply:IsAdmin() then return end local e = ents.Create("art_droppeditem") e.Model = "models/props_junk/Rock001a.mdl" e.Item = itm.GetItemByName("Watermelon") diff --git a/entities/weapons/hands.lua b/entities/weapons/hands.lua index 4220f5e..7532104 100644 --- a/entities/weapons/hands.lua +++ b/entities/weapons/hands.lua @@ -109,3 +109,7 @@ function SWEP:SecondaryAttack() weapon:onClick(self.Owner) end --Make sure we have a weapon end + +hook.Add("PlayerSpawn","give_hands",function(ply) + ply:Give("hands") +end) 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() diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua index de18fd8..5e8d1a6 100644 --- a/gamemode/nrequire.lua +++ b/gamemode/nrequire.lua @@ -237,6 +237,7 @@ doincludes() --Do it the first time through if SERVER then util.AddNetworkString("art_refresh") concommand.Add("art_manualrefresh",function(ply,cmd,args) + if not ply:IsAdmin() then return end reqtbl = {} doincludes() net.Start("art_refresh") @@ -249,6 +250,7 @@ if CLIENT then net.Receive("art_refresh",doincludes) end if SERVER then util.AddNetworkString("art_reffile") concommand.Add("art_refreshfile", function(ply,cmd,args) + if not ply:IsAdmin() then return end refresh(args[1]) net.Start("art_reffile") net.WriteString(args[1]) diff --git a/gamemode/server/sv_mapconfig.lua b/gamemode/server/sv_mapconfig.lua index 2448e27..23999bb 100644 --- a/gamemode/server/sv_mapconfig.lua +++ b/gamemode/server/sv_mapconfig.lua @@ -56,7 +56,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) for i,j in pairs(eot) do |
