mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-10 06:41:53 +00:00
Fixed minor issues on several commands
* gib now by correct attacker (world entity) * listlevels should not read shrubbot in standalone mode
This commit is contained in:
parent
839036eb23
commit
449e6c856f
2 changed files with 36 additions and 30 deletions
|
@ -55,9 +55,9 @@ function commandGib(clientId, cmdArguments)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- GENTITYNUM_BITS 10 10
|
-- GENTITYNUM_BITS 10 10
|
||||||
-- MAX_GENTITIES 1 << GENTITYNUM_BITS 20
|
-- MAX_GENTITIES 1 << GENTITYNUM_BITS 1024
|
||||||
-- ENTITYNUM_WORLD MAX_GENTITIES - 2 18
|
-- ENTITYNUM_WORLD MAX_GENTITIES - 2 18
|
||||||
et.G_Damage(cmdClient, 18, 18, 500, 0, 0) -- MOD_UNKNOWN = 0
|
et.G_Damage(cmdClient, 0, 1024, 500, 0, 0) -- MOD_UNKNOWN = 0
|
||||||
|
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dgib: ^7"..players.getName(cmdClient).." ^9was gibbed.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dgib: ^7"..players.getName(cmdClient).." ^9was gibbed.\";")
|
||||||
|
|
||||||
|
|
|
@ -29,35 +29,41 @@ local util = require (wolfa_getLuaPath()..".util.util")
|
||||||
|
|
||||||
function commandListLevels(clientId, cmdArguments)
|
function commandListLevels(clientId, cmdArguments)
|
||||||
if cmdArguments[1] == nil then
|
if cmdArguments[1] == nil then
|
||||||
local fileName = et.trap_Cvar_Get("g_shrubbot")
|
if settings.get("g_standalone") ~= 0 then
|
||||||
local functionStart = et.trap_Milliseconds()
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistlevels usage: "..commands.getadmin("listlevels")["syntax"].."\";")
|
||||||
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_READ)
|
|
||||||
local levelsCount = 0
|
|
||||||
|
|
||||||
if fileLength == -1 then
|
return true
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistlevels: ^9an error happened (shrubbot file could not be opened)\";")
|
else
|
||||||
|
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 levelsCount = 0
|
||||||
|
|
||||||
error("failed to open "..fileName.."\n")
|
if fileLength == -1 then
|
||||||
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistlevels: ^9an error happened (shrubbot file could not be opened)\";")
|
||||||
|
|
||||||
|
error("failed to open "..fileName.."\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
local fileString = et.trap_FS_Read(fileDescriptor, fileLength)
|
||||||
|
|
||||||
|
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
|
||||||
|
-- et.G_Print(string.format("%d %s %s\n", levelNr, levelName, levelFlags))
|
||||||
|
|
||||||
|
local numberOfSpaces = 24 - string.len(util.removeColors(levelName))
|
||||||
|
local spaces = string.rep(" ", numberOfSpaces)
|
||||||
|
|
||||||
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^7"..string.format("%5s", levelNr).." ^7"..spaces..levelName.." ^7"..levelFlags.."\";")
|
||||||
|
|
||||||
|
levelsCount = levelsCount + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dlistlevels: ^9"..levelsCount.." available levels (open console for the full list)\";")
|
||||||
|
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local fileString = et.trap_FS_Read(fileDescriptor, fileLength)
|
|
||||||
|
|
||||||
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
|
|
||||||
-- et.G_Print(string.format("%d %s %s\n", levelNr, levelName, levelFlags))
|
|
||||||
|
|
||||||
local numberOfSpaces = 24 - string.len(util.removeColors(levelName))
|
|
||||||
local spaces = string.rep(" ", numberOfSpaces)
|
|
||||||
|
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^7"..string.format("%5s", levelNr).." ^7"..spaces..levelName.." ^7"..levelFlags.."\";")
|
|
||||||
|
|
||||||
levelsCount = levelsCount + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dlistlevels: ^9"..levelsCount.." available levels (open console for the full list)\";")
|
|
||||||
|
|
||||||
return true
|
|
||||||
elseif not db.isconnected() then
|
elseif not db.isconnected() then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistlevels: ^9level history is disabled.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistlevels: ^9level history is disabled.\";")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue