Merge branch 'develop/1.1.0' into develop/1.2.0

# Conflicts:
#	luascripts/commands/admin/listaliases.lua
#	luascripts/commands/admin/listlevels.lua
#	luascripts/commands/admin/plock.lua
#	luascripts/commands/admin/punlock.lua
#	luascripts/commands/admin/setlevel.lua
#	luascripts/commands/admin/showhistory.lua
#	luascripts/commands/admin/stats.lua
#	luascripts/commands/admin/vmute.lua
#	luascripts/commands/admin/vunmute.lua
#	luascripts/commands/admin/warn.lua
This commit is contained in:
Timo Smit 2017-01-17 20:20:53 +01:00
commit 4ae1421f0b
16 changed files with 25 additions and 19 deletions

View File

@ -36,7 +36,7 @@ function commandListAliases(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistaliases usage: "..commands.getadmin("listaliases")["syntax"].."\";")
return true
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -62,7 +62,7 @@ function commandListLevels(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistlevels: ^9level history is disabled.\";")
return true
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -28,7 +28,7 @@ function commandPlayerLock(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock usage: "..commands.getadmin("plock")["syntax"].."\";")
return true
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -28,7 +28,7 @@ function commandPlayerUnlock(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dpunlock usage: "..commands.getadmin("punlock")["syntax"].."\";")
return true
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -24,7 +24,7 @@ local admin = require "luascripts.wolfadmin.admin.admin"
function commandSetLevel(clientId, cmdArguments)
if #cmdArguments < 2 then
return false
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -36,7 +36,7 @@ function commandListHistory(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dshowhistory usage: "..commands.getadmin("showwarns")["syntax"].."\";")
return true
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -24,7 +24,7 @@ function commandShowStats(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dstats usage: "..commands.getadmin("stats")["syntax"].."\";")
return true
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -31,7 +31,7 @@ function commandVoiceMute(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute usage: "..commands.getadmin("vmute")["syntax"].."\";")
return true
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -26,7 +26,7 @@ function commandVoiceUnmute(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvunmute usage: "..commands.getadmin("vunmute")["syntax"].."\";")
return true
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -33,7 +33,7 @@ function commandWarn(clientId, cmdArguments)
return false
elseif #cmdArguments < 2 then
return false
elseif tonumber(cmdArguments[1]) == nil then
elseif tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -25,7 +25,7 @@ function commandPersonalMessage(clientId, cmdArguments)
if #cmdArguments > 1 then
local cmdClient
if tonumber(cmdArguments[1]) == nil then
if tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -133,7 +133,7 @@ function commands.log(clientId, command, cmdArguments)
if cmdArguments[1] then
local cmdClient
if tonumber(cmdArguments[1]) == nil then
if tonumber(cmdArguments[1]) == nil or tonumber(cmdArguments[1]) > tonumber(et.trap_Cvar_Get("sv_maxclients")) then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])

View File

@ -461,7 +461,7 @@ function sqlite3.isconnected()
end
function sqlite3.start()
con = env:connect(settings.get("db_file"))
con = env:connect(wolfa_getHomePath()..settings.get("db_file"))
if not con then
return

View File

@ -48,6 +48,7 @@ local version = "1.2.0-dev"
local release = "TBD"
local basepath = nil
local homepath = nil
-- game related data
local currentLevelTime = nil
@ -69,6 +70,10 @@ function wolfa_getBasePath()
return basepath
end
function wolfa_getHomePath()
return homepath
end
function et_InitGame(levelTime, randomSeed, restartMap)
et.RegisterModname("WolfAdmin "..wolfa_getVersion())
@ -76,7 +81,8 @@ function et_InitGame(levelTime, randomSeed, restartMap)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "sets mod_wolfadmin "..wolfa_getVersion()..";")
basepath = string.gsub(et.trap_Cvar_Get("fs_basepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/luascripts/wolfadmin/"
basepath = string.gsub(et.trap_Cvar_Get("fs_basepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/"
homepath = string.gsub(et.trap_Cvar_Get("fs_homepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/"
currentLevelTime = levelTime

View File

@ -25,11 +25,11 @@ function files.ls(directory)
local entries = {}
if platform == "unix" then
command = 'ls -1 "'..wolfa_getBasePath()..directory..'"'
command = 'ls -1 "'..wolfa_getBasePath()..'luascripts/wolfadmin/'..directory..'"'
elseif platform == "windows" then
command = 'dir "'..wolfa_getBasePath()..directory..'" /b'
command = 'dir "'..wolfa_getBasePath()..'luascripts/wolfadmin/'..directory..'" /b'
end
for filename in io.popen(command):lines() do
table.insert(entries, filename)
end
@ -133,4 +133,4 @@ function files.save(fileName, array)
return true
end
return files
return files

View File

@ -44,7 +44,7 @@ local data = {
["g_standalone"] = 1,
["g_debugWolfAdmin"] = 0,
["omnibot_maxbots"] = 10,
["db_type"] = "sqlite",
["db_type"] = "sqlite3",
["db_file"] = "wolfadmin.db",
["db_hostname"] = "localhost",
["db_port"] = 3306,