add !bot and !Kickbots
This commit is contained in:
parent
494ea4c5c4
commit
11ad16fb39
35
ulx_noob_extras/lua/ulx/modules/sh/noob_bots.lua
Normal file
35
ulx_noob_extras/lua/ulx/modules/sh/noob_bots.lua
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
-- from: ulx-custom-commands/lua/ulx/modules/sh/cc_util.lua
|
||||
|
||||
function ulx.bot(calling_ply, number, bKick)
|
||||
if (bKick) then
|
||||
for _, v in ipairs(player.GetBots()) do
|
||||
if (v:IsBot()) then -- Just to be sure they are bots
|
||||
v:Kick("")
|
||||
end
|
||||
end
|
||||
ulx.fancyLogAdmin(calling_ply, "#A kicked all bots from the server")
|
||||
elseif (!bKick) then
|
||||
if (tonumber(number) == 0) then
|
||||
for i = 1, 6 do -- Only add 6 to prevent a overflow.
|
||||
RunConsoleCommand("bot")
|
||||
end
|
||||
ulx.fancyLogAdmin(calling_ply, "#A spawned a few bots")
|
||||
elseif (tonumber(number) != 0) then
|
||||
for i = 1, number do
|
||||
RunConsoleCommand("bot")
|
||||
end
|
||||
if (number == 1) then
|
||||
ulx.fancyLogAdmin(calling_ply, "#A spawned #i bot", number)
|
||||
elseif (number > 1) then
|
||||
ulx.fancyLogAdmin(calling_ply, "#A spawned #i bots", number)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local bot = ulx.command("Utility", "ulx bot", ulx.bot, "!bot")
|
||||
bot:addParam{type = ULib.cmds.NumArg, default = 0, hint = "number", ULib.cmds.optional}
|
||||
bot:addParam{type = ULib.cmds.BoolArg, invisible = true}
|
||||
bot:defaultAccess(ULib.ACCESS_ADMIN)
|
||||
bot:help("Spawn or remove bots.")
|
||||
bot:setOpposite("ulx kickbots", {_, _, true}, "!kickbots")
|
Loading…
Reference in New Issue
Block a user