Skip to content

Commit

Permalink
Fixed !listmaps not producing any output (refs #62)
Browse files Browse the repository at this point in the history
  • Loading branch information
timosmit committed Dec 31, 2018
1 parent 53e3102 commit 78139e6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions luamods/wolfadmin/commands/admin/listmaps.lua
Expand Up @@ -22,15 +22,21 @@ local commands = require (wolfa_getLuaPath()..".commands.commands")
local game = require (wolfa_getLuaPath()..".game.game")

function commandListMaps(clientId, command)
local output = ""

local maps = game.getMaps()


if #maps == 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistmaps: ^9no map information available.\";")

return true
end

local output = ""

for _, map in ipairs(maps) do
local prefix = "^9"
if map == game.getMap() then prefix = "^7" end
output = (output ~= "") and output.." "..prefix..map or map

output = (output ~= "") and output.." "..prefix..map or prefix..map
end

et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dlistmaps: ^9"..output.. "\";")
Expand Down

0 comments on commit 78139e6

Please sign in to comment.