mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-21 20:01:18 +00:00
Parametrized !shuffle command (fixes #101)
This commit is contained in:
parent
30dd74965d
commit
2bef5f87db
2 changed files with 22 additions and 33 deletions
|
@ -19,11 +19,29 @@ local auth = wolfa_requireModule("auth.auth")
|
|||
local commands = wolfa_requireModule("commands.commands")
|
||||
local settings = wolfa_requireModule("util.settings")
|
||||
|
||||
function commandShuffle(clientId, command)
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by XP.\";")
|
||||
function commandShuffle(clientId, command, type)
|
||||
if type == "xp" then
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by XP.\";")
|
||||
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "shuffle_teams")
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "shuffle_teams")
|
||||
elseif type == "sr" then
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by SR.\";")
|
||||
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "shuffle_teams_sr")
|
||||
elseif type == nil then
|
||||
if settings.get("fs_game") == "legacy" then
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by SR.\";")
|
||||
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "shuffle_teams_sr")
|
||||
else
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by XP.\";")
|
||||
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "shuffle_teams")
|
||||
end
|
||||
else
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dshuffle usage: "..commands.getadmin("shuffle")["syntax"].."\";")
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("shuffle", commandShuffle, auth.PERM_SHUFFLE, "shuffle the teams by XP to try and even them", nil, nil, (settings.get("g_standalone") == 0))
|
||||
commands.addadmin("shuffle", commandShuffle, auth.PERM_SHUFFLE, "shuffle the teams to try and even them", "^2!shuffle ^9(^hxp|sr^9)", nil, (settings.get("g_standalone") == 0))
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
|
||||
-- Copyright (C) 2015-2019 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 auth = wolfa_requireModule("auth.auth")
|
||||
local commands = wolfa_requireModule("commands.commands")
|
||||
local settings = wolfa_requireModule("util.settings")
|
||||
|
||||
function commandShuffleSR(clientId, command)
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by Skill Rating.\";")
|
||||
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "shuffle_teams_sr")
|
||||
|
||||
return true
|
||||
end
|
||||
commands.addadmin("shufflesr", commandShuffleSR, auth.PERM_SHUFFLE, "shuffle the teams by Skill Rating to try and even them", nil, nil, (settings.get("fs_game") ~= "legacy"))
|
Loading…
Reference in a new issue