Add sm_ff_notice to notify if a FF occurs

This commit is contained in:
Jackzie 2020-12-29 13:26:08 -06:00
parent 62f8d2ca17
commit d5eb2265c7
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
3 changed files with 22 additions and 3 deletions

View file

@ -65,6 +65,7 @@ A group of misc tools for l4d2. Including: Notify on lasers use, and a finale ti
* **Convars:**
* `sm_laser_use_notice <1/0>` - Enable notification of a laser box being used
* `sm_time_finale <0/1/2>` - Record the time it takes to complete finale. 0 -> OFF, 1 -> Gauntlets Only, 2 -> All finales
* `sm_ff_notice <0/1/2>` - Notify players if a FF occurs. 0 -> Disabled, 1 -> In chat, 2 -> In Hint text
### 200IQBots_FlyYouFools
Updated version of ConnerRia's plugin. Improves bots avoidance of tanks. Change from original is updated source syntax, some optimizations/cleanup, and fixes such as bots avoiding tank that has not been activated, or not escaping in vehicle due to presence of tank.

Binary file not shown.

View file

@ -15,7 +15,7 @@
bool bLasersUsed[2048];
ConVar hLaserNotice, hFinaleTimer;
ConVar hLaserNotice, hFinaleTimer, hFFNotice;
int iFinaleStartTime;
public Plugin myinfo = {
@ -34,8 +34,10 @@ public void OnPluginStart() {
}
hLaserNotice = CreateConVar("sm_laser_use_notice", "1.0", "Enable notification of a laser box being used", FCVAR_NONE, true, 0.0, true, 1.0);
hFinaleTimer = CreateConVar("sm_time_finale", "2.0", "Record the time it takes to complete finale. 0 -> OFF, 1 -> Gauntlets Only, 2 -> All finales", FCVAR_NONE, true, 0.0, true, 2.0);
hFFNotice = CreateConVar("sm_ff_notice", "0.0", "Notify players if a FF occurs. 0 -> Disabled, 1 -> In chat, 2 -> In Hint text", FCVAR_NONE, true, 0.0, true, 2.0);
HookEvent("player_use", Event_PlayerUse);
HookEvent("player_hurt", Event_PlayerHurt);
HookEvent("round_end", Event_RoundEnd);
HookEvent("gauntlet_finale_start", Event_GauntletStart);
HookEvent("finale_start", Event_FinaleStart);
@ -45,6 +47,24 @@ public void OnPluginStart() {
}
//laserNotice
public void Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast) {
if(hFFNotice.IntValue > 0) {
int victim = GetClientOfUserId(event.GetInt("userid"));
int attacker = GetClientOfUserId(event.GetInt("attacker"));
int dmg = event.GetInt("dmg_health");
if(dmg > 0) {
if(attacker > 0 && !IsFakeClient(attacker) && attacker != victim) {
if(GetClientTeam(attacker) == 2 && GetClientTeam(victim) == 2) {
if(hFFNotice.IntValue == 1) {
PrintHintTextToAll("%N has done %d HP of friendly fire damage to %N", attacker, dmg, victim);
}else{
PrintToChatAll("%N has done %d HP of friendly fire damage to %N", attacker, dmg, victim);
}
}
}
}
}
}
public void Event_PlayerUse(Event event, const char[] name, bool dontBroadcast) {
if(hLaserNotice.BoolValue) {
char player_name[32];
@ -75,13 +95,11 @@ public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) {
public void Event_GauntletStart(Event event, const char[] name, bool dontBroadcast) {
if(hFinaleTimer.IntValue > 0) {
iFinaleStartTime = GetTime();
PrintHintTextToAll("The finale timer has been started");
}
}
public void Event_FinaleStart(Event event, const char[] name, bool dontBroadcast) {
if(hFinaleTimer.IntValue == 2) {
iFinaleStartTime = GetTime();
PrintHintTextToAll("The finale timer has been started");
}
}
public void Event_FinaleEnd(Event event, const char[] name, bool dontBroadcast) {