refactor: gmi_test_error to admin only

This commit is contained in:
Linventif 2024-08-09 17:33:41 +00:00
parent 4ae8735a25
commit 2ab252629a
2 changed files with 22 additions and 20 deletions

View File

@ -0,0 +1,21 @@
concommand.Add("gmi_test_error", function(ply, cmd, args)
if !SERVER && !LocalPlayer():gmIntIsAdmin() then
print("[Gmod Integration] Missing permissions to run this command")
return
end
if #args == 0 then
error("This is a test error")
else
if args[1] == "loop" then
hook.Add("Think", "gmInte:TestError:Loop", function() error("This is a test error") end)
timer.Simple(5, function() hook.Remove("Think", "gmInte:TestError:Loop") end)
elseif args[1] == "crash" then
while true do
error("This is a crash error")
end
else
error("This is a test error")
end
end
end)

View File

@ -33,22 +33,3 @@ function gmInte.isPrivateIP(ip)
if parts[1] == "127" then return true end
return false
end
concommand.Add("gmi_test_error", function(ply, cmd, args)
print(ply, cmd)
PrintTable(args)
if #args == 0 then
error("This is a test error")
else
if args[1] == "loop" then
hook.Add("Think", "gmInte:TestError:Loop", function() error("This is a test error") end)
timer.Simple(5, function() hook.Remove("Think", "gmInte:TestError:Loop") end)
elseif args[1] == "crash" then
while true do
error("This is a crash error")
end
else
error("This is a test error")
end
end
end)