mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 00:43:20 +00:00
more hs bug fixes
This commit is contained in:
parent
f6b51ee495
commit
a1b239f394
4 changed files with 30 additions and 15 deletions
Binary file not shown.
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
int slipperyShoesIndex = 0;
|
int slipperyShoesIndex = 0;
|
||||||
int stickyGooIndex = 0;
|
int stickyGooIndex = 0;
|
||||||
|
int invertedTrollIndex;
|
||||||
|
// int fireSpitMagnetTrollIndex;
|
||||||
|
|
||||||
void SetupTrolls() {
|
void SetupTrolls() {
|
||||||
trollKV = new StringMap();
|
trollKV = new StringMap();
|
||||||
|
@ -17,6 +19,7 @@ void SetupTrolls() {
|
||||||
index = SetupTroll("Tank Magnet", "Attracts ALL tanks to any alive target with this troll enabled", TrollMod_Constant);
|
index = SetupTroll("Tank Magnet", "Attracts ALL tanks to any alive target with this troll enabled", TrollMod_Constant);
|
||||||
AddMagnetFlags(index);
|
AddMagnetFlags(index);
|
||||||
index = SetupTroll("Witch Magnet", "All witches when startled will target any player with this troll", TrollMod_Constant);
|
index = SetupTroll("Witch Magnet", "All witches when startled will target any player with this troll", TrollMod_Constant);
|
||||||
|
// fireSpitMagnetTrollIndex = SetupTroll("Fire & Acid Magnet", "Make the player gravitate toward danger", TRollMod_Constant);
|
||||||
|
|
||||||
/// CATEGORY: Infected
|
/// CATEGORY: Infected
|
||||||
SetCategory("Infected");
|
SetCategory("Infected");
|
||||||
|
@ -118,7 +121,7 @@ void SetupTrolls() {
|
||||||
Trolls[index].AddFlag("30% Movement Speed", false);
|
Trolls[index].AddFlag("30% Movement Speed", false);
|
||||||
Trolls[index].AddFlag("0% Movement Speed", false);
|
Trolls[index].AddFlag("0% Movement Speed", false);
|
||||||
SetupTroll("Higher Gravity", "Sets player gravity to 1.3x of normal gravity", TrollMod_Constant);
|
SetupTroll("Higher Gravity", "Sets player gravity to 1.3x of normal gravity", TrollMod_Constant);
|
||||||
SetupTroll("Inverted Controls", "Well, aint it obvious", TrollMod_Constant);
|
invertedTrollIndex = SetupTroll("Inverted Controls", "Well, aint it obvious", TrollMod_Constant);
|
||||||
SetupTroll("Stagger", "Like a slap, but different", TrollMod_Instant);
|
SetupTroll("Stagger", "Like a slap, but different", TrollMod_Instant);
|
||||||
index = SetupTroll("Slippery Shoes", "Periodically stumbles around.", TrollMod_Constant);
|
index = SetupTroll("Slippery Shoes", "Periodically stumbles around.", TrollMod_Constant);
|
||||||
Trolls[index].AddFlagPrompt(true);
|
Trolls[index].AddFlagPrompt(true);
|
||||||
|
@ -165,7 +168,7 @@ void AddMagnetFlags(int index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier modifier, int flags) {
|
bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier modifier, int flags) {
|
||||||
bool isActive = IsTrollActiveByRawID(victim, troll.id);
|
bool toActive = IsTrollActiveByRawID(victim, troll.id);
|
||||||
if(StrEqual(troll.name, "Reset User")) {
|
if(StrEqual(troll.name, "Reset User")) {
|
||||||
LogAction(activator, victim, "\"%L\" reset all effects for \"%L\"", activator, victim);
|
LogAction(activator, victim, "\"%L\" reset all effects for \"%L\"", activator, victim);
|
||||||
ShowActivityEx(activator, "[FTT] ", "reset effects for %N. ", victim);
|
ShowActivityEx(activator, "[FTT] ", "reset effects for %N. ", victim);
|
||||||
|
@ -174,17 +177,18 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod
|
||||||
}
|
}
|
||||||
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
|
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
|
||||||
SetEntityGravity(victim, 1.0);
|
SetEntityGravity(victim, 1.0);
|
||||||
|
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
|
||||||
return false;
|
return false;
|
||||||
} else if(StrEqual(troll.name, "Slow Speed")) {
|
} else if(StrEqual(troll.name, "Slow Speed")) {
|
||||||
if(isActive) {
|
if(toActive) {
|
||||||
float movement = 1.0;
|
float movement = 0.0;
|
||||||
if(flags & 1) movement = 0.6;
|
if(flags & 1) movement = 0.6;
|
||||||
else if(flags & 2) movement = 0.3;
|
else if(flags & 2) movement = 0.3;
|
||||||
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", movement);
|
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", movement);
|
||||||
} else
|
} else
|
||||||
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
|
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
|
||||||
} else if(StrEqual(troll.name, "Higher Gravity"))
|
} else if(StrEqual(troll.name, "Higher Gravity"))
|
||||||
SetEntityGravity(victim, isActive ? 1.0 : 1.3);
|
SetEntityGravity(victim, toActive ? 1.3 : 1.0);
|
||||||
else if(StrEqual(troll.name, "Half Primary Ammo")) {
|
else if(StrEqual(troll.name, "Half Primary Ammo")) {
|
||||||
int current = GetPrimaryReserveAmmo(victim);
|
int current = GetPrimaryReserveAmmo(victim);
|
||||||
SetPrimaryReserveAmmo(victim, current / 2);
|
SetPrimaryReserveAmmo(victim, current / 2);
|
||||||
|
@ -248,7 +252,7 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod
|
||||||
} else if(StrEqual(troll.name, "Stagger")) {
|
} else if(StrEqual(troll.name, "Stagger")) {
|
||||||
L4D_StaggerPlayer(victim, victim, NULL_VECTOR);
|
L4D_StaggerPlayer(victim, victim, NULL_VECTOR);
|
||||||
} else if(StrEqual(troll.name, "Voice Mute")) {
|
} else if(StrEqual(troll.name, "Voice Mute")) {
|
||||||
BaseComm_SetClientMute(victim, !isActive);
|
BaseComm_SetClientMute(victim, toActive);
|
||||||
} else if(StrEqual(troll.name, "Spicy Gas")) {
|
} else if(StrEqual(troll.name, "Spicy Gas")) {
|
||||||
SDKHook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
|
SDKHook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
|
||||||
} else if(StrEqual(troll.name, "Car Splat")) {
|
} else if(StrEqual(troll.name, "Car Splat")) {
|
||||||
|
|
|
@ -261,8 +261,11 @@ bool IsPeekCamActive(int client) {
|
||||||
void SetPeekCamActive(int client, bool active) {
|
void SetPeekCamActive(int client, bool active) {
|
||||||
if(seekerCam != INVALID_ENT_REFERENCE) {
|
if(seekerCam != INVALID_ENT_REFERENCE) {
|
||||||
AcceptEntityInput(seekerCam, "Enable", client); // Need to always activate before deactivating to fix a semi-common bug
|
AcceptEntityInput(seekerCam, "Enable", client); // Need to always activate before deactivating to fix a semi-common bug
|
||||||
if(!active)
|
if(!active) {
|
||||||
AcceptEntityInput(seekerCam, "Disable", client);
|
AcceptEntityInput(seekerCam, "Disable", client);
|
||||||
|
AcceptEntityInput(seekerCam, "Kill");
|
||||||
|
seekerCam = INVALID_ENT_REFERENCE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintToServer("WARN: SetPeekCamActive(%d, %b) when seekerCam invalid", client, active);
|
PrintToServer("WARN: SetPeekCamActive(%d, %b) when seekerCam invalid", client, active);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
#include <left4dhooks>
|
#include <left4dhooks>
|
||||||
#include <sceneprocessor>
|
#include <sceneprocessor>
|
||||||
|
#include <multicolors>
|
||||||
#if defined DEBUG_BLOCKERS
|
#if defined DEBUG_BLOCKERS
|
||||||
#include <smlib/effects>
|
#include <smlib/effects>
|
||||||
int g_iLaserIndex;
|
int g_iLaserIndex;
|
||||||
|
@ -111,6 +112,7 @@ bool ignoreSeekerBalance;
|
||||||
|
|
||||||
ConVar cvar_peekCam;
|
ConVar cvar_peekCam;
|
||||||
ConVar cvar_seekerBalance;
|
ConVar cvar_seekerBalance;
|
||||||
|
ConVar cvar_abm_autohard;
|
||||||
|
|
||||||
#include <hideandseek/hscore>
|
#include <hideandseek/hscore>
|
||||||
|
|
||||||
|
@ -140,6 +142,8 @@ public void OnPluginStart() {
|
||||||
hGamemode.AddChangeHook(Event_GamemodeChange);
|
hGamemode.AddChangeHook(Event_GamemodeChange);
|
||||||
Event_GamemodeChange(hGamemode, gamemode, gamemode);
|
Event_GamemodeChange(hGamemode, gamemode, gamemode);
|
||||||
|
|
||||||
|
cvar_abm_autohard = FindConVar("cvar_abm_autohard");
|
||||||
|
|
||||||
RegConsoleCmd("sm_joingame", Command_Join, "Joins or joins someone else");
|
RegConsoleCmd("sm_joingame", Command_Join, "Joins or joins someone else");
|
||||||
RegAdminCmd("sm_hs", Command_HideAndSeek, ADMFLAG_CHEATS, "The main command. see /hs help");
|
RegAdminCmd("sm_hs", Command_HideAndSeek, ADMFLAG_CHEATS, "The main command. see /hs help");
|
||||||
|
|
||||||
|
@ -180,7 +184,9 @@ public void OnMapStart() {
|
||||||
seekerCam = INVALID_ENT_REFERENCE;
|
seekerCam = INVALID_ENT_REFERENCE;
|
||||||
currentSeeker = 0;
|
currentSeeker = 0;
|
||||||
|
|
||||||
|
if(cvar_abm_autohard != null) {
|
||||||
|
cvar_abm_autohard.IntValue = 0;
|
||||||
|
}
|
||||||
char map[64];
|
char map[64];
|
||||||
GetCurrentMap(map, sizeof(map));
|
GetCurrentMap(map, sizeof(map));
|
||||||
|
|
||||||
|
@ -320,17 +326,19 @@ public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast
|
||||||
}
|
}
|
||||||
|
|
||||||
if(client == currentSeeker && alive == 1) {
|
if(client == currentSeeker && alive == 1) {
|
||||||
PrintToChatAll("Hiders win!");
|
// If seeker died
|
||||||
|
CPrintToChatAll("{green}Hiders win!");
|
||||||
gameOver = true;
|
gameOver = true;
|
||||||
} else {
|
} else {
|
||||||
if(alive == 2) {
|
if(alive == 2) {
|
||||||
PrintToChatAll("One hider remains.");
|
CPrintToChatAll("{green}One hider remains.");
|
||||||
} else if(alive <= 0) {
|
} else if(alive <= 0) {
|
||||||
// Player died and not seeker, therefore seeker killed em
|
// Player died and not seeker, therefore seeker killed em
|
||||||
if(client != currentSeeker) {
|
// If who died was not the seeker
|
||||||
PrintToChatAll("Seeker %N won!", currentSeeker);
|
if(client == currentSeeker) {
|
||||||
|
CPrintToChatAll("{green}Hiders win! The seeker has perished.");
|
||||||
} else {
|
} else {
|
||||||
PrintToChatAll("Hiders win! The last survivor was %N!", client);
|
CPrintToChatAll("{green}The seeker %N won!", currentSeeker);
|
||||||
}
|
}
|
||||||
if(cvar_peekCam.IntValue & 1) {
|
if(cvar_peekCam.IntValue & 1) {
|
||||||
SetPeekCamTarget(client, false);
|
SetPeekCamTarget(client, false);
|
||||||
|
@ -338,7 +346,7 @@ public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast
|
||||||
gameOver = true;
|
gameOver = true;
|
||||||
return;
|
return;
|
||||||
} else if(alive > 2 && client != currentSeeker) {
|
} else if(alive > 2 && client != currentSeeker) {
|
||||||
PrintToChatAll("%d hiders remain", alive - 1);
|
CPrintToChatAll("{green}%d hiders remain", alive - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CreateTimer(2.0, Timer_StopPeekCam);
|
CreateTimer(2.0, Timer_StopPeekCam);
|
||||||
|
@ -402,7 +410,7 @@ public void Event_ItemPickup(Event event, const char[] name, bool dontBroadcast)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ignoreSeekerBalance = false;
|
ignoreSeekerBalance = false;
|
||||||
PrintToChatAll("%N is the seeker", currentSeeker);
|
CPrintToChatAll("{green}%N{yellow} is the seeker", currentSeeker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue