Skip to content

Commit

Permalink
add global voiceline muting command
Browse files Browse the repository at this point in the history
also enable voiceline module
  • Loading branch information
TerminalHash committed Apr 20, 2024
1 parent edb972d commit 663c14d
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 41 deletions.
1 change: 1 addition & 0 deletions Modules/CaptainsModule/Commands/GruhshaChatCommands.as
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ void RegisterGruhshaChatCommands(ChatCommandManager@ manager)
manager.RegisterCommand(SetArcherLimitCommand());
manager.RegisterCommand(ToggleClassChangingOnShops());
manager.RegisterCommand(BindingsMenu());
manager.RegisterCommand(PreventVoicelineSpamming());
}
51 changes: 48 additions & 3 deletions Modules/CaptainsModule/Commands/PickingCommands.as
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class AppointCommand : ChatCommand
{
super("appoint", Descriptions::appointcomtext);
AddAlias("caps");
AddAlias("captains");
SetUsage("<blue leader username> <red leader username>");
}

Expand Down Expand Up @@ -284,12 +285,16 @@ class ToggleClassChangingOnShops : ChatCommand
CRules@ rules = getRules();
bool isEnable = rules.get_bool("no_class_change_on_shop");
rules.set_bool("no_class_change_on_shop", !isEnable);
//printf("Boolean no_class_change_on_shop is " + rules.get_bool("no_class_change_on_shop"));

string isEnableStr = Descriptions::togglechcom2;

if(!isEnable) {
isEnableStr = Descriptions::togglechcom3;
}

if (isServer()) server_AddToChat(Descriptions::togglechcomchat +isEnableStr, SColor(0xff474ac6));

printf("[ADMIN COMMAND] Class changing in shops is " + rules.get_bool("no_class_change_on_shop"));
}
}

Expand Down Expand Up @@ -322,7 +327,47 @@ class BindingsMenu : ChatCommand
ResetRuleSettings();
LoadFileSettings();
}

//printf("Boolean no_class_change_on_shop is " + rules.get_bool("no_class_change_on_shop"));
}
}

class PreventVoicelineSpamming : ChatCommand
{
PreventVoicelineSpamming()
{
super("mutevoice", Descriptions::preventvoicelinespamtext);
AddAlias("mutevc");
AddAlias("mvc");
SetUsage("<username>");
}

bool canPlayerExecute(CPlayer@ player)
{
return (
ChatCommand::canPlayerExecute(player) &&
!ChatCommands::getManager().whitelistedClasses.empty()
);
}

void Execute(string[] args, CPlayer@ player)
{
CRules@ rules = getRules();

if (args.size() < 1) return;

const string MUTED_PLAYER_USERNAME = args[0];

CPlayer@ muted_player = getPlayerByNamePart(MUTED_PLAYER_USERNAME);

if (muted_player is null) return;

rules.set_bool(muted_player.getUsername() + "is_sounds_muted", !rules.get_bool(muted_player.getUsername() + "is_sounds_muted"));
if (rules.get_bool(muted_player.getUsername() + "is_sounds_muted") == true)
{
printf("[ADMIN COMMAND] Player " + muted_player.getUsername() + " was forbidden using voiceline for spamming");
}
else
{
printf("[ADMIN COMMAND] Player " + muted_player.getUsername() + " was allowed using voicelines");
}
}
}
76 changes: 39 additions & 37 deletions Modules/SoundModule/SoundCommands.as
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,31 @@ bool onClientProcessChat(CRules@ this, const string& in textIn, string& out text
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 60);
this.set_u32(player.getUsername() + "soundcooldown", 40);
} else if (textIn.toUpper() == "POG" || textIn.toUpper() == "POGGERS") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "poggers.ogg", pos);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 80);
this.set_u32(player.getUsername() + "soundcooldown", 40);
} else if (textIn.toUpper().find("SUS", 0) != -1) {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "sus.ogg", pos, 1.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "BRUH" || textIn.toUpper() == ("БРУХ") || textIn.toUpper() == ("БРАХ")) {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "bruh.ogg", pos, 1.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn == ("оуе") || textIn == ("oue") || textIn == ("ohyea") || textIn == ("ohyeah") || textIn.find("оу", 0) != -1 && textIn.find("е", 0) != -1 || textIn.find("оу", 0) != -1 && textIn.find("еe", 0) != -1 || textIn.find("oh", 0) != -1 && textIn.find("yea", 0) != -1 || textIn.find("oh", 0) != -1 && textIn.find("yeah", 0) != -1 || textIn.find("OH", 0) != -1 && textIn.find("YEAH", 0) != -1 || textIn.find("OH", 0) != -1 && textIn.find("YEA", 0) != -1) {
if (annoying_voicelines_sounds == "on")
{
Expand All @@ -87,7 +87,7 @@ bool onClientProcessChat(CRules@ this, const string& in textIn, string& out text
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 60);
this.set_u32(player.getUsername() + "soundcooldown", 80);


} else if (textIn.toUpper() == "YEP" || textIn.toUpper() == "YOP" || textIn == "дап" || textIn == "Дап") {
Expand All @@ -98,87 +98,96 @@ bool onClientProcessChat(CRules@ this, const string& in textIn, string& out text
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 60);
this.set_u32(player.getUsername() + "soundcooldown", 80);
} else if (textIn.toUpper() == "NOPE" || textIn == ("ноуп") || textIn == ("Ноуп")) {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "nope.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.findFirst("афк") != -1 || textIn.findFirst("afk") != -1) {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "afk.ogg", pos, 1.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 80);

} else if (textIn.toUpper() == "BANZAI" || textIn == ("банзай") || textIn == ("Банзай")) {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "banzai.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "BOMBASTIC" || textIn == ("бомбастик") || textIn == ("Бомбастик")) {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "bombastic.ogg", pos, 1.2f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "NOTHING WE CAN DO") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "nothwcd.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "KURWA PIERDOLE" || textIn.toUpper() == "KURWA JAPIERDOLE" || textIn.toUpper() == "JAPIERDOLE KURWA") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "kurwa9.ogg", pos, 1.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "KURWA BOBR" || textIn.toUpper() == "BOBR KURWA" || textIn == "курва бобр" || textIn == "бобр курва" || textIn == "Курва бобр" || textIn == "Бобр курва") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "kurwa6.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "RAKIETA") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "rakita.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "JOEVER" || textIn.toUpper() == "GAMEOVER" || textIn.toUpper() == "GAME OVER") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "joever.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "LONG TIME AGO") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "longtime.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "BYE-BYE" || textIn.toUpper() == "BYE BYE") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "byebye.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);

// russian sounds
} else if (textIn == "пенек" || textIn == "пенёк" || textIn == "косарь" || textIn == "penek" || textIn.find("на", 0) != -1 && textIn.find("пенек", 0) != -1 || textIn.find("на", 0) != -1 && textIn.find("пенёк", 0) != -1) {
Expand Down Expand Up @@ -319,14 +328,6 @@ bool onClientProcessChat(CRules@ this, const string& in textIn, string& out text
Sound::Play(soundrandom + "oi" + random + ".ogg", pos, 1.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 80);
} else if (textIn.findFirst("афк") != -1 || textIn.findFirst("afk") != -1) {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "afk.ogg", pos, 1.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 80);
} else if (textIn.findFirst("хехе") != -1 || textIn.findFirst("hehe") != -1) {
Expand Down Expand Up @@ -376,15 +377,15 @@ bool onClientProcessChat(CRules@ this, const string& in textIn, string& out text
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
} else if (textIn.findFirst("огузки") != -1 || textIn.findFirst("Огузки") != -1 || textIn.findFirst("ОГУЗКИ") != -1) {
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.findFirst("огузки") != -1 || textIn.findFirst("Огузки") != -1 || textIn.findFirst("ОГУЗКИ") != -1 || textIn.toUpper().findFirst("OGUZKI") != -1) {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "rage.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 1800);

// MineCult sounds (he-he)
} else if (textIn.toUpper() == "SKILL ISSUE" || textIn == "скилл ишью") {
Expand All @@ -394,48 +395,49 @@ bool onClientProcessChat(CRules@ this, const string& in textIn, string& out text
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
} else if (textIn == "осуждаю" || textIn == "Осуждаю") {
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn == "осуждаю" || textIn == "Осуждаю" || textIn.toUpper() == "BLAMING") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "osujdenie.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn == "надо тащить" || textIn.toUpper() == "Надо тащить" || textIn.toUpper() == "нужно что-то делать" || textIn.toUpper() == "Нужно что-то делать" || textIn.toUpper() == "WEN PUSH" || textIn.toUpper() == "WHEN PUSH") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "nadochotodelat.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
} else if (textIn.toUpper() == "Снайпер" || textIn.toUpper() == "снайпер") {
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn.toUpper() == "Снайпер" || textIn.toUpper() == "снайпер" || textIn.toUpper() == "SNIPER") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "ebanisniper.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
} else if (textIn == "получил пизды" || textIn == "Получил пизды") {
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn == "получил пизды" || textIn == "Получил пизды" || textIn.toUpper() == "GET FUCKED") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "enjoyingpizda.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
} else if (textIn == "Стратегия" || textIn == "стратегия" || textIn == "это стратегия" || textIn == "Это стратегия") {
this.set_u32(player.getUsername() + "soundcooldown", 60);
} else if (textIn == "Стратегия" || textIn == "стратегия" || textIn == "это стратегия" || textIn == "Это стратегия" || textIn.toUpper() == "ITS STRATEGY") {
if (annoying_voicelines_sounds == "on")
{
Sound::Play(soundrandom + "etostrategia.ogg", pos, 2.0f);
}

this.set_u32(player.getUsername() + "lastsoundplayedtime", getGameTime());
this.set_u32(player.getUsername() + "soundcooldown", 30);
this.set_u32(player.getUsername() + "soundcooldown", 60);
}
}

return true;
}
2 changes: 1 addition & 1 deletion Rules/CTF/gamemode.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ scripts = KAG.as;
BindingsMenu.as;
TagSystem.as;
Announce.as;
#SoundCommands.as;
SoundCommands.as;
WhatAState.as;
ColoredNameToggle.as;
DrillZone.as;
Expand Down
1 change: 1 addition & 0 deletions Rules/CommonScripts/ChatCommands.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ commands =
alim; 1; 0;
togglechclass; 1; 0;
bindings; 0; 0;
mutevoice; 1; 0;
#mutetags; 0; 0;
#unmutetags; 0; 0;
togglesounds; 0; 0;
Expand Down
1 change: 1 addition & 0 deletions Translations/TranslationsSystem.as
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ namespace Descriptions
demotecomtext = Translate(en::d_demotecomtext+"\\"+ru::d_demotecomtext),
appointcomtext = Translate(en::d_appointcomtext+"\\"+ru::d_appointcomtext),
specallcomtext = Translate(en::d_specallcomtext+"\\"+ru::d_specallcomtext),
preventvoicelinespamtext = Translate(en::d_preventvoicelinespamtext+"\\"+ru::d_preventvoicelinespamtext),

// Satchel.as
satcheldesc = Translate(en::d_satcheldesc+"\\"+ru::d_satcheldesc),
Expand Down
1 change: 1 addition & 0 deletions Translations/language_en.as
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace en
d_demotecomtext = "Demotes the Team Leaders",
d_appointcomtext = "Appoints two Team Leaders (they pick players in their teams)",
d_specallcomtext = "Puts everyone in Spectators",
d_preventvoicelinespamtext = "Disallow annoying voiceline spam from player",

// Satchel.as
d_satcheldesc = "Ignites flammable blocks, activated by throw key",
Expand Down
1 change: 1 addition & 0 deletions Translations/language_ru.as
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace ru
d_demotecomtext = "Понизить Капитанов до обычных игроков",
d_appointcomtext = "Повысить двух игроков до Капитанов (они выбирают остальных игроков к себе в команду)",
d_specallcomtext = "Сделать всех игроков наблюдателями",
d_preventvoicelinespamtext = "Запретить игроку спамить войслайнами",

// Satchel.as
d_satcheldesc = "Поджигает горючие блоки, активируется при помощи клавиши броска",
Expand Down

0 comments on commit 663c14d

Please sign in to comment.