Fixed many unused initializations (fixes #75)
This commit is contained in:
parent
3ed215ee44
commit
6c95703678
|
@ -15,18 +15,16 @@
|
||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
local bits = require (wolfa_getLuaPath()..".util.bits")
|
|
||||||
local tables = require (wolfa_getLuaPath()..".util.tables")
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
|
||||||
local timers = require (wolfa_getLuaPath()..".util.timers")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
|
||||||
|
|
||||||
local admin = require (wolfa_getLuaPath()..".admin.admin")
|
|
||||||
|
|
||||||
local teams = require (wolfa_getLuaPath()..".game.teams")
|
local teams = require (wolfa_getLuaPath()..".game.teams")
|
||||||
|
|
||||||
|
local constants = require (wolfa_getLuaPath()..".util.constants")
|
||||||
|
local bits = require (wolfa_getLuaPath()..".util.bits")
|
||||||
|
local events = require (wolfa_getLuaPath()..".util.events")
|
||||||
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
|
local tables = require (wolfa_getLuaPath()..".util.tables")
|
||||||
|
local timers = require (wolfa_getLuaPath()..".util.timers")
|
||||||
|
local util = require (wolfa_getLuaPath()..".util.util")
|
||||||
|
|
||||||
local balancer = {}
|
local balancer = {}
|
||||||
|
|
||||||
balancer.BALANCE_RANDOM = 0
|
balancer.BALANCE_RANDOM = 0
|
||||||
|
@ -40,7 +38,6 @@ local lastJoined = {[constants.TEAM_AXIS] = {}, [constants.TEAM_ALLIES] = {}, [c
|
||||||
local evenerCount = 0
|
local evenerCount = 0
|
||||||
|
|
||||||
function balancer.balance(byAdmin, forceBalance)
|
function balancer.balance(byAdmin, forceBalance)
|
||||||
local teamsData = teams.get()
|
|
||||||
local teamsDifference = teams.difference()
|
local teamsDifference = teams.difference()
|
||||||
|
|
||||||
if teamsDifference == 0 then
|
if teamsDifference == 0 then
|
||||||
|
@ -78,6 +75,8 @@ function balancer.balance(byAdmin, forceBalance)
|
||||||
evenerCount = evenerCount + 1
|
evenerCount = evenerCount + 1
|
||||||
|
|
||||||
if forceBalance or evenerCount >= 3 then
|
if forceBalance or evenerCount >= 3 then
|
||||||
|
local teamsData = teams.get()
|
||||||
|
|
||||||
for i = 1, math.floor(teamsDifference / 2) do
|
for i = 1, math.floor(teamsDifference / 2) do
|
||||||
local player = balancer.findPlayer(teamsData[teamGreater], teamGreater, teamSmaller)
|
local player = balancer.findPlayer(teamsData[teamGreater], teamGreater, teamSmaller)
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,6 @@ local db = require (wolfa_getLuaPath()..".db.db")
|
||||||
|
|
||||||
local players = require (wolfa_getLuaPath()..".players.players")
|
local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
|
||||||
|
|
||||||
local bans = {}
|
local bans = {}
|
||||||
|
|
||||||
function bans.get(banId)
|
function bans.get(banId)
|
||||||
|
|
|
@ -19,9 +19,6 @@ local db = require (wolfa_getLuaPath()..".db.db")
|
||||||
|
|
||||||
local players = require (wolfa_getLuaPath()..".players.players")
|
local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
|
||||||
|
|
||||||
local history = {}
|
local history = {}
|
||||||
|
|
||||||
function history.get(clientId, historyId)
|
function history.get(clientId, historyId)
|
||||||
|
|
|
@ -42,7 +42,7 @@ function rules.load()
|
||||||
|
|
||||||
if amount == 0 then return 0 end
|
if amount == 0 then return 0 end
|
||||||
|
|
||||||
for id, rule in ipairs(array["rule"]) do
|
for _, rule in ipairs(array["rule"]) do
|
||||||
data[rule["shortcut"]] = rule["rule"]
|
data[rule["shortcut"]] = rule["rule"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
local events = require (wolfa_getLuaPath()..".util.events")
|
||||||
local files = require (wolfa_getLuaPath()..".util.files")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
|
|
||||||
local auth = {}
|
local auth = {}
|
||||||
|
|
|
@ -15,9 +15,6 @@
|
||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
|
||||||
local files = require (wolfa_getLuaPath()..".util.files")
|
|
||||||
|
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
|
|
||||||
local shrubbot = {}
|
local shrubbot = {}
|
||||||
|
|
|
@ -47,14 +47,16 @@ function commandBan(clientId, command, victim, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
local args = {...}
|
local args = {...}
|
||||||
local duration, reason = 600, "banned by admin"
|
local duration, reason
|
||||||
|
|
||||||
if args[1] and util.getTimeFromString(args[1]) and args[2] then
|
if args[1] and util.getTimeFromString(args[1]) and args[2] then
|
||||||
duration = util.getTimeFromString(args[1])
|
duration = util.getTimeFromString(args[1])
|
||||||
reason = table.concat(args, " ", 2)
|
reason = table.concat(args, " ", 2)
|
||||||
elseif args[1] and util.getTimeFromString(args[1]) then
|
elseif args[1] and util.getTimeFromString(args[1]) then
|
||||||
duration = util.getTimeFromString(args[1])
|
duration = util.getTimeFromString(args[1])
|
||||||
|
reason = "banned by admin"
|
||||||
elseif args[1] then
|
elseif args[1] then
|
||||||
|
duration = 600
|
||||||
reason = table.concat(args, " ")
|
reason = table.concat(args, " ")
|
||||||
elseif not auth.isPlayerAllowed(clientId, "8") then
|
elseif not auth.isPlayerAllowed(clientId, "8") then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dban usage: "..commands.getadmin("ban")["syntax"].."\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dban usage: "..commands.getadmin("ban")["syntax"].."\";")
|
||||||
|
|
|
@ -19,7 +19,7 @@ local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
local voting = require (wolfa_getLuaPath()..".game.voting")
|
local voting = require (wolfa_getLuaPath()..".game.voting")
|
||||||
|
|
||||||
function commandEnableVote(clientId, command, ...)
|
function commandEnableVote(clientId, command)
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^denablevote: ^9next map voting has been enabled.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^denablevote: ^9next map voting has been enabled.\";")
|
||||||
|
|
||||||
voting.force("nextmap")
|
voting.force("nextmap")
|
||||||
|
|
|
@ -22,7 +22,6 @@ local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
local players = require (wolfa_getLuaPath()..".players.players")
|
local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
|
|
||||||
function commandFinger(clientId, command, victim)
|
function commandFinger(clientId, command, victim)
|
||||||
if victim == nil then
|
if victim == nil then
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
|
|
||||||
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
|
||||||
local greetings = require (wolfa_getLuaPath()..".players.greetings")
|
local greetings = require (wolfa_getLuaPath()..".players.greetings")
|
||||||
|
|
||||||
function commandGreeting(clientId, command)
|
function commandGreeting(clientId, command)
|
||||||
|
|
|
@ -23,7 +23,6 @@ local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
function commandIncognito(clientId, command)
|
function commandIncognito(clientId, command)
|
||||||
local fileName = et.trap_Cvar_Get("g_shrubbot")
|
local fileName = et.trap_Cvar_Get("g_shrubbot")
|
||||||
local functionStart = et.trap_Milliseconds()
|
|
||||||
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_READ)
|
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_READ)
|
||||||
|
|
||||||
if fileLength == -1 then
|
if fileLength == -1 then
|
||||||
|
@ -36,7 +35,7 @@ function commandIncognito(clientId, command)
|
||||||
|
|
||||||
et.trap_FS_FCloseFile(fileDescriptor)
|
et.trap_FS_FCloseFile(fileDescriptor)
|
||||||
|
|
||||||
for entry, adminName, adminGUID, adminLevel, adminFlags in string.gmatch(fileString, "(%[admin%]\nname%s+=%s+([%a%d%p]+)\nguid%s+=%s+([%u%d]+)\nlevel%s+=%s+([%d]+)\nflags%s+=%s+([%a%d%p]*)\n\n)") do
|
for _, adminName, adminGUID, adminLevel, adminFlags in string.gmatch(fileString, "(%[admin%]\nname%s+=%s+([%a%d%p]+)\nguid%s+=%s+([%u%d]+)\nlevel%s+=%s+([%d]+)\nflags%s+=%s+([%a%d%p]*)\n\n)") do
|
||||||
-- et.G_Print(string.format("%s %s %d %s\n", adminName, adminGUID, adminLevel, adminFlags))
|
-- et.G_Print(string.format("%s %s %d %s\n", adminName, adminGUID, adminLevel, adminFlags))
|
||||||
|
|
||||||
if players.getGUID(clientId) == adminGUID then
|
if players.getGUID(clientId) == adminGUID then
|
||||||
|
@ -63,7 +62,7 @@ function commandIncognito(clientId, command)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_WRITE)
|
local fileDescriptor, _ = et.trap_FS_FOpenFile(fileName, et.FS_WRITE)
|
||||||
|
|
||||||
local writeCount = et.trap_FS_Write(fileString, string.len(fileString), fileDescriptor)
|
local writeCount = et.trap_FS_Write(fileString, string.len(fileString), fileDescriptor)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
local players = require (wolfa_getLuaPath()..".players.players")
|
local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
local pagination = require (wolfa_getLuaPath()..".util.pagination")
|
local pagination = require (wolfa_getLuaPath()..".util.pagination")
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
local util = require (wolfa_getLuaPath()..".util.util")
|
||||||
|
|
||||||
function commandListAliases(clientId, command, victim, offset)
|
function commandListAliases(clientId, command, victim, offset)
|
||||||
|
|
|
@ -35,7 +35,6 @@ function commandListLevels(clientId, command, victim, offset)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
local fileName = et.trap_Cvar_Get("g_shrubbot")
|
local fileName = et.trap_Cvar_Get("g_shrubbot")
|
||||||
local functionStart = et.trap_Milliseconds()
|
|
||||||
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_READ)
|
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_READ)
|
||||||
local levelsCount = 0
|
local levelsCount = 0
|
||||||
|
|
||||||
|
@ -49,7 +48,7 @@ function commandListLevels(clientId, command, victim, offset)
|
||||||
|
|
||||||
et.trap_FS_FCloseFile(fileDescriptor)
|
et.trap_FS_FCloseFile(fileDescriptor)
|
||||||
|
|
||||||
for entry, levelNr, levelName, levelFlags in string.gmatch(fileString, "(%[level%]\nlevel%s+=%s+(-?[0-9]+)\nname%s+=%s+([%a%d%p ]+)\nflags%s+=%s+([%a%d%p]*)\n\n)") do
|
for _, levelNr, levelName, levelFlags in string.gmatch(fileString, "(%[level%]\nlevel%s+=%s+(-?[0-9]+)\nname%s+=%s+([%a%d%p ]+)\nflags%s+=%s+([%a%d%p]*)\n\n)") do
|
||||||
-- et.G_Print(string.format("%d %s %s\n", levelNr, levelName, levelFlags))
|
-- et.G_Print(string.format("%d %s %s\n", levelNr, levelName, levelFlags))
|
||||||
|
|
||||||
local numberOfSpaces = 24 - string.len(util.removeColors(levelName))
|
local numberOfSpaces = 24 - string.len(util.removeColors(levelName))
|
||||||
|
@ -94,7 +93,7 @@ function commandListLevels(clientId, command, victim, offset)
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistlevels: ^9there are no recorded levels for player ^7"..et.gentity_get(cmdClient, "pers.netname").."^9.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistlevels: ^9there are no recorded levels for player ^7"..et.gentity_get(cmdClient, "pers.netname").."^9.\";")
|
||||||
else
|
else
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dLevels for ^7"..et.gentity_get(cmdClient, "pers.netname").."^d:\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dLevels for ^7"..et.gentity_get(cmdClient, "pers.netname").."^d:\";")
|
||||||
for id, level in pairs(levels) do
|
for _, level in pairs(levels) do
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^f"..string.format("%4s", level["id"]).." ^7"..string.format("%-20s", util.removeColors(db.getlastalias(level["invoker_id"])["alias"])).." ^f"..os.date("%d/%m/%Y", level["datetime"]).." ^7"..level["level_id"].."\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^f"..string.format("%4s", level["id"]).." ^7"..string.format("%-20s", util.removeColors(db.getlastalias(level["invoker_id"])["alias"])).." ^f"..os.date("%d/%m/%Y", level["datetime"]).." ^7"..level["level_id"].."\";")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
|
|
||||||
local game = require (wolfa_getLuaPath()..".game.game")
|
local game = require (wolfa_getLuaPath()..".game.game")
|
||||||
|
|
||||||
function commandListMaps(clientId, command)
|
function commandListMaps(clientId, command)
|
||||||
|
|
|
@ -19,12 +19,10 @@ local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
|
|
||||||
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
|
|
||||||
local game = require (wolfa_getLuaPath()..".game.game")
|
|
||||||
local fireteams = require (wolfa_getLuaPath()..".game.fireteams")
|
local fireteams = require (wolfa_getLuaPath()..".game.fireteams")
|
||||||
|
|
||||||
local players = require (wolfa_getLuaPath()..".players.players")
|
local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
local util = require (wolfa_getLuaPath()..".util.util")
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
|
|
||||||
local admin = require (wolfa_getLuaPath()..".admin.admin")
|
|
||||||
local history = require (wolfa_getLuaPath()..".admin.history")
|
local history = require (wolfa_getLuaPath()..".admin.history")
|
||||||
local mutes = require (wolfa_getLuaPath()..".admin.mutes")
|
local mutes = require (wolfa_getLuaPath()..".admin.mutes")
|
||||||
|
|
||||||
|
@ -50,14 +49,16 @@ function commandMute(clientId, command, victim, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
local args = {...}
|
local args = {...}
|
||||||
local duration, reason = 600, "muted by admin"
|
local duration, reason
|
||||||
|
|
||||||
if args[1] and util.getTimeFromString(args[1]) and args[2] then
|
if args[1] and util.getTimeFromString(args[1]) and args[2] then
|
||||||
duration = util.getTimeFromString(args[1])
|
duration = util.getTimeFromString(args[1])
|
||||||
reason = table.concat(args, " ", 2)
|
reason = table.concat(args, " ", 2)
|
||||||
elseif args[1] and util.getTimeFromString(args[1]) then
|
elseif args[1] and util.getTimeFromString(args[1]) then
|
||||||
duration = util.getTimeFromString(args[1])
|
duration = util.getTimeFromString(args[1])
|
||||||
|
reason = "muted by admin"
|
||||||
elseif args[1] then
|
elseif args[1] then
|
||||||
|
duration = 600
|
||||||
reason = table.concat(args, " ")
|
reason = table.concat(args, " ")
|
||||||
elseif not auth.isPlayerAllowed(clientId, "8") then
|
elseif not auth.isPlayerAllowed(clientId, "8") then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute usage: "..commands.getadmin("mute")["syntax"].."\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute usage: "..commands.getadmin("mute")["syntax"].."\";")
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
|
|
||||||
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
local game = require (wolfa_getLuaPath()..".game.game")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
|
|
||||||
function commandPause(clientId, command)
|
function commandPause(clientId, command)
|
||||||
|
|
|
@ -21,8 +21,6 @@ local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
|
|
||||||
local players = require (wolfa_getLuaPath()..".players.players")
|
local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
|
|
||||||
function commandPlayerLock(clientId, command, victim)
|
function commandPlayerLock(clientId, command, victim)
|
||||||
if victim == nil then
|
if victim == nil then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock usage: "..commands.getadmin("plock")["syntax"].."\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock usage: "..commands.getadmin("plock")["syntax"].."\";")
|
||||||
|
|
|
@ -21,8 +21,6 @@ local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
|
|
||||||
local players = require (wolfa_getLuaPath()..".players.players")
|
local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
|
|
||||||
function commandPlayerUnlock(clientId, command, victim)
|
function commandPlayerUnlock(clientId, command, victim)
|
||||||
if victim == nil then
|
if victim == nil then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dpunlock usage: "..commands.getadmin("punlock")["syntax"].."\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dpunlock usage: "..commands.getadmin("punlock")["syntax"].."\";")
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
|
|
||||||
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
local game = require (wolfa_getLuaPath()..".game.game")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
|
|
||||||
function commandUnpause(clientId, command)
|
function commandUnpause(clientId, command)
|
||||||
|
|
|
@ -48,14 +48,16 @@ function commandVoiceMute(clientId, command, victim, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
local args = {...}
|
local args = {...}
|
||||||
local duration, reason = 600, "muted by admin"
|
local duration, reason
|
||||||
|
|
||||||
if args[1] and util.getTimeFromString(args[1]) and args[2] then
|
if args[1] and util.getTimeFromString(args[1]) and args[2] then
|
||||||
duration = util.getTimeFromString(args[1])
|
duration = util.getTimeFromString(args[1])
|
||||||
reason = table.concat(args, " ", 2)
|
reason = table.concat(args, " ", 2)
|
||||||
elseif args[1] and util.getTimeFromString(args[1]) then
|
elseif args[1] and util.getTimeFromString(args[1]) then
|
||||||
duration = util.getTimeFromString(args[1])
|
duration = util.getTimeFromString(args[1])
|
||||||
|
reason = "muted by admin"
|
||||||
elseif args[1] then
|
elseif args[1] then
|
||||||
|
duration = 600
|
||||||
reason = table.concat(args, " ")
|
reason = table.concat(args, " ")
|
||||||
elseif not auth.isPlayerAllowed(clientId, "8") then
|
elseif not auth.isPlayerAllowed(clientId, "8") then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute usage: "..commands.getadmin("vmute")["syntax"].."\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute usage: "..commands.getadmin("vmute")["syntax"].."\";")
|
||||||
|
|
|
@ -21,7 +21,7 @@ local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
|
|
||||||
function commandAclListLevels(...)
|
function commandAclListLevels()
|
||||||
for _, level in ipairs(acl.getLevels()) do
|
for _, level in ipairs(acl.getLevels()) do
|
||||||
et.G_Print(string.format("%5d %30s %6d players", level["id"], level["name"], level["players"]).."\n")
|
et.G_Print(string.format("%5d %30s %6d players", level["id"], level["name"], level["players"]).."\n")
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
local events = require (wolfa_getLuaPath()..".util.events")
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
local players = require (wolfa_getLuaPath()..".players.players")
|
local players = require (wolfa_getLuaPath()..".players.players")
|
||||||
|
|
||||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
local util = require (wolfa_getLuaPath()..".util.util")
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
local tables = require (wolfa_getLuaPath()..".util.tables")
|
local tables = require (wolfa_getLuaPath()..".util.tables")
|
||||||
|
|
|
@ -15,11 +15,7 @@
|
||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local teams = require (wolfa_getLuaPath()..".game.teams")
|
|
||||||
|
|
||||||
local bits = require (wolfa_getLuaPath()..".util.bits")
|
local bits = require (wolfa_getLuaPath()..".util.bits")
|
||||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
|
||||||
|
|
||||||
local fireteams = {}
|
local fireteams = {}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
|
|
||||||
local SEVERITY_LEVELS = {
|
local SEVERITY_LEVELS = {
|
||||||
|
|
|
@ -73,7 +73,7 @@ function files.loadFromCFG(fileName, idExpr)
|
||||||
end
|
end
|
||||||
|
|
||||||
function files.saveToCFG(fileName, array)
|
function files.saveToCFG(fileName, array)
|
||||||
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_WRITE)
|
local fileDescriptor, _ = et.trap_FS_FOpenFile(fileName, et.FS_WRITE)
|
||||||
local arrayCount = 0
|
local arrayCount = 0
|
||||||
|
|
||||||
for id, subdata in pairs(array) do
|
for id, subdata in pairs(array) do
|
||||||
|
@ -82,11 +82,12 @@ function files.saveToCFG(fileName, array)
|
||||||
et.trap_FS_Write(blockId, string.len(blockId), fileDescriptor)
|
et.trap_FS_Write(blockId, string.len(blockId), fileDescriptor)
|
||||||
|
|
||||||
local maxKeyLength = 0
|
local maxKeyLength = 0
|
||||||
|
|
||||||
for k, v in pairs(data) do
|
for k, _ in pairs(data) do
|
||||||
maxKeyLength = math.max(maxKeyLength, string.len(k))
|
maxKeyLength = math.max(maxKeyLength, string.len(k))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local dataLine
|
||||||
for k, v in pairs(data) do
|
for k, v in pairs(data) do
|
||||||
dataLine = string.format("%-"..maxKeyLength.."s = %s\n", k, v)
|
dataLine = string.format("%-"..maxKeyLength.."s = %s\n", k, v)
|
||||||
et.trap_FS_Write(dataLine, string.len(dataLine), fileDescriptor)
|
et.trap_FS_Write(dataLine, string.len(dataLine), fileDescriptor)
|
||||||
|
|
|
@ -26,7 +26,7 @@ function logs.writeChat(clientId, type, ...)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(settings.get("g_logChat"), et.FS_APPEND)
|
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logChat"), et.FS_APPEND)
|
||||||
|
|
||||||
local logLine
|
local logLine
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ function logs.writeAdmin(clientId, command, victimId, ...)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(settings.get("g_logAdmin"), et.FS_APPEND)
|
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logAdmin"), et.FS_APPEND)
|
||||||
|
|
||||||
local logLine
|
local logLine
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ function settings.load()
|
||||||
end
|
end
|
||||||
|
|
||||||
local files = require (wolfa_getLuaPath()..".util.files")
|
local files = require (wolfa_getLuaPath()..".util.files")
|
||||||
local amount, array = files.loadFromCFG("wolfadmin.cfg", "[a-z]+")
|
local _, array = files.loadFromCFG("wolfadmin.cfg", "[a-z]+")
|
||||||
|
|
||||||
for blocksname, settings in pairs(array) do
|
for blocksname, settings in pairs(array) do
|
||||||
for k, v in pairs(settings[1]) do
|
for k, v in pairs(settings[1]) do
|
||||||
|
|
|
@ -36,7 +36,7 @@ function tables.unpack(tbl)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tables.contains(tbl, needle)
|
function tables.contains(tbl, needle)
|
||||||
for key, value in pairs(tbl) do
|
for _, value in pairs(tbl) do
|
||||||
if value == needle then
|
if value == needle then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
local events = require (wolfa_getLuaPath()..".util.events")
|
||||||
local tables = require (wolfa_getLuaPath()..".util.tables")
|
local tables = require (wolfa_getLuaPath()..".util.tables")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue