This commit is contained in:
Jackz 2023-01-04 22:02:27 -06:00
parent 207c1f6314
commit 078b7c4bf6
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
28 changed files with 1101 additions and 140 deletions

View file

@ -4,7 +4,7 @@
//Allow MAX_TROLLS to be defined elsewhere
#if defined MAX_TROLLS
#else
#define MAX_TROLLS 48
#define MAX_TROLLS 49
#endif
enum trollModifier {

View file

@ -202,7 +202,7 @@ public Action Command_ResetUser(int client, int args) {
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_CONNECTED, /* Only allow alive players */
COMMAND_FILTER_CONNECTED | COMMAND_FILTER_NO_IMMUNITY, /* Only allow alive players */
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
@ -241,7 +241,7 @@ public Action Command_ApplyUser(int client, int args) {
client,
target_list,
1,
COMMAND_FILTER_NO_MULTI,
COMMAND_FILTER_NO_MULTI | COMMAND_FILTER_NO_IMMUNITY,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
@ -556,15 +556,15 @@ public Action Command_Stagger(int client, int args) {
static char arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
int target_list[1], target_count;
int target_list[MAXPLAYERS], target_count;
static char target_name[MAX_TARGET_LENGTH];
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
1,
COMMAND_FILTER_ALIVE | COMMAND_FILTER_NO_MULTI,
MaxClients,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
@ -574,7 +574,9 @@ public Action Command_Stagger(int client, int args) {
return Plugin_Handled;
}
L4D_StaggerPlayer(target_list[0], target_list[0], NULL_VECTOR);
for(int i = 0; i < target_count; i++) {
L4D_StaggerPlayer(target_list[i], target_list[i], NULL_VECTOR);
}
} else {
ReplyToCommand(client, "syntax: sm_stagger <target player>");
}
@ -635,7 +637,7 @@ public Action Command_HealTarget(int client, int args) {
client,
target_list,
1,
COMMAND_FILTER_ALIVE | COMMAND_FILTER_NO_MULTI,
COMMAND_FILTER_ALIVE | COMMAND_FILTER_NO_MULTI | COMMAND_FILTER_NO_IMMUNITY,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0

View file

@ -360,8 +360,10 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
static int honkID;
static int profanityID;
static int typooId;
if(honkID == 0) honkID = GetTrollID("Honk / Meow / Woof");
if(profanityID == 0) profanityID = GetTrollID("No Profanity");
if(typooId == 0) typooId = GetTrollID("Typoos");
if(Trolls[honkID].IsActive(client) && Trolls[honkID].activeFlagClients[client] & 1) {
// Honk Processing
@ -523,6 +525,23 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
// Print original in console no matter what
PrintToServer("%N: %s", client, sArgs);
return Plugin_Handled;
} else if(Trolls[typooId].IsActive(client)) {
char strings[32][MAX_TYPOS_LENGTH];
int words = ExplodeString(sArgs, " ", strings, 32, MAX_TYPOS_LENGTH);
// Replace all typos
static char typoReplacement[32];
for(int i = 0; i < words; i++) {
if(TYPOS_DICT.GetString(strings[i], typoReplacement, sizeof(typoReplacement))) {
strcopy(strings[i], MAX_TYPOS_LENGTH, typoReplacement);
}
}
int length = MAX_TYPOS_LENGTH * words;
char[] message = new char[length];
ImplodeStrings(strings, 32, " ", message, length);
CPrintToChatAll("{blue}%N {default}: %s", client, message);
PrintToServer("%N: %s", client, sArgs);
return Plugin_Handled;
}
return Plugin_Continue;
}

View file

@ -79,11 +79,38 @@ stock bool IsPlayerIncapped(int client) {
return GetEntProp(client, Prop_Send, "m_isIncapacitated") == 1;
}
#define MAX_TYPOS_LENGTH 16
StringMap TYPOS_DICT;
void LoadTypos() {
TYPOS_DICT.Clear();
char sPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sPath, sizeof(sPath), "data/ftt_typos.txt");
if(!FileExists(sPath)) {
PrintToServer("[FTT] Missing typos list: data/ftt_typos.txt");
return;
}
File file = OpenFile(sPath, "r", false, NULL_STRING);
if(file == null) {
PrintToServer("[FTT] Cannot open: data/ftt_typos.txt");
return;
}
char buffer[140], key[32];
while(file.ReadLine(buffer, sizeof(buffer))) {
int index = SplitString(buffer, " ", key, sizeof(key));
TYPOS_DICT.SetString(key, buffer[index]);
}
file.Close();
}
#define MAX_PHRASES_PER_WORD 8
#define MAX_PHRASE_LENGTH 191
StringMap REPLACEMENT_PHRASES;
ArrayList fullMessagePhraseList;
/* Example:
exWord
{

View file

@ -110,6 +110,7 @@ void SetupTrolls() {
/// CATEGORY: Chat
SetCategory("Chat");
SetupTroll("Typoos", "", TrollMod_Constant);
SetupTroll("iCantSpellNoMore", "Chat messages letter will randomly changed with wrong letters", TrollMod_Constant);
index = SetupTroll("No Profanity", "Replaces some words with random phrases", TrollMod_Constant);
Trolls[index].AddFlagPrompt(false);