mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-10 06:41:53 +00:00
Fixed consistent checking of standalone setting
* treat everything non-zero as true (enabled)
This commit is contained in:
parent
6d0ba325f1
commit
47f9baf277
11 changed files with 15 additions and 15 deletions
|
@ -117,7 +117,11 @@ auth.PERM_IMMUNE = "immune"
|
|||
-- system in this function. might have to think of a better way to implement
|
||||
-- this, but it will suffice.
|
||||
function auth.onGameInit()
|
||||
if settings.get("g_standalone") == 1 then
|
||||
if settings.get("g_standalone") ~= 0 then
|
||||
if et.trap_Cvar_Get("g_shrubbot") ~= "" then
|
||||
outputDebug("Running in standalone mode while g_shrubbot is set", 3)
|
||||
end
|
||||
|
||||
if not db.isConnected() then
|
||||
-- FIXME simple workaround to deny any commands
|
||||
function auth.isPlayerAllowed() return false end
|
||||
|
@ -134,10 +138,6 @@ function auth.onGameInit()
|
|||
srv.loadFlags(et.trap_Cvar_Get("fs_game"))
|
||||
end
|
||||
|
||||
if settings.get("g_standalone") == 1 and et.trap_Cvar_Get("g_shrubbot") ~= "" then
|
||||
outputDebug("Running in standalone mode while g_shrubbot is set", 3)
|
||||
end
|
||||
|
||||
setmetatable(auth, {__index = srv})
|
||||
end
|
||||
events.handle("onGameInit", auth.onGameInit)
|
||||
|
|
|
@ -31,7 +31,7 @@ function commandHelp(clientId, command, cmd)
|
|||
end
|
||||
end
|
||||
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dhelp: ^9"..#availableCommands.." "..((settings.get("g_standalone") == 1) and "available" or "additional").." commands (open console for the full list)\";")
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dhelp: ^9"..#availableCommands.." "..((settings.get("g_standalone") ~= 0) and "available" or "additional").." commands (open console for the full list)\";")
|
||||
|
||||
local cmdsOnLine, cmdsBuffer = 0, ""
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ function commandLock(clientId, command, team)
|
|||
|
||||
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, (settings.get("g_standalone") == 1))
|
||||
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") ~= 0))
|
||||
|
||||
function commandLock(clientId, command, team)
|
||||
if team == nil or (team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC and team ~= "all") then
|
||||
|
|
|
@ -37,7 +37,7 @@ function commandReadconfig(clientId, command)
|
|||
|
||||
return false
|
||||
end
|
||||
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true, (settings.get("g_standalone") == 1))
|
||||
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true, (settings.get("g_standalone") ~= 0))
|
||||
|
||||
function commandReadconfig(clientId, command)
|
||||
settings.load()
|
||||
|
|
|
@ -55,7 +55,7 @@ function commandSetLevel(clientId, command, victim, level)
|
|||
|
||||
return false
|
||||
end
|
||||
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))
|
||||
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") ~= 0))
|
||||
|
||||
function commandSetLevel(clientId, command, victim, level)
|
||||
local cmdClient
|
||||
|
|
|
@ -42,7 +42,7 @@ function commandUnlock(clientId, command, team)
|
|||
|
||||
return false
|
||||
end
|
||||
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))
|
||||
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", true, (settings.get("g_standalone") ~= 0))
|
||||
|
||||
function commandUnlock(clientId, command, team)
|
||||
if team == nil or (team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC and team ~= "all") then
|
||||
|
|
|
@ -50,7 +50,7 @@ function commandWarn(clientId, command, victim, ...)
|
|||
|
||||
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, (settings.get("g_standalone") == 1 or settings.get("g_playerHistory") == 0))
|
||||
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") ~= 0 or settings.get("g_playerHistory") == 0))
|
||||
|
||||
function commandWarn(clientId, command, victim, ...)
|
||||
local cmdClient
|
||||
|
|
|
@ -53,7 +53,7 @@ function commandVoiceSay(clientId, command, ...)
|
|||
return true
|
||||
end
|
||||
|
||||
if settings.get("g_standalone") == 1 then
|
||||
if settings.get("g_standalone") ~= 0 then
|
||||
logs.writeChat(clientId, types[command], ...)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ function commandTeam(clientId, command)
|
|||
end
|
||||
|
||||
local team = util.getTeamFromCode(et.trap_Argv(1))
|
||||
if settings.get("g_standalone") == 1 and teams.isLocked(team) then
|
||||
if settings.get("g_standalone") ~= 0 and teams.isLocked(team) then
|
||||
local teamName = util.getTeamName(team)
|
||||
local teamColor = util.getTeamColor(team)
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ function logs.writeAdmin(clientId, command, victimId, ...)
|
|||
local clientFlags = ""
|
||||
local args = table.concat({...}, " ")
|
||||
|
||||
if settings.get("g_standalone") == 1 then
|
||||
if settings.get("g_standalone") ~= 0 then
|
||||
if victimId then
|
||||
local victimName = players.getName(victimId)
|
||||
logLine = string.format("[%s] %s: %s: %s: %s: \"%s\"\n", os.date("%Y-%m-%d %H:%M:%S"), clientGUID, clientName, command, victimName, args)
|
||||
|
|
|
@ -172,7 +172,7 @@ function settings.load()
|
|||
settings.determineOS()
|
||||
settings.determineMode()
|
||||
|
||||
outputDebug("WolfAdmin running in "..(settings.get("g_standalone") == 1 and "standalone" or "add-on").." mode on "..settings.get("sv_os")..".")
|
||||
outputDebug("WolfAdmin running in "..(settings.get("g_standalone") ~= 0 and "standalone" or "add-on").." mode on "..settings.get("sv_os")..".")
|
||||
end
|
||||
|
||||
function settings.determineOS()
|
||||
|
|
Loading…
Reference in a new issue