mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-28 15:02:12 +00:00
This commit is contained in:
parent
7e5c009484
commit
9fdd36e772
32 changed files with 58 additions and 42 deletions
|
@ -31,4 +31,4 @@ function commandAdminTest(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("admintest", commandAdminTest, auth.PERM_ADMINTEST, "display your current admin level", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("admintest", commandAdminTest, auth.PERM_ADMINTEST, "display your current admin level", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -78,4 +78,4 @@ function commandBan(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("ban", commandBan, auth.PERM_BAN, "ban a player with an optional duration and reason", "^9[^3name|slot#^9] ^9(^3duration^9) ^9(^3reason^9)", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("ban", commandBan, auth.PERM_BAN, "ban a player with an optional duration and reason", "^9[^3name|slot#^9] ^9(^3duration^9) ^9(^3reason^9)", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -60,4 +60,4 @@ function commandFinger(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("finger", commandFinger, auth.PERM_FINGER, "gives specific information about a player", "^9[^3name|slot#^9]", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("finger", commandFinger, auth.PERM_FINGER, "gives specific information about a player", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -63,4 +63,4 @@ function commandGib(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("gib", commandGib, auth.PERM_GIB, "insantly gibs a player", "^9(^3name|slot#^9) (^hreason^9)", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("gib", commandGib, auth.PERM_GIB, "insantly gibs a player", "^9(^3name|slot#^9) (^hreason^9)", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -26,7 +26,7 @@ function commandHelp(clientId, cmdArguments)
|
|||
local availableCommands = {}
|
||||
|
||||
for command, data in pairs(cmds) do
|
||||
if data["function"] and data["flag"] and auth.isPlayerAllowed(clientId, data["flag"]) and (not data["hidden"] or (type(data["hidden"]) == "function" and not data["hidden"]())) then
|
||||
if data["function"] and data["flag"] and auth.isPlayerAllowed(clientId, data["flag"]) and not data["hidden"] then
|
||||
table.insert(availableCommands, command)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -62,4 +62,4 @@ function commandKick(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("kick", commandKick, auth.PERM_KICK, "kick a player with an optional reason", "^9[^3name|slot#^9] ^9(^3reason^9)", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("kick", commandKick, auth.PERM_KICK, "kick a player with an optional reason", "^9[^3name|slot#^9] ^9(^3reason^9)", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -81,4 +81,4 @@ function commandListAliases(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("listaliases", commandListAliases, auth.PERM_FINGER, "display all known aliases for a player", "^9[^3name|slot#^9] ^9(^hoffset^9)", function() return (not db.isconnected()) end)
|
||||
commands.addadmin("listaliases", commandListAliases, auth.PERM_LISTALIASES, "display all known aliases for a player", "^9[^3name|slot#^9] ^9(^hoffset^9)")
|
||||
|
|
|
@ -85,4 +85,4 @@ function commandListPlayers(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("listplayers", commandListPlayers, auth.PERM_LISTPLAYERS, "display a list of connected players, their slot numbers as well as their admin levels", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("listplayers", commandListPlayers, auth.PERM_LISTPLAYERS, "display a list of connected players, their slot numbers as well as their admin levels", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -42,7 +42,7 @@ function commandLock(clientId, cmdArguments)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", true)
|
||||
commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", true, (settings.get("g_standalone") == 1))
|
||||
|
||||
function commandLock(clientId, cmdArguments)
|
||||
if cmdArguments[1] == nil or (cmdArguments[1] ~= constants.TEAM_AXIS_SC and cmdArguments[1] ~= constants.TEAM_ALLIES_SC and cmdArguments[1] ~= constants.TEAM_SPECTATORS_SC and cmdArguments[1] ~= "all") then
|
||||
|
@ -68,4 +68,4 @@ function commandLock(clientId, cmdArguments)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -85,4 +85,4 @@ function commandMute(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("mute", commandMute, auth.PERM_MUTE, "voicemutes a player", "^9[^3name|slot#^9]", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("mute", commandMute, auth.PERM_MUTE, "voicemutes a player", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -26,4 +26,4 @@ function commandNextMap(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("nextmap", commandNextMap, auth.PERM_NEXTMAP, "loads the next map", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("nextmap", commandNextMap, auth.PERM_NEXTMAP, "loads the next map", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -27,4 +27,4 @@ function commandPause(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("pause", commandPause, auth.PERM_RESTART, "pauses the game for all players", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("pause", commandPause, auth.PERM_RESTART, "pauses the game for all players", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -16,10 +16,14 @@
|
|||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
local admin = require (wolfa_getLuaPath()..".admin.admin")
|
||||
|
||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||
|
||||
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
||||
|
||||
local util = require (wolfa_getLuaPath()..".util.util")
|
||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||
|
||||
function commandPlayerLock(clientId, cmdArguments)
|
||||
if cmdArguments[2] == nil or (cmdArguments[2] ~= constants.TEAM_AXIS_SC and cmdArguments[2] ~= constants.TEAM_ALLIES_SC and cmdArguments[2] ~= constants.TEAM_SPECTATORS_SC) then
|
||||
|
@ -70,4 +74,4 @@ function commandPlayerLock(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("put", commandPlayerLock, auth.PERM_LOCKPLAYER, "locks a player to a specific team", "^9[^3name|slot#^9]")
|
||||
commands.addadmin("put", commandPlayerLock, auth.PERM_PUT, "locks a player to a specific team", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -30,4 +30,4 @@ function commandReadconfig(clientId, cmdArguments)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true)
|
||||
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true, (settings.get("g_standalone") == 1))
|
||||
|
|
|
@ -26,4 +26,4 @@ function commandReset(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("reset", commandReset, auth.PERM_RESTART, "resets the current match", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("reset", commandReset, auth.PERM_RESTART, "resets the current match", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -34,4 +34,4 @@ function commandRestart(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("restart", commandRestart, auth.PERM_RESTART, "restarts the current map", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("restart", commandRestart, auth.PERM_RESTART, "restarts the current map", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -42,7 +42,7 @@ function commandSetLevel(clientId, cmdArguments)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", (settings.get("g_standalone") == 0 and db.isconnected()))
|
||||
commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", true, (settings.get("g_standalone") == 1))
|
||||
|
||||
function commandSetLevel(clientId, cmdArguments)
|
||||
if cmdArguments[1] == nil then
|
||||
|
@ -83,4 +83,4 @@ function commandSetLevel(clientId, cmdArguments)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", (settings.get("g_standalone") == 0 and db.isconnected()))
|
||||
commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -52,4 +52,4 @@ function commandShowBans(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("showbans", commandShowBans, auth.PERM_LISTBANS, "display a (partial) list of active bans", "(^hstart at ban#^9) ((^hbanner^9) (^3banner's name^9)) ((^3find^9) (^hbanned player^9)) ((^3reason^9) (^hreason for ban^9))", function() return (not db.isconnected()) end)
|
||||
commands.addadmin("showbans", commandShowBans, auth.PERM_LISTBANS, "display a (partial) list of active bans", "(^hstart at ban#^9) ((^hbanner^9) (^3banner's name^9)) ((^3find^9) (^hbanned player^9)) ((^3reason^9) (^hreason for ban^9))", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -70,4 +70,4 @@ function commandListHistory(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("showhistory", commandListHistory, auth.PERM_LISTHISTORY, "display history for a specific player", "^9[^3name|slot#^9] ^9(^hoffset^9)", function() return (settings.get("g_standalone") == 0 or not db.isconnected()) end)
|
||||
commands.addadmin("showhistory", commandListHistory, auth.PERM_LISTHISTORY, "display history for a specific player", "^9[^3name|slot#^9] ^9(^hoffset^9)", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -26,4 +26,4 @@ function commandShuffle(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("shuffle", commandShuffle, auth.PERM_SHUFFLE, "shuffle the teams to try and even them", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("shuffle", commandShuffle, auth.PERM_SHUFFLE, "shuffle the teams to try and even them", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -66,4 +66,4 @@ function commandSlap(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("slap", commandSlap, auth.PERM_SLAP, "give a player a specified amount of damage for a specified reason", "^9[^3name|slot#^9] (^hdamage^9) (^hreason^9)", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("slap", commandSlap, auth.PERM_SLAP, "give a player a specified amount of damage for a specified reason", "^9[^3name|slot#^9] (^hdamage^9) (^hreason^9)", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -26,4 +26,4 @@ function commandSwap(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("swap", commandSwap, auth.PERM_SWAP, "swap teams", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("swap", commandSwap, auth.PERM_SWAP, "swap teams", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -24,4 +24,4 @@ function commandTime(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("time", commandTime, auth.PERM_TIME, "displays the local time", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("time", commandTime, auth.PERM_TIME, "displays the local time", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -48,4 +48,4 @@ function commandRemoveBan(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("unban", commandRemoveBan, auth.PERM_BAN, "unbans a player specified ban number as seen in ^2!showbans^9", "^9[^3ban#^9]", function() return (settings.get("g_standalone") == 0 or not db.isconnected()) end)
|
||||
commands.addadmin("unban", commandRemoveBan, auth.PERM_BAN, "unbans a player specified ban number as seen in ^2!showbans^9", "^9[^3ban#^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -42,7 +42,7 @@ function commandUnlock(clientId, cmdArguments)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", true)
|
||||
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", true, (settings.get("g_standalone") == 1))
|
||||
|
||||
function commandUnlock(clientId, cmdArguments)
|
||||
if cmdArguments[1] == nil or (cmdArguments[1] ~= constants.TEAM_AXIS_SC and cmdArguments[1] ~= constants.TEAM_ALLIES_SC and cmdArguments[1] ~= constants.TEAM_SPECTATORS_SC and cmdArguments[1] ~= "all") then
|
||||
|
@ -68,4 +68,4 @@ function commandUnlock(clientId, cmdArguments)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -58,4 +58,4 @@ function commandUnmute(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("unmute", commandUnmute, auth.PERM_MUTE, "unvoicemutes a player", "^9[^3name|slot#^9]", (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("unmute", commandUnmute, auth.PERM_MUTE, "unvoicemutes a player", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -27,4 +27,4 @@ function commandUnpause(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("unpause", commandUnpause, auth.PERM_PAUSE, "pauses the game for all players", nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("unpause", commandUnpause, auth.PERM_PAUSE, "pauses the game for all players", nil, nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -49,7 +49,7 @@ function commandWarn(clientId, cmdArguments)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", true)
|
||||
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", true, (settings.get("g_standalone") == 1))
|
||||
|
||||
function commandWarn(clientId, cmdArguments)
|
||||
if #cmdArguments < 2 then
|
||||
|
@ -87,4 +87,4 @@ function commandWarn(clientId, cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", (settings.get("g_standalone") == 0 and db.isconnected()))
|
||||
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -26,10 +26,10 @@ function commandSay(clientId, cmdArguments)
|
|||
return true
|
||||
end
|
||||
end
|
||||
commands.addclient("say", commandSay, "", "", false)
|
||||
commands.addclient("say_team", commandSay, "", "", false)
|
||||
commands.addclient("say_teamnl", commandSay, "", "", false)
|
||||
commands.addclient("say_buddy", commandSay, "", "", false)
|
||||
commands.addclient("say", commandSay, "", "", false, (settings.get("g_standalone") == 0))
|
||||
commands.addclient("say_team", commandSay, "", "", false, (settings.get("g_standalone") == 0))
|
||||
commands.addclient("say_teamnl", commandSay, "", "", false, (settings.get("g_standalone") == 0))
|
||||
commands.addclient("say_buddy", commandSay, "", "", false, (settings.get("g_standalone") == 0))
|
||||
|
||||
function commandVoiceSay(clientId, cmdArguments)
|
||||
if players.isMuted(clientId, players.MUTE_VOICE) then
|
||||
|
|
|
@ -31,7 +31,7 @@ function commandTeam(clientId, cmdArguments)
|
|||
end
|
||||
|
||||
local team = util.getTeamFromCode(et.trap_Argv(1))
|
||||
if teams.isLocked(team) then
|
||||
if settings.get("g_standalone") == 1 and teams.isLocked(team) then
|
||||
local teamName = util.getTeamName(team)
|
||||
local teamColor = util.getTeamColor(team)
|
||||
|
||||
|
|
|
@ -58,7 +58,11 @@ function commands.getadmin(command)
|
|||
return admincmds
|
||||
end
|
||||
|
||||
function commands.addclient(command, func, flag, syntax, chat)
|
||||
function commands.addclient(command, func, flag, syntax, chat, disabled)
|
||||
if disabled then
|
||||
return
|
||||
end
|
||||
|
||||
clientcmds[command] = {
|
||||
["function"] = func,
|
||||
["flag"] = flag,
|
||||
|
@ -67,13 +71,21 @@ function commands.addclient(command, func, flag, syntax, chat)
|
|||
}
|
||||
end
|
||||
|
||||
function commands.addserver(command, func)
|
||||
function commands.addserver(command, func, disabled)
|
||||
if disabled then
|
||||
return
|
||||
end
|
||||
|
||||
servercmds[command] = {
|
||||
["function"] = func,
|
||||
}
|
||||
end
|
||||
|
||||
function commands.addadmin(command, func, flag, help, syntax, hidden)
|
||||
function commands.addadmin(command, func, flag, help, syntax, hidden, disabled)
|
||||
if disabled then
|
||||
return
|
||||
end
|
||||
|
||||
admincmds[command] = {
|
||||
["function"] = func,
|
||||
["flag"] = flag,
|
||||
|
|
|
@ -199,4 +199,4 @@ function commandAcl(cmdArguments)
|
|||
|
||||
return true
|
||||
end
|
||||
commands.addserver("acl", commandAcl)
|
||||
commands.addserver("acl", commandAcl, (settings.get("g_standalone") == 0))
|
||||
|
|
Loading…
Reference in a new issue