Skip to content

Commit

Permalink
Removed unused variable from server commands (refs #75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Smit committed Jan 21, 2017
1 parent 75a19df commit f0618d8
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 23 deletions.
8 changes: 4 additions & 4 deletions luamods/wolfadmin/commands/commands.lua
Expand Up @@ -176,8 +176,8 @@ function commands.onServerCommand(cmdText)
for i = 1, et.trap_Argc() - 1 do
cmdArguments[i] = et.trap_Argv(i)
end
return servercmds[wolfCmd]["function"](clientId, cmdArguments) and 1 or 0

return servercmds[wolfCmd]["function"](cmdArguments) and 1 or 0
end

local shrubCmd = cmdText
Expand All @@ -194,8 +194,8 @@ function commands.onServerCommand(cmdText)
if not admincmds[shrubCmd]["hidden"] then
commands.log(-1337, shrubCmd, cmdArguments)
end
admincmds[shrubCmd]["function"](-1337, cmdArguments)

return admincmds[shrubCmd]["function"](-1337, cmdArguments) and 1 or 0
end
end
events.handle("onServerCommand", commands.onServerCommand)
Expand Down
2 changes: 1 addition & 1 deletion luamods/wolfadmin/commands/server/acl.lua
Expand Up @@ -172,7 +172,7 @@ function commandAclCopyLevelRoles(cmdArguments)
et.G_Print("copied roles from "..levelId.." to "..newLevelId.."\n")
end

function commandAcl(clientId, cmdArguments)
function commandAcl(cmdArguments)
local cmd = cmdArguments[1]

if cmd == "listlevels" then
Expand Down
7 changes: 4 additions & 3 deletions luamods/wolfadmin/commands/server/cannounce.lua
Expand Up @@ -16,17 +16,18 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local commands = require (wolfa_getLuaPath()..".commands.commands")

local util = require (wolfa_getLuaPath()..".util.util")

function commandClientAnnounce(clientId, cmdArguments)
function commandClientAnnounce(cmdArguments)
local clientId = tonumber(cmdArguments[1])

if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "announce \""..cmdArguments[2].."\";")
elseif clientId then
et.G_Print(util.removeColors(cmdArguments[2]).."\n")
end

return true
end
commands.addserver("cannounce", commandClientAnnounce)
7 changes: 4 additions & 3 deletions luamods/wolfadmin/commands/server/cchat.lua
Expand Up @@ -16,17 +16,18 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local commands = require (wolfa_getLuaPath()..".commands.commands")

local util = require (wolfa_getLuaPath()..".util.util")

function commandClientChatPrint(clientId, cmdArguments)
function commandClientChatPrint(cmdArguments)
local clientId = tonumber(cmdArguments[1])

if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "chat \""..cmdArguments[2].."\";")
elseif clientId then
et.G_Print(util.removeColors(cmdArguments[2]).."\n")
end

return true
end
commands.addserver("cchat", commandClientChatPrint)
7 changes: 4 additions & 3 deletions luamods/wolfadmin/commands/server/ccp.lua
Expand Up @@ -16,17 +16,18 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local commands = require (wolfa_getLuaPath()..".commands.commands")

local util = require (wolfa_getLuaPath()..".util.util")

function commandClientCenterPrint(clientId, cmdArguments)
function commandClientCenterPrint(cmdArguments)
local clientId = tonumber(cmdArguments[1])

if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "cp \""..cmdArguments[2].."\";")
elseif clientId then
et.G_Print(util.removeColors(cmdArguments[2]).."\n")
end

return true
end
commands.addserver("ccp", commandClientCenterPrint)
7 changes: 4 additions & 3 deletions luamods/wolfadmin/commands/server/ccpm.lua
Expand Up @@ -16,17 +16,18 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local commands = require (wolfa_getLuaPath()..".commands.commands")

local util = require (wolfa_getLuaPath()..".util.util")

function commandClientCPM(clientId, cmdArguments)
function commandClientCPM(cmdArguments)
local clientId = tonumber(cmdArguments[1])

if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "cpm \""..cmdArguments[2].."\";")
elseif clientId then
et.G_Print(util.removeColors(cmdArguments[2]).."\n")
end

return true
end
commands.addserver("ccpm", commandClientCPM)
7 changes: 4 additions & 3 deletions luamods/wolfadmin/commands/server/cmusic.lua
Expand Up @@ -16,17 +16,18 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local commands = require (wolfa_getLuaPath()..".commands.commands")

local util = require (wolfa_getLuaPath()..".util.util")

function commandClientPlayMusic(clientId, cmdArguments)
function commandClientPlayMusic(cmdArguments)
local clientId = tonumber(cmdArguments[1])

if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "mu_play \""..cmdArguments[2].."\";")
elseif clientId then
et.G_Print(util.removeColors(cmdArguments[2]).."\n")
end

return true
end
commands.addserver("cmusic", commandClientPlayMusic)
7 changes: 4 additions & 3 deletions luamods/wolfadmin/commands/server/csay.lua
Expand Up @@ -16,17 +16,18 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local commands = require (wolfa_getLuaPath()..".commands.commands")

local util = require (wolfa_getLuaPath()..".util.util")

function commandClientConsolePrint(clientId, cmdArguments)
function commandClientConsolePrint(cmdArguments)
local clientId = tonumber(cmdArguments[1])

if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "print \""..cmdArguments[2].."\n\";")
elseif clientId then
et.G_Print(util.removeColors(cmdArguments[2]).."\n")
end

return true
end
commands.addserver("csay", commandClientConsolePrint)

0 comments on commit f0618d8

Please sign in to comment.