This commit is contained in:
Jackzie 2022-01-19 14:52:52 -06:00
parent 755c2f24f9
commit 3c88c010ad
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
17 changed files with 503 additions and 232 deletions

View file

@ -4,7 +4,7 @@
//Allow MAX_TROLLS to be defined elsewhere
#if defined MAX_TROLLS
#else
#define MAX_TROLLS 33
#define MAX_TROLLS 34
#endif
enum trollModifier {
@ -224,7 +224,7 @@ void ResetClient(int victim, bool wipe = true) {
Trolls[i].activeFlagClients[victim] = -1;
}
}
BaseComm_SetClientMute(victim, false);
SetEntityGravity(victim, 1.0);
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
SDKUnhook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);

View file

@ -213,9 +213,11 @@ public Action Command_ResetUser(int client, int args) {
}
for (int i = 0; i < target_count; i++) {
if(IsAnyTrollActive(target_list[i])) {
LogAction(client, target_list[i], "\"%L\" reset all troll effects for \"%L\"", client, target_list[i]);
ShowActivityEx(client, "[FTT] ", "reset troll effects for \"%N\". ", target_list[i]);
}
ResetClient(target_list[i], true);
LogAction(client, target_list[i], "\"%L\" reset all troll effects for \"%L\"", client, target_list[i]);
ShowActivityEx(client, "[FTT] ", "reset troll effects for \"%N\". ", target_list[i]);
}
}
return Plugin_Handled;
@ -494,38 +496,6 @@ public Action Command_MarkPendingTroll(int client, int args) {
return Plugin_Handled;
}
public Action Command_MarkNoob(int client, int args) {
if(args == 0) {
ReplyToCommand(client, "sm_noob <player>");
return Plugin_Handled;
}
static char target_name[MAX_TARGET_LENGTH];
GetCmdArg(1, target_name, sizeof(target_name));
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
target_name,
client,
target_list,
1,
COMMAND_FILTER_NO_MULTI, /* Only allow alive players */
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
) {
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int target = target_list[0];
//Todo: Check if marked as noob or not, undo if so, add if not
ShowActivityEx(client, "[FTT] ", "marked %N as a noob", target_name);
LogAction(client, target, "\"%L\" marked \"%L\" as a noob", client, target);
return Plugin_Handled;
}
public Action Command_FeedTheTrollMenu(int client, int args) {
ReplyToCommand(client, "sm_ftl [player(s)] - Lists all the active trolls on players. Will show flag names if a player is specified.");
ReplyToCommand(client, "sm_ftm - Lists all available trolls & descriptions");
@ -536,3 +506,47 @@ public Action Command_FeedTheTrollMenu(int client, int args) {
ReplyToCommand(client, "sm_mark - Marks the user to be banned on disconnect, prevents their FF.");
return Plugin_Handled;
}
public Action Command_BotsAttack(int client, int args) {
if(args > 0) {
static char arg1[32], arg2[4];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
int targetHP;
if(StringToIntEx(arg2, targetHP) == 0 || targetHP < 0 || targetHP > 100) {
ReplyToCommand(client, "Invalid target HP value. Must be between 0 and 100");
return Plugin_Handled;
}
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,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
) {
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int target = target_list[0];
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && IsFakeClient(i) && GetClientTeam(i) == 2) {
if(!SetBotTarget(target, i, targetHP, 80)) {
ReplyToCommand(client, "%N could not target %s", i, target_name);
}
}
}
ShowActivity(client, "set all bots to attack %s", target_name);
} else {
ReplyToCommand(client, "syntax: sm_bots_attack <target player> [target-hp]");
}
return Plugin_Handled;
}

View file

@ -5,6 +5,7 @@ public void OnMapEnd() {
UnhookEntityOutput("func_button", "OnPressed", Event_ButtonPress);
}
public void OnMapStart() {
if(hBotReverseFFDefend.IntValue > 0) hSbFriendlyFire.BoolValue = true;
AddFileToDownloadsTable("sound/custom/meow1.mp3");
PrecacheSound("custom/meow1.mp3");
@ -18,6 +19,9 @@ public void OnMapStart() {
}
public void OnClientPutInServer(int client) {
g_PendingBanTroll[client] = 0;
shootAtTarget[client] = 0;
if(IsTrollActive(client, "Voice Mute"))
BaseComm_SetClientMute(client, true);
SDKHook(client, SDKHook_OnTakeDamage, Event_TakeDamage);
}
public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) {
@ -35,13 +39,14 @@ public Action Timer_CheckSpecial(Handle h, int specialID) {
TeleportEntity(special, gInstaSpecialSpawnPos, gInstaSpecialSpawnAng, NULL_VECTOR);
if(gInstaSpecialInstaKill) {
SDKHooks_TakeDamage(special, gInstaSpecialTarget, gInstaSpecialTarget, 1000.0);
RequestFrame(Frame_Boom, special);
}
}
}
}
public void Frame_InstaSpawned(int special) {
public void Frame_Boom(int special) {
SDKHooks_TakeDamage(special, special, special, 1000.0);
gInstaSpecialInstaKill = false;
}
public void Event_PlayerFirstSpawn(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
@ -63,6 +68,9 @@ public void Event_PlayerDisconnect(Event event, const char[] name, bool dontBroa
}
steamids[client][0] = '\0';
g_iAttackerTarget[client] = 0;
shootAtTarget[client] = 0;
shootAtTargetLoops[client] = 0;
shootAtTargetHP[client] = 0;
}
public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
@ -70,7 +78,7 @@ public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadca
int target = GetClientOfUserId(g_iAttackerTarget[client]);
gInstaSpecialMagnet[target]--;
if(gInstaSpecialMagnet[target] == 0) {
PrintToServer("[FTT] gInstaSpecialMagnet droped below 0");
PrintToServer("[FTT] gInstaSpecialMagnet dropped below 0");
gInstaSpecialMagnet[target] = 0;
}
}
@ -113,15 +121,13 @@ public void RushPlayer(int user) {
L4D2_RunScript("RushVictim(GetPlayerFromUserID(%d), %d)", user, 15000);
}
public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
// =========================
// OVERRIDE VICTIM
// =========================
static int spMagnetID, tankMagnetID;
if(spMagnetID == 0) spMagnetID = GetTrollID("Special Magnet");
if(tankMagnetID == 0) tankMagnetID = GetTrollID("Tank Magnet");
if(hMagnetChance.FloatValue < GetRandomFloat()) return Plugin_Continue;
L4D2Infected class = view_as<L4D2Infected>(GetEntProp(attacker, Prop_Send, "m_zombieClass"));
// Check for any existing victims
int existingTarget = GetClientOfUserId(g_iAttackerTarget[attacker]);
if(existingTarget > 0 && IsPlayerAlive(existingTarget)) {
if(gInstaSpecialMagnet[existingTarget] > 0) {
@ -136,21 +142,24 @@ public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
}
}
// If no existing target, find closest valid victim
float closestDistance, survPos[3], spPos[3];
GetClientAbsOrigin(attacker, spPos);
int closestClient = -1;
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i)) {
//Ignore incapped players if turned on:
if(IsPlayerIncapped(i)) {
if((class == L4D2Infected_Tank && hMagnetTargetMode.IntValue & 2) || (class != L4D2Infected_Tank && hMagnetTargetMode.IntValue & 1)) continue;
}
if(class == L4D2Infected_Tank && Trolls[tankMagnetID].IsActive(i) || (class != L4D2Infected_Tank && Trolls[spMagnetID].IsActive(i))) {
if(class == L4D2Infected_Tank) {
if(!WillMagnetRun(Trolls[tankMagnetID], i)) return Plugin_Continue;
} else if(!WillMagnetRun(Trolls[spMagnetID], i)) return Plugin_Continue;
if(IsPlayerIncapped(i)) {
if((class == L4D2Infected_Tank && hMagnetTargetMode.IntValue & 2) || (class != L4D2Infected_Tank && hMagnetTargetMode.IntValue & 1)) continue;
}
GetClientAbsOrigin(i, survPos);
float dist = GetVectorDistance(survPos, spPos, true);
if(closestClient == -1 || dist < closestDistance) {
@ -160,7 +169,7 @@ public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
}
}
}
// If found, set, else just let game decide
if(closestClient > 0) {
g_iAttackerTarget[attacker] = GetClientUserId(closestClient);
curTarget = closestClient;
@ -179,20 +188,24 @@ bool WillMagnetRun(const Troll troll, int i) {
cChance = 0.1;
return GetRandomFloat() <= cChance;
}
public Action L4D2_OnEntityShoved(int client, int entity, int weapon, float vecDir[3], bool bIsHighPounce) {
if(client > 0 && client <= MaxClients && IsTrollActive(client, "No Shove") && hShoveFailChance.FloatValue > GetRandomFloat()) {
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs) {
if(sArgs[0] == '@') return Plugin_Continue;
if(sArgs[0] == '@') return Plugin_Continue; //Ignore admin chat
static int honkID;
static int profanityID;
if(honkID == 0) honkID = GetTrollID("Honk / Meow");
if(profanityID == 0) profanityID = GetTrollID("No Profanity");
if(Trolls[honkID].IsActive(client) && Trolls[honkID].activeFlagClients[client] & 1) {
// Honk Processing
static char strings[32][7];
int words = ExplodeString(sArgs, " ", strings, sizeof(strings), 5);
for(int i = 0; i < words; i++) {
@ -308,8 +321,8 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
CPrintToChatAll("{blue}%N {default}: %s", client, newMessage);
return Plugin_Handled;
}else if(Trolls[profanityID].IsActive(client)) {
static char strings[32][MAX_PHRASE_LENGTH];
ArrayList phrases;
char strings[32][MAX_PHRASE_LENGTH];
static ArrayList phrases;
bool foundWord = false;
int words = ExplodeString(sArgs, " ", strings, 32, MAX_PHRASE_LENGTH);
// Replace all swear words
@ -324,14 +337,17 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
char[] message = new char[length];
if(foundWord) {
// Found at least one word, keep modified intact
ImplodeStrings(strings, 32, " ", message, length);
} else if(Trolls[profanityID].activeFlagClients[client] & 2) { //Replace full messages if flag enabled
} else if(Trolls[profanityID].activeFlagClients[client] & 2) {
// Replace full message content if flag enabled
if(!fullMessagePhraseList) {
PrintToServer("[FTT] Error: Could not find full message phrases!!!");
return Plugin_Continue;
}
fullMessagePhraseList.GetString(GetRandomInt(0, fullMessagePhraseList.Length - 1), message, MAX_PHRASE_LENGTH);
} else {
// Flag off, keep original text
return Plugin_Continue;
}
@ -351,6 +367,8 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
}
return Plugin_Continue;
}
static char SMG[8] = "smg";
static char AWP[16] = "sniper_awp";
public Action Event_ItemPickup(int client, int weapon) {
if(IsTrollActive(client, "No Pickup")) {
@ -358,38 +376,45 @@ public Action Event_ItemPickup(int client, int weapon) {
}else{
static char wpnName[64];
GetEdictClassname(weapon, wpnName, sizeof(wpnName));
if(StrContains(wpnName, "rifle") > -1
|| StrContains(wpnName, "smg") > -1
|| StrContains(wpnName, "weapon_grenade_launcher") > -1
|| StrContains(wpnName, "sniper") > -1
if(strcmp(wpnName[7], "rifle") >= 0
|| strcmp(wpnName[7], "smg") >= 0
|| StrEqual(wpnName[7], "grenade_launcher")
|| strcmp(wpnName[7], "sniper") > -1
|| StrContains(wpnName, "shotgun") > -1
) {
static int UziRulesIndex;
if(UziRulesIndex == 0) UziRulesIndex = GetTrollID("UziRules / AwpSmells");
//If 4: Only UZI, if 5: Can't switch.
if(IsTrollActive(client, "UziRules")) {
if(Trolls[UziRulesIndex].IsActive(client)) {
static char comp[16];
if(Trolls[UziRulesIndex].activeFlagClients[client] & 1)
strcopy(comp, sizeof(comp), SMG);
else
strcopy(comp, sizeof(comp), AWP);
static char currentWpn[32];
GetClientWeaponName(client, 0, currentWpn, sizeof(currentWpn));
if(StrEqual(wpnName, "weapon_smg", true)) {
if(StrEqual(wpnName[7], comp)) {
return Plugin_Continue;
} else if(StrEqual(currentWpn, "weapon_smg", true)) {
} else if(StrEqual(currentWpn[7], comp)) {
return Plugin_Stop;
}else{
} else {
int flags = GetCommandFlags("give");
SetCommandFlags("give", flags & ~FCVAR_CHEAT);
FakeClientCommand(client, "give smg");
FakeClientCommand(client, "give %s", comp);
SetCommandFlags("give", flags);
return Plugin_Stop;
}
}else if(IsTrollActive(client, "Primary Disable")) {
} else if(IsTrollActive(client, "Primary Disable")) {
return Plugin_Stop;
}
return Plugin_Continue;
}else{
return Plugin_Continue;
}
return Plugin_Continue;
}
}
public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3], float angles[3], int& weapon, int& subtype, int& cmdnum, int& tickcount, int& seed, int mouse[2]) {
// If 'KillMeSoftly' activated:
if(g_bPendingItemGive[client] && !(buttons & IN_ATTACK2)) {
int target = GetClientAimTarget(client, true);
if(target > -1) {
@ -399,6 +424,24 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
}
return Plugin_Continue;
}
if (shootAtTarget[client] > 0 && (buttons & IN_ATTACK) == 0) {
// If so, block their crouching (+duck)
if(GetClientAimTarget(client, true) == shootAtTarget[client]) {
if(!IsActorBusy(client))
PerformScene(client, "PlayerLaugh");
buttons |= IN_ATTACK;
return Plugin_Changed;
} else {
if(!IsClientConnected(shootAtTarget[client])) {
shootAtTarget[client] = 0;
} else {
LookAtClient(client, shootAtTarget[client]);
}
}
}
// Inverted control code:
static int invertedTrollIndex;
if(invertedTrollIndex == 0) invertedTrollIndex = GetTrollID("Inverted Controls");
if(Trolls[invertedTrollIndex].IsActive(client)) {
@ -432,7 +475,9 @@ public Action Event_TakeDamage(int victim, int& attacker, int& inflictor, float&
//Stop FF from marked:
static int reverseFF;
if(reverseFF == 0) reverseFF = GetTrollID("Reverse FF");
if(attacker > 0 && attacker <= MaxClients && IsClientInGame(attacker) && IsPlayerAlive(attacker)) {
if(GetClientTeam(attacker) == 4 && IsFakeClient(attacker)) return Plugin_Stop;
if(attacker > 0 && victim <= MaxClients && attacker <= MaxClients && IsClientInGame(attacker) && IsPlayerAlive(attacker)) {
if(shootAtTarget[attacker] == victim) return Plugin_Continue;
if(g_PendingBanTroll[attacker] > 0 && GetClientTeam(attacker) == 2 && GetClientTeam(victim) == 2) {
return Plugin_Stop;
}
@ -455,15 +500,33 @@ public Action Event_TakeDamage(int victim, int& attacker, int& inflictor, float&
damage = 0.0;
return Plugin_Changed;
}
if(damagetype & DMG_BURN || damagetype & DMG_BLAST) return Plugin_Continue;
if(hBotReverseFFDefend.IntValue > 0 && IsFakeClient(attacker) && shootAtTarget[attacker] == 0 && GetClientTeam(attacker) == 2 && GetClientTeam(victim) == 2) return Plugin_Stop;
if(attacker != victim && hBotReverseFFDefend.IntValue > 0 && hBotReverseFFDefend.IntValue == 2 || GetUserAdmin(attacker) == INVALID_ADMIN_ID) {
if(IsFakeClient(victim) && !IsFakeClient(attacker) && GetClientTeam(attacker) == 2 && GetClientTeam(victim) == 2) {
if(shootAtTarget[victim] == attacker) {
shootAtTargetHP[attacker] -= RoundFloat(damage);
shootAtTargetLoops[victim] += 4;
return Plugin_Continue;
} else if(shootAtTarget[victim] > 0) {
// Don't switch, wait for timer to stop
return Plugin_Continue;
}
SetBotTarget(attacker, victim, GetClientRealHealth(attacker) - RoundFloat(damage));
}
}
}
return Plugin_Continue;
}
public Action SoundHook(int[] clients, int& numClients, char sample[PLATFORM_MAX_PATH], int& entity, int& channel, float& volume, int& level, int& pitch, int& flags, char[] soundEntry, int& seed) {
static int honkID;
if(honkID == 0) honkID = GetTrollID("Honk / Meow");
static int vocalGagID;
if(honkID == 0) honkID = GetTrollID("Honk / Meow");
if(vocalGagID == 0) vocalGagID = GetTrollID("Vocalize Gag");
if(lastButtonUser > -1 && StrEqual(sample, "npc/mega_mob/mega_mob_incoming.wav")) {
PrintToConsoleAll("CRESCENDO STARTED BY %N", lastButtonUser);
#if defined DEBUG
@ -500,10 +563,14 @@ public Action SoundHook(int[] clients, int& numClients, char sample[PLATFORM_MAX
}
public Action Event_WitchVictimSet(Event event, const char[] name, bool dontBroadcast) {
static int witchTrollID;
if(witchTrollID == 0) witchTrollID = GetTrollID("Witch Magnet");
int witch = event.GetInt("witchid");
float closestDistance, survPos[3], witchPos[3];
GetEntPropVector(witch, Prop_Send, "m_vecOrigin", witchPos);
int closestClient = -1;
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i)) {
//Ignore incapped players if hWitchIgnoreIncapp turned on:
@ -511,7 +578,7 @@ public Action Event_WitchVictimSet(Event event, const char[] name, bool dontBroa
continue;
}
if(IsTrollActive(i, "Witch Magnet")) {
if(Trolls[witchTrollID].IsActive(i)) {
GetClientAbsOrigin(i, survPos);
float dist = GetVectorDistance(survPos, witchPos, true);
if(closestClient == -1 || dist < closestDistance) {
@ -538,6 +605,7 @@ public void OnEntityCreated(int entity, const char[] classname) {
RequestFrame(EntityCreateCallback, entity);
}
}
void EntityCreateCallback(int entity) {
if(!HasEntProp(entity, Prop_Send, "m_hOwnerEntity") || !IsValidEntity(entity)) return;
static char class[16];
@ -584,7 +652,6 @@ void EntityCreateCallback(int entity) {
}
}
//Dull Melee
public Action L4D2_MeleeGetDamageForVictim(int client, int weapon, int victim, float &damage) {
static int dullMeleeID;
if(!dullMeleeID) dullMeleeID = GetTrollID("Dull Melee");
@ -610,4 +677,4 @@ int FindClosestVisibleClient(int source) {
public bool TraceEntityFilterPlayer(int entity, int mask, any data) {
return data != entity && entity <= MaxClients && GetClientTeam(entity) == 2 && IsPlayerAlive(entity);
}
}

View file

@ -248,4 +248,123 @@ void DropItem(int victim, int slot) {
if(slot != 1 || DoesClientHaveMelee(victim)) {
SDKHooks_DropWeapon(victim, wpn, NULL_VECTOR);
}
}
stock void AddInFrontOf(float fVecOrigin[3], float fVecAngle[3], float fUnits, float fOutPut[3])
{
float fVecView[3]; GetViewVector(fVecAngle, fVecView);
fOutPut[0] = fVecView[0] * fUnits + fVecOrigin[0];
fOutPut[1] = fVecView[1] * fUnits + fVecOrigin[1];
fOutPut[2] = fVecView[2] * fUnits + fVecOrigin[2];
}
stock void GetViewVector(float fVecAngle[3], float fOutPut[3])
{
fOutPut[0] = Cosine(fVecAngle[1] / (180 / FLOAT_PI));
fOutPut[1] = Sine(fVecAngle[1] / (180 / FLOAT_PI));
fOutPut[2] = -Sine(fVecAngle[0] / (180 / FLOAT_PI));
}
stock void LookAtClient(int iClient, int iTarget) {
static float fTargetPos[3];
static float fTargetAngles[3];
static float fClientPos[3];
static float fFinalPos[3];
GetClientEyePosition(iClient, fClientPos);
GetClientEyePosition(iTarget, fTargetPos);
GetClientEyeAngles(iTarget, fTargetAngles);
float fVecFinal[3];
AddInFrontOf(fTargetPos, fTargetAngles, 7.0, fVecFinal);
MakeVectorFromPoints(fClientPos, fVecFinal, fFinalPos);
GetVectorAngles(fFinalPos, fFinalPos);
TeleportEntity(iClient, NULL_VECTOR, fFinalPos, NULL_VECTOR);
}
stock int GetClientRealHealth(int client) {
//First filter -> Must be a valid client, successfully in-game and not an spectator (The dont have health).
if(!client
|| !IsValidEntity(client)
|| !IsClientInGame(client)
|| !IsPlayerAlive(client)
|| IsClientObserver(client))
{
return -1;
}
//If the client is not on the survivors team, then just return the normal client health.
if(GetClientTeam(client) != 2)
{
return GetClientHealth(client);
}
//First, we get the amount of temporal health the client has
float buffer = GetEntPropFloat(client, Prop_Send, "m_healthBuffer");
//We declare the permanent and temporal health variables
float TempHealth;
int PermHealth = GetClientHealth(client);
//In case the buffer is 0 or less, we set the temporal health as 0, because the client has not used any pills or adrenaline yet
if(buffer <= 0.0)
{
TempHealth = 0.0;
}
//In case it is higher than 0, we proceed to calculate the temporl health
else
{
//This is the difference between the time we used the temporal item, and the current time
float difference = GetGameTime() - GetEntPropFloat(client, Prop_Send, "m_healthBufferTime");
//We get the decay rate from this convar (Note: Adrenaline uses this value)
float decay = GetConVarFloat(FindConVar("pain_pills_decay_rate"));
//This is a constant we create to determine the amount of health. This is the amount of time it has to pass
//before 1 Temporal HP is consumed.
float constant = 1.0/decay;
//Then we do the calcs
TempHealth = buffer - (difference / constant);
}
//If the temporal health resulted less than 0, then it is just 0.
if(TempHealth < 0.0)
{
TempHealth = 0.0;
}
//Return the value
return RoundToFloor(PermHealth + TempHealth);
}
/// Returns TRUE if set, FALSE if not (if no weapon to shoot)
bool SetBotTarget(int bot, int target, int targetHP, int loops = 15) {
if(shootAtTarget[target] == bot) {
return false;
} else if(shootAtTarget[target] > 0) {
return false;
}
LookAtClient(target, bot);
int weapon = GetPlayerWeaponSlot(target, 0);
if(weapon > -1) {
shootAtTarget[target] = bot;
shootAtTargetLoops[target] = loops;
shootAtTargetHP[bot] = targetHP;
int ammo = GetEntProp(weapon, Prop_Send, "m_iClip1");
DataPack pack = new DataPack();
// Reverse target and bot:
pack.WriteCell(target);
pack.WriteCell(bot);
pack.WriteCell(weapon);
pack.WriteCell(ammo);
CreateTimer(0.1, Timer_ShootReverse, pack, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
return true;
} else {
return false;
}
}

View file

@ -107,4 +107,33 @@ public Action Timer_InstaFailed(Handle h) {
gInstaSpecialType = -1;
gInstaSpecialTarget = 0;
}
}
public Action Timer_ShootReverse(Handle h, DataPack pack) {
pack.Reset();
int attacker = pack.ReadCell();
int target = pack.ReadCell();
int weapon = pack.ReadCell();
int ammo = pack.ReadCell();
if(!IsClientConnected(target) || !IsClientConnected(attacker) || attacker > MaxClients || target > MaxClients) return Plugin_Stop;
static float targetPos[3], botAngles[3], botPosition[3];
GetClientAbsOrigin(attacker, targetPos);
GetClientAbsAngles(attacker, botAngles);
GetClientAbsOrigin(attacker, botPosition);
botAngles[1] = RadToDeg(ArcTangent2( botPosition[1] - targetPos[1], botPosition[0] - targetPos[0])) + 180.0;
TeleportEntity(attacker, NULL_VECTOR, botAngles, NULL_VECTOR);
shootAtTargetLoops[attacker]--;
if(IsValidEntity(weapon))
SetEntProp(weapon, Prop_Send, "m_iClip1", ammo);
if(shootAtTargetLoops[attacker] > 0 && GetClientRealHealth(target) > shootAtTargetHP[target]) {
return Plugin_Continue;
} else {
shootAtTargetLoops[attacker] = 0;
shootAtTarget[attacker] = 0;
shootAtTargetHP[target] = 0;
return Plugin_Stop;
}
}

View file

@ -27,13 +27,16 @@ void SetupTrolls() {
// Trolls[index].AddFlag("Throw to Admin", true);
// Trolls[index].AddFlag("Drop At Feet", false);
// Trolls[index].AddFlag("Drop At Admin", false);
index = SetupTroll("Bad Throw", "Player drops throwables on throw, and biles/molotovs themselves", TrollMod_Constant | TrollMod_PlayerOnly);
index = SetupTroll("Bad Throw", "Player drops throwables on throw, and biles/molotovs themselves", TrollMod_Constant);
Trolls[index].AddFlagPrompt(true);
Trolls[index].AddFlag("Biles", true);
Trolls[index].AddFlag("Molotovs", true);
Trolls[index].AddFlag("Pipebombs", true);
SetupTroll("No Pickup", "Prevents a player from picking up ANY (new) item. Use ThrowItAll to make them drop", TrollMod_Constant);
SetupTroll("UziRules", "Picking up a weapon gives them a UZI instead", TrollMod_Constant);
index = SetupTroll("UziRules / AwpSmells", "Picking up a weapon gives them a UZI or AWP instead", TrollMod_Constant);
Trolls[index].AddFlagPrompt(false);
Trolls[index].AddFlag("UZI Only", true);
Trolls[index].AddFlag("AWP Only", false);
SetupTroll("Primary Disable", "Player cannot pickup any weapons, only melee/pistols", TrollMod_Constant);
index = SetupTroll("Dull Melee", "Player's melee weapon does 0 damage (based on %). Headshots still work", TrollMod_Constant);
Trolls[index].AddFlagPrompt(false);
@ -44,7 +47,7 @@ void SetupTrolls() {
SetCategory("Chat");
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 | TrollMod_PlayerOnly);
index = SetupTroll("No Profanity", "Replaces some words with random phrases", TrollMod_Constant);
Trolls[index].AddFlagPrompt(false);
Trolls[index].AddFlag("Only Replace Swears", false);
Trolls[index].AddFlag("Replace Full Messages", true);
@ -63,7 +66,8 @@ void SetupTrolls() {
Trolls[index].AddFlag("Show Modified to Them", true);
Trolls[index].AddFlag("Show Original to Them", false);
Trolls[index].AddFlag("Show Modified Only To Them", false);
SetupTroll("Reversed", "Reserves their message", TrollMod_Constant | TrollMod_PlayerOnly);
SetupTroll("Reversed", "Reserves their message", TrollMod_Constant);
SetupTroll("Voice Mute", "Mutes from voice", TrollMod_Constant);
SetCategory("Health");
SetupTroll("Damage Boost", "Makes a player take more damage than normal", TrollMod_Constant);
@ -83,16 +87,16 @@ void SetupTrolls() {
SetupTroll("Slow Speed", "Sets player speed to 0.8x of normal speed", TrollMod_Constant);
SetupTroll("Higher Gravity", "Sets player gravity to 1.3x of normal gravity", TrollMod_Constant);
SetupTroll("No Shove", "Prevents a player from shoving", TrollMod_Constant);
SetupTroll("CameTooEarly", "When they shoot, random chance they empty whole clip", TrollMod_Constant | TrollMod_PlayerOnly);
SetupTroll("Inverted Controls", "Well, aint it obvious", TrollMod_Constant | TrollMod_PlayerOnly);
SetupTroll("CameTooEarly", "When they shoot, random chance they empty whole clip", TrollMod_Constant);
SetupTroll("Inverted Controls", "Well, aint it obvious", TrollMod_Constant);
SetupTroll("Stagger", "Like a slap, but different", TrollMod_Instant);
index = SetupTroll("Meta: Inverse", "Uhm you are not supposed to see this...", TrollMod_Instant | TrollMod_PlayerOnly);
index = SetupTroll("Meta: Inverse", "Uhm you are not supposed to see this...", TrollMod_Instant);
Trolls[index].hidden = true;
Trolls[index].AddFlagPrompt(false);
Trolls[index].AddFlag("100%", true);
Trolls[index].AddFlag("50%", false);
Trolls[index].AddFlag("10%", false);
//INFO: UP MAX_TROLLS when adding new trolls!
// Initialize the default flag values to -1
@ -129,16 +133,16 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod
else if(StrEqual(troll.name, "Half Primary Ammo")) {
int current = GetPrimaryReserveAmmo(victim);
SetPrimaryReserveAmmo(victim, current / 2);
} else if(StrEqual(troll.name, "UziRules")) {
} else if(StrEqual(troll.name, "UziRules / AwpSmells")) {
DisableTroll(victim, "No Pickup");
DisableTroll(victim, "Primary Disable");
SDKHook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
} else if(StrEqual(troll.name, "Primary Disable")) {
DisableTroll(victim, "UziRules");
DisableTroll(victim, "UziRules / AwpSmells");
DisableTroll(victim, "No Pickup");
SDKHook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
} else if(StrEqual(troll.name, "No Pickup")) {
DisableTroll(victim, "UziRules");
DisableTroll(victim, "UziRules / AwpSmells");
DisableTroll(victim, "Primary Disable");
SDKHook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
} else if(StrEqual(troll.name, "CameTooEarly")) {
@ -189,6 +193,8 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod
L4D2_SpitterPrj(victim, pos, ang);
} else if(StrEqual(troll.name, "Stagger")) {
L4D_StaggerPlayer(victim, victim, NULL_VECTOR);
} else if(StrEqual(troll.name, "Voice Mute")) {
BaseComm_SetClientMute(victim, !isActive);
} else if(modifier != TrollMod_Constant) {
PrintToServer("[FTT] Warn: Possibly invalid troll, no apply action defined for \"%s\"", troll.name);
#if defined DEBUG

View file

@ -23,6 +23,9 @@ ConVar hShoveFailChance;
ConVar hAutoPunishExpire;
ConVar hMagnetTargetMode;
ConVar hBadThrowHitSelf;
ConVar hBotReverseFFDefend;
ConVar hSbFriendlyFire;
bool g_bPendingItemGive[MAXPLAYERS+1];
@ -43,6 +46,10 @@ int gInstaSpecialMagnet[MAXPLAYERS+1];
char steamids[MAXPLAYERS+1][64];
int shootAtTarget[MAXPLAYERS+1];
int shootAtTargetLoops[MAXPLAYERS+1];
int shootAtTargetHP[MAXPLAYERS+1];
#include <feedthetrolls/base>
#include <feedthetrolls/trolls>
#include <feedthetrolls/combos>
@ -52,3 +59,4 @@ char steamids[MAXPLAYERS+1][64];
#include <feedthetrolls/events>
#include <feedthetrolls/timers>
#include <feedthetrolls/menus>