mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 09:43:21 +00:00
FTT Re apply on idle resume
This commit is contained in:
parent
d1974f5504
commit
04670575be
6 changed files with 27 additions and 10 deletions
Binary file not shown.
|
@ -57,9 +57,10 @@ public Action Timer_CheckSpecial(Handle h, int specialID) {
|
|||
static char buf[32];
|
||||
GetClientName(special, buf, sizeof(buf));
|
||||
if(StrContains(buf, "bot", false) == -1) {
|
||||
if(spActiveRequest.targetUserId)
|
||||
if(spActiveRequest.targetUserId) {
|
||||
g_iAttackerTarget[special] = spActiveRequest.targetUserId;
|
||||
gInstaSpecialMagnet[GetClientOfUserId(spActiveRequest.targetUserId)]++;
|
||||
g_iSpecialAttackFlags[special] = spActiveRequest.flags;
|
||||
}
|
||||
|
||||
TeleportEntity(special, spActiveRequest.position, spActiveRequest.angle, NULL_VECTOR);
|
||||
if(spActiveRequest.flags & view_as<int>(SPI_KillOnSpawn)) {
|
||||
|
@ -114,6 +115,7 @@ public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadca
|
|||
int userid = event.GetInt("userid");
|
||||
int client = GetClientOfUserId(userid);
|
||||
if(client > 0) {
|
||||
g_iSpecialAttackFlags[client] = 0;
|
||||
if(g_iAttackerTarget[client] > 0) {
|
||||
// If special died, clear & subtract one from counter
|
||||
g_iAttackerTarget[client] = 0;
|
||||
|
@ -177,7 +179,7 @@ public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
|
|||
if(existingTarget > 0) {
|
||||
if(IsPlayerAlive(existingTarget)) {
|
||||
// Insta-specials ALWAYS target, if target has any attackers remaining
|
||||
if(gInstaSpecialMagnet[existingTarget] > 0) {
|
||||
if(g_iSpecialAttackFlags[attacker] & SPI_AlwaysTarget) {
|
||||
curTarget = existingTarget;
|
||||
return Plugin_Changed;
|
||||
}
|
||||
|
@ -230,6 +232,7 @@ public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
|
|||
}
|
||||
// If found, set, else just let game decide
|
||||
if(closestClient > 0) {
|
||||
PrintToConsoleAll("[FTT/Debug] infected %N -> attack -> %N", attacker, closetClient);
|
||||
g_iAttackerTarget[attacker] = GetClientUserId(closestClient);
|
||||
curTarget = closestClient;
|
||||
return Plugin_Changed;
|
||||
|
@ -521,8 +524,8 @@ 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");
|
||||
|
@ -792,7 +795,7 @@ public bool TraceEntityFilterPlayer(int entity, int mask, any data) {
|
|||
|
||||
float iLastAntiRushEvent[MAXPLAYERS+1];
|
||||
public Action OnAntiRush(int client, int &type, float distance) {
|
||||
if(type == 3 && IsPlayerAlive(client) && !IsPlayerIncapped(client)) {
|
||||
if(client && client <= MaxClients && type == 3 && IsPlayerAlive(client) && !IsPlayerIncapped(client)) {
|
||||
if(GetGameTime() - iLastAntiRushEvent[client] > 30.0) {
|
||||
SpecialType special = view_as<SpecialType>(GetRandomInt(1,6));
|
||||
iLastAntiRushEvent[client] = GetGameTime();
|
||||
|
@ -820,3 +823,15 @@ public void Event_EnteredSpit(Event event, const char[] name, bool dontBroadcast
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public void Event_BotPlayerSwap(Event event, const char[] name, bool dontBroadcast) {
|
||||
//Player replaced a bot
|
||||
int client = GetClientOfUserId(event.GetInt("player"));
|
||||
if(client) {
|
||||
for(int i = 1; i <= MAX_TROLLS; i++) {
|
||||
if(Trolls[i].IsActive(client) && Trolls[i].HasMod(TrollMod_Constant)) { //Add activeFlagClients >= 0 check possibly?
|
||||
ApplyAffect(client, Trolls[i], -1, TrollMod_Constant, Trolls[i].activeFlagClients[client]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ ArrayList g_spSpawnQueue;
|
|||
// target client index
|
||||
stock bool SpawnSpecialForTarget(SpecialType specialType, int target, SpecialSpawnFlags spawnFlags = Special_Anywhere) {
|
||||
static float pos[3];
|
||||
int internalFlags = 0;
|
||||
int internalFlags = view_as<int>(SPI_AlwaysTarget);
|
||||
if(spawnFlags == Special_OnTarget) {
|
||||
static float ang[3];
|
||||
static float testPos[3];
|
||||
|
|
|
@ -176,13 +176,13 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod
|
|||
SetEntityGravity(victim, 1.0);
|
||||
return false;
|
||||
} else if(StrEqual(troll.name, "Slow Speed")) {
|
||||
float movement = 1.0;
|
||||
if(isActive) {
|
||||
float movement = 1.0;
|
||||
if(flags & 1) movement = 0.6;
|
||||
else if(flags & 2) movement = 0.3;
|
||||
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", movement);
|
||||
} else
|
||||
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", movement);
|
||||
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
|
||||
} else if(StrEqual(troll.name, "Higher Gravity"))
|
||||
SetEntityGravity(victim, isActive ? 1.0 : 1.3);
|
||||
else if(StrEqual(troll.name, "Half Primary Ammo")) {
|
||||
|
|
|
@ -36,9 +36,9 @@ int autoPunishMode;
|
|||
int lastButtonUser;
|
||||
int lastCrescendoUser;
|
||||
int g_iAttackerTarget[MAXPLAYERS+1];
|
||||
int g_iSpecialAttackFlags[MAXPLAYERS+1];
|
||||
int g_PendingBanTroll[MAXPLAYERS+1];
|
||||
float iLastInSpit[MAXPLAYERS+1];
|
||||
int gInstaSpecialMagnet[MAXPLAYERS+1];
|
||||
|
||||
char steamids[MAXPLAYERS+1][64];
|
||||
|
||||
|
@ -53,7 +53,8 @@ enum SpecialSpawnFlags {
|
|||
}
|
||||
|
||||
enum SpecialInternalFlags {
|
||||
SPI_KillOnSpawn = 1
|
||||
SPI_KillOnSpawn = 1,
|
||||
SPI_AlwaysTarget = 2
|
||||
}
|
||||
|
||||
#define MODEL_CAR "models/props_vehicles/cara_95sedan.mdl"
|
||||
|
|
|
@ -103,6 +103,7 @@ public void OnPluginStart() {
|
|||
HookEvent("adrenaline_used", Event_SecondaryHealthUsed);
|
||||
HookEvent("pills_used", Event_SecondaryHealthUsed);
|
||||
HookEvent("entered_spit", Event_EnteredSpit);
|
||||
HookEvent("bot_player_replace", Event_BotPlayerSwap);
|
||||
|
||||
AddNormalSoundHook(view_as<NormalSHook>(SoundHook));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue