move server and client commands out of commands.lua (issue #51)

This commit is contained in:
Timo Smit 2016-02-18 20:45:45 +01:00
parent ae8ae5a417
commit eabf1a5fbb
11 changed files with 386 additions and 138 deletions

View file

@ -0,0 +1,48 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
function commandAdminChat(clientId, cmdArguments)
if #cmdArguments == 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^9usage: "..commands.getclient("adminchat")["syntax"].."\";")
else
local message = {}
local recipients = {}
for i = 1, #cmdArguments do
message[i] = cmdArguments[i]
end
for playerId = 0, et.trap_Cvar_Get("sv_maxclients") - 1 do
if wolfa_isPlayer(playerId) and et.G_shrubbot_permission(playerId, "~") == 1 then
table.insert(recipients, playerId)
end
end
for _, recipient in ipairs(recipients) do
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..recipient.." \"^7"..et.gentity_get(clientId, "pers.netname").."^7 -> adminchat ("..#recipients.." recipients): ^a"..table.concat(message, " ").."\";")
et.trap_SendServerCommand(recipient, "cp \"^jadminchat message from ^7"..et.gentity_get(clientId, "pers.netname"))
end
et.G_LogPrint("adminchat: "..et.gentity_get(clientId, "pers.netname")..": "..table.concat(message, " ").."\n")
end
return true
end
commands.addclient("adminchat", commandAdminChat, "~", "[^2message^7]")
commands.addclient("ac", commandAdminChat, "~", "[^2message^7]")

View file

@ -0,0 +1,39 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
local stats = require "luascripts.wolfadmin.players.stats"
function commandPersonalMessage(clientId, cmdArguments)
if #cmdArguments > 1 then
local cmdClient
if tonumber(cmdArguments[1]) == nil then
cmdClient = et.ClientNumberFromString(cmdArguments[1])
else
cmdClient = tonumber(cmdArguments[1])
end
if cmdClient ~= -1 and et.gentity_get(cmdClient, "pers.netname") then
stats.set(cmdClient, "lastMessageFrom", clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..cmdClient.." \"^9reply: ^7r [^2message^7]\";")
end
end
end
commands.addclient("pm", commandPersonalMessage, "", "")
commands.addclient("m", commandPersonalMessage, "", "")

View file

@ -0,0 +1,45 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
local stats = require "luascripts.wolfadmin.players.stats"
function commandR(clientId, cmdArguments)
if #cmdArguments == 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^9usage: "..commands.getclient("r")["syntax"].."\";")
else
local recipient = stats.get(clientId, "lastMessageFrom")
if not (recipient and et.gentity_get(recipient, "pers.netname")) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"player not found\";")
else
local message = {}
for i = 1, #cmdArguments do
message[i] = cmdArguments[i]
end
stats.set(recipient, "lastMessageFrom", clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..recipient.." \"^7"..et.gentity_get(clientId, "pers.netname").."^7 -> "..recipient.." (1 recipients): ^3"..table.concat(message, " ").."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..recipient.." \"^9reply: ^7r [^2message^7]\";")
end
end
return true
end
commands.addclient("r", commandR, "", "[^2message^7]")

View file

@ -0,0 +1,30 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
function commandWolfAdmin(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^3This server is running ^7Wolf^1Admin ^7"..wolfa_getVersion().." ^3("..wolfa_getRelease().."^3)\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^3Created by ^7Timo '^aTimo^qthy^7' ^7Smit^3. More info on\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \" ^7http://dev.timosmit.com/wolfadmin/\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^3Thanks for using!\";")
return true
end
commands.addclient("wolfadmin", commandWolfAdmin, "", "")

View file

@ -155,72 +155,35 @@ end
events.handle("onGameInit", commands.oninit) events.handle("onGameInit", commands.oninit)
function commands.onservercommand(cmdText) function commands.onservercommand(cmdText)
-- this if statement definitely sucks. local wolfCmd = string.lower(et.trap_Argv(0))
if string.lower(et.trap_Argv(0)) == "csay" and et.trap_Argc() >= 3 then local cmdArguments = {}
local clientId = tonumber(et.trap_Argv(1))
if servercmds[wolfCmd] and servercmds[wolfCmd]["function"] then
if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients for i = 1, et.trap_Argc() - 1 do
et.trap_SendServerCommand(clientId, "print \""..et.trap_Argv(2).."\n\";") cmdArguments[i] = et.trap_Argv(i)
elseif clientId then
et.G_Print(util.removeColors(et.trap_Argv(2)).."\n")
end
elseif string.lower(et.trap_Argv(0)) == "ccpm" and et.trap_Argc() >= 3 then
local clientId = tonumber(et.trap_Argv(1))
if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "cpm \""..et.trap_Argv(2).."\";")
elseif clientId then
et.G_Print(util.removeColors(et.trap_Argv(2)).."\n")
end
elseif string.lower(et.trap_Argv(0)) == "cchat" and et.trap_Argc() >= 3 then
local clientId = tonumber(et.trap_Argv(1))
if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "chat \""..et.trap_Argv(2).."\";")
elseif clientId then
et.G_Print(util.removeColors(et.trap_Argv(2)).."\n")
end
elseif string.lower(et.trap_Argv(0)) == "cannounce" and et.trap_Argc() >= 3 then
local clientId = tonumber(et.trap_Argv(1))
if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "announce \""..et.trap_Argv(2).."\";")
elseif clientId then
et.G_Print(util.removeColors(et.trap_Argv(2)).."\n")
end
elseif string.lower(et.trap_Argv(0)) == "cmusic" and et.trap_Argc() >= 3 then
local clientId = tonumber(et.trap_Argv(1))
if clientId and clientId ~= -1337 then -- -1337 because -1 is a magic number/broadcasted to all clients
et.trap_SendServerCommand(clientId, "mu_play \""..et.trap_Argv(2).."\";")
elseif clientId then
et.G_Print(util.removeColors(et.trap_Argv(2)).."\n")
end
elseif et.trap_Argv(0) == "cmdclient" then
local cmd = et.trap_Argv(1)
local clientId = tonumber(et.trap_Argv(2))
et.trap_SendServerCommand(clientId, cmd.." \""..et.trap_Argv(3).."\n\";")
else
-- TODO: merge with commands.onclientcommand
local shrubCmd = cmdText
local shrubArgumentsOffset = 1
local shrubArguments = {}
if string.find(cmdText, "!") == 1 then
shrubCmd = string.lower(string.sub(cmdText, 2, string.len(cmdText)))
end end
if admincmds[shrubCmd] and admincmds[shrubCmd]["function"] and admincmds[shrubCmd]["flag"] then return servercmds[wolfCmd]["function"](clientId, cmdArguments) and 1 or 0
for i = 1, et.trap_Argc() - shrubArgumentsOffset do end
shrubArguments[i] = et.trap_Argv(i + shrubArgumentsOffset - 1)
end -- TODO: merge with commands.onclientcommand
local shrubCmd = cmdText
admincmds[shrubCmd]["function"](-1337, shrubArguments) local shrubArgumentsOffset = 1
local shrubArguments = {}
if not admincmds[shrubCmd]["hidden"] then
commands.log(-1, shrubCmd, shrubArguments) if string.find(cmdText, "!") == 1 then
end shrubCmd = string.lower(string.sub(cmdText, 2, string.len(cmdText)))
end
if admincmds[shrubCmd] and admincmds[shrubCmd]["function"] and admincmds[shrubCmd]["flag"] then
for i = 1, et.trap_Argc() - shrubArgumentsOffset do
shrubArguments[i] = et.trap_Argv(i + shrubArgumentsOffset - 1)
end
admincmds[shrubCmd]["function"](-1337, shrubArguments)
if not admincmds[shrubCmd]["hidden"] then
commands.log(-1, shrubCmd, shrubArguments)
end end
end end
end end
@ -229,86 +192,23 @@ events.handle("onServerCommand", commands.onservercommand)
function commands.onclientcommand(clientId, cmdText) function commands.onclientcommand(clientId, cmdText)
local wolfCmd = string.lower(et.trap_Argv(0)) local wolfCmd = string.lower(et.trap_Argv(0))
local shrubCmd = nil local shrubCmd = nil
local cmdArguments = {}
local shrubArguments = {} local shrubArguments = {}
local shrubArgumentsOffset = 0 local shrubArgumentsOffset = 0
if wolfCmd == "m" or wolfCmd == "pm" then -- mod-specific or custom commands loading
if et.trap_Argc() > 2 then if clientcmds[wolfCmd] and clientcmds[wolfCmd]["function"] and clientcmds[wolfCmd]["flag"] then
local cmdClient if clientcmds[wolfCmd]["flag"] == "" or et.G_shrubbot_permission(clientId, clientcmds[wolfCmd]["flag"]) == 1 then
for i = 1, et.trap_Argc() - 1 do
if tonumber(et.trap_Argv(1)) == nil then cmdArguments[i] = et.trap_Argv(i)
cmdClient = et.ClientNumberFromString(et.trap_Argv(1))
else
cmdClient = tonumber(et.trap_Argv(1))
end end
if cmdClient ~= -1 and et.gentity_get(cmdClient, "pers.netname") then return clientcmds[wolfCmd]["function"](clientId, cmdArguments) and 1 or 0
stats.set(cmdClient, "lastMessageFrom", clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..cmdClient.." \"^9reply: ^7r [^2message^7]\";")
end
end end
elseif wolfCmd == "r" then end
if et.trap_Argc() == 1 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^9usage: ^7"..wolfCmd.." [^2message^7]\";") -- all Wolfenstein-related commands defined separately for now
else if wolfCmd == "team" then
local recipient = stats.get(clientId, "lastMessageFrom")
if not (recipient and et.gentity_get(recipient, "pers.netname")) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"player not found\";")
else
local message = {}
for i = 1, et.trap_Argc() - 1 do
message[i] = et.trap_Argv(i)
end
stats.set(recipient, "lastMessageFrom", clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..recipient.." \"^7"..et.gentity_get(clientId, "pers.netname").."^7 -> "..recipient.." (1 recipients): ^3"..table.concat(message, " ").."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..recipient.." \"^9reply: ^7r [^2message^7]\";")
end
end
return 1
elseif wolfCmd == "adminchat" or wolfCmd == "ac" then
if et.G_shrubbot_permission(clientId, "~") == 1 then
if et.trap_Argc() == 1 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^9usage: ^7"..wolfCmd.." [^2message^7]\";")
else
local message = {}
local recipients = {}
for i = 1, et.trap_Argc() - 1 do
message[i] = et.trap_Argv(i)
end
for playerId = 0, et.trap_Cvar_Get("sv_maxclients") - 1 do
if wolfa_isPlayer(playerId) and et.G_shrubbot_permission(playerId, "~") == 1 then
table.insert(recipients, playerId)
end
end
for _, recipient in ipairs(recipients) do
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..recipient.." \"^7"..et.gentity_get(clientId, "pers.netname").."^7 -> adminchat ("..#recipients.." recipients): ^a"..table.concat(message, " ").."\";")
et.trap_SendServerCommand(recipient, "cp \"^jadminchat message from ^7"..et.gentity_get(clientId, "pers.netname"))
end
et.G_LogPrint("adminchat: "..et.gentity_get(clientId, "pers.netname")..": "..table.concat(message, " ").."\n")
end
end
return 1
elseif wolfCmd == "wolfadmin" then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^3This server is running ^7Wolf^1Admin ^7"..wolfa_getVersion().." ^3("..wolfa_getRelease().."^3)\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^3Created by ^7Timo '^aTimo^qthy^7' ^7Smit^3. More info on\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \" ^7http://dev.timosmit.com/wolfadmin/\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^3Thanks for using!\";")
return 1
elseif wolfCmd == "team" then
if admin.isPlayerLocked(clientId) then if admin.isPlayerLocked(clientId) then
local clientTeam = tonumber(et.gentity_get(clientId, "sess.sessionTeam")) local clientTeam = tonumber(et.gentity_get(clientId, "sess.sessionTeam"))
local teamName = util.getTeamName(clientTeam) local teamName = util.getTeamName(clientTeam)

View file

@ -0,0 +1,31 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
function commandClientAnnounce(clientId, 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)

View file

@ -0,0 +1,31 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
function commandClientChatPrint(clientId, 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)

View file

@ -0,0 +1,31 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
function commandClientCenterPrint(clientId, 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)

View file

@ -0,0 +1,31 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
function commandClientCPM(clientId, 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)

View file

@ -0,0 +1,31 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
function commandClientPlayMusic(clientId, 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)

View file

@ -0,0 +1,31 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2016 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = require "luascripts.wolfadmin.commands.commands"
function commandClientConsolePrint(clientId, 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)