Permalink
Browse files

Fixed 'console:' prefix on legacymod (fixes #66)

  • Loading branch information...
timosmit committed Jan 28, 2017
1 parent 531b156 commit d58a228ed2a28eeabd1b3182799f93a5e1657898
@@ -47,7 +47,7 @@ function balancer.balance(byAdmin, forceBalance)
evenerCount = 0
if byAdmin then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^devener: ^9teams are even.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^devener: ^9teams are even.\";")
end
return
@@ -82,7 +82,7 @@ function balancer.balance(byAdmin, forceBalance)
local player = balancer.findPlayer(teamsData[teamGreater], teamGreater, teamSmaller)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "!put "..player.." "..(teamGreater == constants.TEAM_AXIS and constants.TEAM_ALLIES_SC or constants.TEAM_AXIS_SC)..";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^devener: ^9thank you, ^7"..et.gentity_get(player, "pers.netname").."^9, for helping to even the teams.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^devener: ^9thank you, ^7"..et.gentity_get(player, "pers.netname").."^9, for helping to even the teams.\";")
teamsData = teams.get()
end
@@ -92,7 +92,7 @@ function balancer.balance(byAdmin, forceBalance)
local teamGreaterName, teamSmallerName = util.getTeamName(teamGreater), util.getTeamName(teamSmaller)
local teamGreaterColor, teamSmallerColor = util.getTeamColor(teamGreater), util.getTeamColor(teamSmaller)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^devener: ^9teams seem unfair, would someone from "..teamGreaterColor..teamGreaterName.." ^9please switch to "..teamSmallerColor..teamSmallerName.."^9?\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^devener: ^9teams seem unfair, would someone from "..teamGreaterColor..teamGreaterName.." ^9please switch to "..teamSmallerColor..teamSmallerName.."^9?\";")
end
end
end
@@ -69,7 +69,7 @@ function mutes.checkUnmutes()
if players.isMuted(clientId) and players.getMuteExpiresAt(clientId) < os.time() then
mutes.removeByClient(clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dunmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been automatically unmuted\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dunmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been automatically unmuted\";")
end
end
end
@@ -24,15 +24,15 @@ function commandBalance(clientId, command, action)
if not balancer.isRunning() then
balancer.enable()
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dbalancer: ^9balancer enabled.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dbalancer: ^9balancer enabled.\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dbalancer: ^9balancer is already running.\";")
end
elseif action == "disable" then
if balancer.isRunning() then
balancer.disable()
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dbalancer: ^9balancer disabled.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dbalancer: ^9balancer disabled.\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dbalancer: ^9balancer was not running.\";")
end
@@ -75,7 +75,7 @@ function commandBan(clientId, command, victim, ...)
bans.add(cmdClient, clientId, duration, reason)
history.add(cmdClient, clientId, "ban", reason)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been banned for "..duration.." seconds\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been banned for "..duration.." seconds\";")
return true
end
@@ -20,8 +20,8 @@ local auth = require (wolfa_getLuaPath()..".auth.auth")
local voting = require (wolfa_getLuaPath()..".game.voting")
function commandEnableVote(clientId, command, ...)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^denablevote: ^9next map voting has been enabled.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^denablevote: ^9next map voting has been enabled.\";")
voting.force("nextmap")
return true
@@ -21,9 +21,9 @@ local bots = require (wolfa_getLuaPath()..".game.bots")
function commandBotsOff(clientId, command)
bots.enable(false)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dkickbots: ^9bots were toggled off.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dkickbots: ^9bots were toggled off.\";")
return true
end
commands.addadmin("kickbots", commandBotsOff, auth.PERM_BOTADMIN, "kicks all bots from the game")
@@ -31,9 +31,9 @@ function commandListMaps(clientId, command)
output = (output ~= "") and output.." "..prefix..map or map
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dlistmaps: ^9"..output.. "\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dlistmaps: ^9"..output.. "\";")
return true
end
commands.addadmin("listmaps", commandListMaps, auth.PERM_LISTMAPS, "display the maps in the rotation")
@@ -56,15 +56,15 @@ function commandLock(clientId, command, team)
teams.lock(constants.TEAM_ALLIES)
teams.lock(constants.TEAM_SPECTATORS)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dlock: ^9all teams have been locked.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dlock: ^9all teams have been locked.\";")
return false
end
local team = util.getTeamFromCode(team)
teams.lock(team)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dlock: "..util.getTeamColor(team)..util.getTeamName(team).." ^9team has been locked.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dlock: "..util.getTeamColor(team)..util.getTeamName(team).." ^9team has been locked.\";")
return false
end
@@ -82,7 +82,7 @@ function commandMute(clientId, command, victim, ...)
mutes.add(cmdClient, clientId, players.MUTE_CHAT + players.MUTE_VOICE, duration, reason)
history.add(cmdClient, clientId, "mute", reason)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been muted for "..duration.." seconds\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been muted for "..duration.." seconds\";")
return true
end
@@ -21,9 +21,9 @@ local bots = require (wolfa_getLuaPath()..".game.bots")
function commandBotsOn(clientId, command)
bots.enable(true)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dneedbots: ^9bots were toggled on.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dneedbots: ^9bots were toggled on.\";")
return true
end
commands.addadmin("needbots", commandBotsOn, auth.PERM_BOTADMIN, "adds bots to the game")
@@ -57,9 +57,9 @@ function commandPlayerLock(clientId, command, victim)
return true
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dplock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been locked to his team\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dplock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been locked to his team\";")
players.setTeamLocked(cmdClient, true)
return true
@@ -49,9 +49,9 @@ function commandPlayerUnlock(clientId, command, victim)
return true
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dpunlock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been unlocked from his team\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dpunlock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been unlocked from his team\";")
players.setTeamLocked(cmdClient, false)
return true
@@ -60,7 +60,7 @@ function commandPlayerLock(clientId, command, victim, team)
-- cannot unbalance teams in certain mods (see g_svcmds.c:SetTeam)
-- fixed in legacymod
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dput: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been put to "..util.getTeamColor(team)..util.getTeamName(team).."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dput: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been put to "..util.getTeamColor(team)..util.getTeamName(team).."\";")
admin.putPlayer(cmdClient, team)
@@ -32,13 +32,13 @@ function commandPutBots(clientId, command, team)
team = util.getTeamFromCode(team)
bots.put(team)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dputbots: ^9all bots were set to ^7"..util.getTeamColor(team)..util.getTeamName(team).." ^9team.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dputbots: ^9all bots were set to ^7"..util.getTeamColor(team)..util.getTeamName(team).." ^9team.\";")
if (team == constants.TEAM_AXIS or team == constants.TEAM_ALLIES) and balancer.isRunning() then
balancer.disable()
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dbalancer: ^9balancer disabled.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dbalancer: ^9balancer disabled.\";")
end
return true
@@ -30,12 +30,12 @@ function commandResetSprees(clientId, command, map)
if map and map == "all" then
sprees.reset(true)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dresetsprees: ^9all spree records have been reset.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dresetsprees: ^9all spree records have been reset.\";")
else
sprees.reset()
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dresetsprees: ^9spree records have been reset for map '^7"..game.getMap().."^9'.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dresetsprees: ^9spree records have been reset for map '^7"..game.getMap().."^9'.\";")
end
return true
@@ -37,7 +37,7 @@ function commandRules(clientId, command, rule)
local rule = rules.get(string.lower(rule))
if rule then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^drules: "..rules.get(string.lower(cmdArguments[1])).."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^drules: "..rules.get(string.lower(cmdArguments[1])).."\";")
end
end
@@ -33,13 +33,13 @@ function commandShowSprees(clientId, command)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsprees: ^9there are no records for this map yet.\"")
else
if records["ksrecord"] and records["ksrecord"] > 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dsprees: ^9longest kill spree (^7"..records["ksrecord"].."^9) by ^7"..records["ksname"].."^9.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dsprees: ^9longest kill spree (^7"..records["ksrecord"].."^9) by ^7"..records["ksname"].."^9.\";")
end
if records["dsrecord"] and records["dsrecord"] > 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dsprees: ^9longest death spree (^7"..records["dsrecord"].."^9) by ^7"..records["dsname"].."^9.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dsprees: ^9longest death spree (^7"..records["dsrecord"].."^9) by ^7"..records["dsname"].."^9.\";")
end
if records["rsrecord"] and records["rsrecord"] > 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dsprees: ^9longest revive spree (^7"..records["rsrecord"].."^9) by ^7"..records["rsname"].."^9.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dsprees: ^9longest revive spree (^7"..records["rsrecord"].."^9) by ^7"..records["rsname"].."^9.\";")
end
end
@@ -56,15 +56,15 @@ function commandUnlock(clientId, command, team)
teams.unlock(constants.TEAM_ALLIES)
teams.unlock(constants.TEAM_SPECTATORS)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dlock: ^9all teams have been unlocked.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dlock: ^9all teams have been unlocked.\";")
return false
end
local team = util.getTeamFromCode(team)
teams.unlock(team)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dlock: "..util.getTeamColor(team)..util.getTeamName(team).." ^9team has been unlocked.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dlock: "..util.getTeamColor(team)..util.getTeamName(team).." ^9team has been unlocked.\";")
return false
end
@@ -52,7 +52,7 @@ function commandUnmute(clientId, command, victim)
return true
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dunmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been unmuted\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dunmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been unmuted\";")
mutes.removeByClient(cmdClient)
@@ -80,8 +80,8 @@ function commandVoiceMute(clientId, command, victim, ...)
mutes.add(cmdClient, clientId, players.MUTE_VOICE, duration, reason)
history.add(cmdClient, clientId, "vmute", reason)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dvmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been voicemuted for "..duration.." seconds\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dvmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been voicemuted for "..duration.." seconds\";")
return true
end
commands.addadmin("vmute", commandVoiceMute, auth.PERM_VOICEMUTE, "voicemutes a player", "^9[^3name|slot#^9]")
@@ -47,9 +47,9 @@ function commandVoiceUnmute(clientId, command, victim)
return true
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dvunmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been unvoicemuted\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dvunmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been unvoicemuted\";")
mutes.removeByClient(cmdClient)
return true
@@ -76,11 +76,11 @@ function game.onstatechange(gameState)
if gameState == 3 then
-- do not display when there haven't been any kills
if lastKillerId ~= nil then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dAnd the last kill of the round goes to.. ^7"..et.gentity_get(lastKillerId, "pers.netname").."^d!\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dA total of ^7"..killCount.." ^dsoldiers died during this battle.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dAnd the last kill of the round goes to.. ^7"..et.gentity_get(lastKillerId, "pers.netname").."^d!\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dA total of ^7"..killCount.." ^dsoldiers died during this battle.\";")
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dNext map: ^7"..game.getNextMap().."^d.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dNext map: ^7"..game.getNextMap().."^d.\";")
end
end
events.handle("onGameStateChange", game.onstatechange)
@@ -131,26 +131,26 @@ function sprees.ongamestatechange(gameState)
else
db.addrecord(currentMapId, os.time(), constants.RECORD_KILL, currentRecords["ksrecord"], currentRecords["ksplayer"])
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dsprees: ^9longest kill spree (^7"..currentRecords["ksrecord"].."^9) by ^7"..db.getlastalias(currentRecords["ksplayer"])["alias"].."^9.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dsprees: ^9longest kill spree (^7"..currentRecords["ksrecord"].."^9) by ^7"..db.getlastalias(currentRecords["ksplayer"])["alias"].."^9.\";")
end
if currentRecords["dsrecord"] and currentRecords["dsrecord"] > 0 then
if db.getrecord(currentMapId, constants.RECORD_DEATH) then
db.updaterecord(currentMapId, os.time(), constants.RECORD_DEATH, currentRecords["dsrecord"], currentRecords["dsplayer"])
else
db.addrecord(currentMapId, os.time(), constants.RECORD_DEATH, currentRecords["dsrecord"], currentRecords["dsplayer"])
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dsprees: ^9longest death spree (^7"..currentRecords["dsrecord"].."^9) by ^7"..db.getlastalias(currentRecords["dsplayer"])["alias"].."^9.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dsprees: ^9longest death spree (^7"..currentRecords["dsrecord"].."^9) by ^7"..db.getlastalias(currentRecords["dsplayer"])["alias"].."^9.\";")
end
if currentRecords["rsrecord"] and currentRecords["rsrecord"] > 0 then
if db.getrecord(currentMapId, constants.RECORD_REVIVE) then
db.updaterecord(currentMapId, os.time(), constants.RECORD_REVIVE, currentRecords["rsrecord"], currentRecords["rsplayer"])
else
db.addrecord(currentMapId, os.time(), constants.RECORD_REVIVE, currentRecords["rsrecord"], currentRecords["rsplayer"])
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dsprees: ^9longest revive spree (^7"..currentRecords["rsrecord"].."^9) by ^7"..db.getlastalias(currentRecords["rsplayer"])["alias"].."^9.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dsprees: ^9longest revive spree (^7"..currentRecords["rsrecord"].."^9) by ^7"..db.getlastalias(currentRecords["rsplayer"])["alias"].."^9.\";")
end
end
end
@@ -219,7 +219,7 @@ function sprees.onrevive(clientMedic, clientVictim)
-- stats.set(clientMedic, "longestReviveSpree", stats.get(clientMedic, "currentReviveSpree") > stats.get(clientMedic, "longestReviveSpree") and stats.get(clientMedic, "currentReviveSpree") or stats.get(clientMedic, "longestReviveSpree"))
if revivespreeMessages[playerSprees[clientMedic]["revive"]] then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^1REVIVE SPREE! ^*"..players.getName(clientMedic).." ^*"..revivespreeMessages[playerSprees[clientMedic]["revive"]]["msg"].." ^d(^3"..playerSprees[clientMedic]["revive"].." ^drevives in a row!)\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^1REVIVE SPREE! ^*"..players.getName(clientMedic).." ^*"..revivespreeMessages[playerSprees[clientMedic]["revive"]]["msg"].." ^d(^3"..playerSprees[clientMedic]["revive"].." ^drevives in a row!)\";")
end
if (settings.get("g_botRecords") == 1 or not players.isBot(clientMedic)) and (not currentRecords["rsrecord"] or playerSprees[clientMedic]["revive"] > currentRecords["rsrecord"]) then
@@ -52,8 +52,8 @@ function voting.isrestricted(type)
end
function voting.disablenextmap()
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^dvote: ^9next map voting has automatically been disabled.\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dvote: ^9next map voting has automatically been disabled.\";")
voting.allow("nextmap", 0)
end

0 comments on commit d58a228

Please sign in to comment.