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);

View file

@ -101,6 +101,7 @@ float fAntiRushFrequencyCounter[MAXPLAYERS+1];
#define MODEL_CAR "models/props_vehicles/cara_95sedan.mdl"
#include <feedthetrolls/base>
#include <feedthetrolls/trolls>
#include <feedthetrolls/combos>

File diff suppressed because it is too large Load diff

View file

@ -245,6 +245,41 @@ stock int L4D_EntityParent(int entity)
return GetEntPropEnt(entity, Prop_Data, "m_pParent");
}
/**
* @brief Checks if a player is using any mounted weapon (minigun or 50cal)
*
* @param client Client to check
*
* @return true if using a mounted weapon, false otherwise
*/
stock bool IsUsingMinigun(int client)
{
return ((GetEntProp(client, Prop_Send, "m_usingMountedWeapon") > 0) || (GetEntProp(client, Prop_Send, L4D_IsEngineLeft4Dead2() ? "m_usingMountedGun" : "m_usingMinigun") > 0));
}
/**
* @brief Stops a client using a mounted weapon
*
* @param client Entity index to check
*
* @return entity index or -1 if none
*/
stock void StopUsingMinigun(int client)
{
if( IsUsingMinigun(client) )
{
int entity = GetEntPropEnt(client, Prop_Send, "m_hUseEntity");
if( entity > 0 && entity < 2048 )
{
SetEntPropEnt(entity, Prop_Send, "m_owner", -1);
}
SetEntProp(client, Prop_Send, L4D_IsEngineLeft4Dead2() ? "m_usingMountedGun" : "m_usingMinigun", 0);
SetEntProp(client, Prop_Send, "m_usingMountedWeapon", 0);
SetEntPropEnt(client, Prop_Send, "m_hUseEntity", -1);
}
}
// ==================================================
@ -675,6 +710,75 @@ stock bool L4D_HasReachedSmoker(int client)
// ==================================================
// CHARGER STOCKS - Written by "Forgetest"
// ==================================================
/**
* @brief Internally used to get offset to the start of queued pummel field.
*
* @return Offset into CTerrorPlayer to the start of queued pummel props
*/
static int L4D2_OffsQueuedPummelInfo()
{
static int m_hQueuedPummelVictim = -1;
if ( m_hQueuedPummelVictim == -1 )
m_hQueuedPummelVictim = FindSendPropInfo("CTerrorPlayer", "m_pummelAttacker") + 4;
return m_hQueuedPummelVictim;
}
/**
* @brief Returns the timestamp when the queued pummel begins.
*
* @param client Client ID of the player to check
*
* @return timestamp or -1.0 if no queued pummel
*/
stock float L4D2_GetQueuedPummelStartTime(int client)
{
return GetEntDataFloat(client, L4D2_OffsQueuedPummelInfo() + 4);
}
/**
* @brief Returns if a Charger is in a queued pummel.
*
* @param client Client ID of the player to check
*
* @return true if in queued pummel, false otherwise
*/
stock bool L4D2_IsInQueuedPummel(int client)
{
float flTimestamp = L4D2_GetQueuedPummelStartTime(client);
return flTimestamp != -1.0 && flTimestamp > GetGameTime();
}
/**
* @brief Returns the victim when a Charger is in a queued pummel.
*
* @param client Client ID of the player to check
*
* @return client index or -1 if none
*/
stock int L4D2_GetQueuedPummelVictim(int client)
{
return GetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo());
}
/**
* @brief Returns the attacker when a Survivor is in a queued pummel.
*
* @param client Client ID of the player to check
*
* @return client index or -1 if none
*/
stock int L4D2_GetQueuedPummelAttacker(int client)
{
return GetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo() + 8);
}
// ==================================================
// LEDGE HANG STOCKS
// ==================================================
@ -885,7 +989,7 @@ stock void L4D_StopReviveAction(int client)
owner_save = owner;
}
if( target != -1 )
if( target > 0 && target <= MaxClients )
{
SetEntPropEnt(target, Prop_Send, "m_useActionOwner", -1);
SetEntPropEnt(target, Prop_Send, "m_useActionTarget", -1);

View file

@ -4,26 +4,26 @@
* Syntax Update and merge into "Left 4 DHooks Direct" (C) 2022 "SilverShot"
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License, version 3.0, as
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License, version 3.0, as
* published by the Free Software Foundation.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* 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
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2,"
* the "Source Engine," the "SourcePawn JIT," and any Game MODs that run on
* the "Source Engine," the "SourcePawn JIT," and any Game MODs that run on
* software by the Valve Corporation. You must obey the GNU General Public
* License in all respects for all other code used. Additionally,
* AlliedModders LLC grants this exception to all derivative works.
* AlliedModders LLC defines further exceptions, found in LICENSE.txt
* (as of this writing, version JULY-31-2007), or
* License in all respects for all other code used. Additionally,
* AlliedModders LLC grants this exception to all derivative works.
* AlliedModders LLC defines further exceptions, found in LICENSE.txt
* (as of this writing, version JULY-31-2007), or
* <http://www.sourcemod.net/license.php>.
*/