1919#include <lerpmonitor>
2020#include <witch_and_tankifier>
2121
22- #define PLUGIN_VERSION " 3.8.5 "
22+ #define PLUGIN_VERSION " 3.8.6 "
2323
24- public Plugin myinfo =
24+ public Plugin myinfo =
2525{
2626 name = " Hyper-V HUD Manager" ,
2727 author = " Visor, Forgetest" ,
@@ -33,7 +33,7 @@ public Plugin myinfo =
3333// ======================================================================
3434// Macros
3535// ======================================================================
36- #define SPECHUD_DRAW_INTERVAL 0.5
36+ #define SPECHUD_DRAW_INTERVAL 0.5
3737#define TRANSLATION_FILE " spechud.phrases"
3838
3939// ======================================================================
@@ -328,7 +328,7 @@ public void OnRoundIsLive()
328328
329329 for (int i = 1 ; i <= MaxClients ; i ++ )
330330 {
331- if (IsClientInGame (i ) && GetClientTeam (i ) == TEAM_SPECTATOR && ! IsClientSourceTV (i ))
331+ if (IsClientInGame (i ) && GetClientTeam (i ) == L4D2Team_Spectator && ! IsClientSourceTV (i ))
332332 FakeClientCommand (i , " sm_spectate" );
333333 }
334334
@@ -431,16 +431,19 @@ void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast)
431431 bTankHudActive [client ] = true ;
432432 }
433433
434- //if (team == 3 ) storedClass[client] = ZC_None;
434+ //if (team == L4D2Team_Infected ) storedClass[client] = ZC_None;
435435}
436436
437437/* *********************************************************************************************/
438438
439439// ======================================================================
440440// HUD Command Callbacks
441441// ======================================================================
442- Action ToggleSpecHudCmd (int client , int args )
442+ Action ToggleSpecHudCmd (int client , int args )
443443{
444+ if (! IsValidClientIndex (client ) || ! IsClientInGame (client ))
445+ return Plugin_Handled ;
446+
444447 if (GetClientTeam (client ) != L4D2Team_Spectator )
445448 return Plugin_Handled ;
446449
@@ -450,10 +453,12 @@ Action ToggleSpecHudCmd(int client, int args)
450453 return Plugin_Handled ;
451454}
452455
453- Action ToggleTankHudCmd (int client , int args )
456+ Action ToggleTankHudCmd (int client , int args )
454457{
455- int team = GetClientTeam (client );
456- if (team == L4D2Team_Survivor )
458+ if (! IsValidClientIndex (client ) || ! IsClientInGame (client ))
459+ return Plugin_Handled ;
460+
461+ if (GetClientTeam (client ) == L4D2Team_Survivor )
457462 return Plugin_Handled ;
458463
459464 bTankHudActive [client ] = ! bTankHudActive [client ];
@@ -488,21 +493,21 @@ Action HudDrawTimer(Handle hTimer)
488493 continue ;
489494 }
490495
491- int team = GetClientTeam (i );
492- switch (team )
496+ switch (GetClientTeam (i ))
493497 {
494- case 3 :
495- {
496- if (bTankHudActive [i ])
497- tankHud_clients [tankHud_total ++ ] = i ;
498- }
499- case 1 :
498+ case L4D2Team_Spectator :
500499 {
501500 if (bSpecHudActive [i ])
502501 specHud_clients [specHud_total ++ ] = i ;
503502 else if (bTankHudActive [i ])
504503 tankHud_clients [tankHud_total ++ ] = i ;
505504 }
505+ case L4D2Team_Infected :
506+ {
507+ if (bTankHudActive [i ])
508+ tankHud_clients [tankHud_total ++ ] = i ;
509+ }
510+
506511 }
507512 }
508513
@@ -711,7 +716,7 @@ void FillSurvivorInfo(Panel hSpecHud)
711716 int [] clients = new int [MaxClients ];
712717 for (int i = 1 ; i <= MaxClients ; ++ i )
713718 {
714- if (! IsClientInGame (i ) || GetClientTeam (i ) != 2 )
719+ if (! IsClientInGame (i ) || GetClientTeam (i ) != L4D2Team_Survivor )
715720 continue ;
716721
717722 clients [total ++ ] = i ;
@@ -917,11 +922,11 @@ void FillInfectedInfo(Panel hSpecHud)
917922 int infectedCount = 0 ;
918923 for (int client = 1 ; client <= MaxClients ; ++ client )
919924 {
920- if (! IsClientInGame (client ) || GetClientTeam (client ) != 3 )
925+ if (! IsClientInGame (client ) || GetClientTeam (client ) != L4D2Team_Infected )
921926 continue ;
922927
923928 GetClientFixedName (client , name , sizeof (name ));
924- if (! IsPlayerAlive (client ))
929+ if (! IsPlayerAlive (client ))
925930 {
926931 int timeLeft = RoundToFloor (L4D_GetPlayerSpawnTime (client ));
927932 if (timeLeft < 0 ) // Deathcam
@@ -1061,8 +1066,9 @@ bool FillTankInfo(Panel hSpecHud, bool bTankHUD = false)
10611066 int health = GetClientHealth (tank );
10621067 int maxhealth = GetEntProp (tank , Prop_Send , " m_iMaxHealth" );
10631068 float healthPercent = L4D2Util_IntToPercentFloat (health , maxhealth ); // * 100 already
1069+ bool isIncapacitated = IsIncapacitated (tank );
10641070
1065- if (health <= 0 || IsIncapacitated ( tank ) )
1071+ if (health <= 0 || isIncapacitated )
10661072 {
10671073 info = " Health : Dead" ;
10681074 }
@@ -1095,7 +1101,7 @@ bool FillTankInfo(Panel hSpecHud, bool bTankHUD = false)
10951101 DrawPanelText (hSpecHud , info );
10961102
10971103 // Draw fire status
1098- if (GetEntityFlags (tank ) & FL_ONFIRE )
1104+ if (! isIncapacitated && GetEntityFlags (tank ) & FL_ONFIRE )
10991105 {
11001106 int timeleft = RoundToCeil (healthPercent / 100.0 * fTankBurnDuration );
11011107 FormatEx (info , sizeof (info ), " On Fire : %i s" , timeleft );
@@ -1207,13 +1213,13 @@ void FillGameInfo(Panel hSpecHud)
12071213 * +68: Grenade Launcher - ammo_grenadelauncher_max
12081214 */
12091215
1210- #define ASSAULT_RIFLE_OFFSET_IAMMO 12 ;
1211- #define SMG_OFFSET_IAMMO 20 ;
1212- #define PUMPSHOTGUN_OFFSET_IAMMO 28 ;
1213- #define AUTO_SHOTGUN_OFFSET_IAMMO 32 ;
1214- #define HUNTING_RIFLE_OFFSET_IAMMO 36 ;
1215- #define MILITARY_SNIPER_OFFSET_IAMMO 40 ;
1216- #define GRENADE_LAUNCHER_OFFSET_IAMMO 68 ;
1216+ #define ASSAULT_RIFLE_OFFSET_IAMMO 12
1217+ #define SMG_OFFSET_IAMMO 20
1218+ #define PUMPSHOTGUN_OFFSET_IAMMO 28
1219+ #define AUTO_SHOTGUN_OFFSET_IAMMO 32
1220+ #define HUNTING_RIFLE_OFFSET_IAMMO 36
1221+ #define MILITARY_SNIPER_OFFSET_IAMMO 40
1222+ #define GRENADE_LAUNCHER_OFFSET_IAMMO 68
12171223
12181224stock int GetWeaponExtraAmmo (int client , int wepid )
12191225{
@@ -1224,24 +1230,24 @@ stock int GetWeaponExtraAmmo(int client, int wepid)
12241230 switch (wepid )
12251231 {
12261232 case WEPID_RIFLE , WEPID_RIFLE_AK47 , WEPID_RIFLE_DESERT , WEPID_RIFLE_SG552 :
1227- offset = ASSAULT_RIFLE_OFFSET_IAMMO
1233+ offset = ASSAULT_RIFLE_OFFSET_IAMMO ;
12281234 case WEPID_SMG , WEPID_SMG_SILENCED :
1229- offset = SMG_OFFSET_IAMMO
1235+ offset = SMG_OFFSET_IAMMO ;
12301236 case WEPID_PUMPSHOTGUN , WEPID_SHOTGUN_CHROME :
1231- offset = PUMPSHOTGUN_OFFSET_IAMMO
1237+ offset = PUMPSHOTGUN_OFFSET_IAMMO ;
12321238 case WEPID_AUTOSHOTGUN , WEPID_SHOTGUN_SPAS :
1233- offset = AUTO_SHOTGUN_OFFSET_IAMMO
1239+ offset = AUTO_SHOTGUN_OFFSET_IAMMO ;
12341240 case WEPID_HUNTING_RIFLE :
1235- offset = HUNTING_RIFLE_OFFSET_IAMMO
1241+ offset = HUNTING_RIFLE_OFFSET_IAMMO ;
12361242 case WEPID_SNIPER_MILITARY , WEPID_SNIPER_AWP , WEPID_SNIPER_SCOUT :
1237- offset = MILITARY_SNIPER_OFFSET_IAMMO
1243+ offset = MILITARY_SNIPER_OFFSET_IAMMO ;
12381244 case WEPID_GRENADE_LAUNCHER :
1239- offset = GRENADE_LAUNCHER_OFFSET_IAMMO
1245+ offset = GRENADE_LAUNCHER_OFFSET_IAMMO ;
12401246 default :
12411247 return - 1 ;
12421248 }
12431249 return GetEntData (client , ammoOffset + offset );
1244- }
1250+ }
12451251
12461252stock int GetWeaponClipAmmo (int weapon )
12471253{
@@ -1287,10 +1293,10 @@ stock bool ValvePanel_ShiftInvalidString(char[] str, int maxlen)
12871293// return team ^ view_as<int>(InSecondHalfOfRound() != GameRules_GetProp("m_bAreTeamsFlipped"));
12881294//}
12891295
1290- stock int GetRealClientCount ()
1296+ stock int GetRealClientCount ()
12911297{
12921298 int clients = 0 ;
1293- for (int i = 1 ; i <= MaxClients ; ++ i )
1299+ for (int i = 1 ; i <= MaxClients ; ++ i )
12941300 {
12951301 if (IsClientConnected (i ) && ! IsFakeClient (i )) clients ++ ;
12961302 }
@@ -1330,7 +1336,7 @@ stock int FormatScavengeRoundTime(char[] buffer, int maxlen, int teamIndex, bool
13301336 Format (buffer , maxlen , " %d :%05.2f " , minutes , seconds );
13311337}
13321338
1333- /*
1339+ /*
13341340 * GetScavengeRoundDuration & GetScavengeTeamScore
13351341 * credit to ProdigySim
13361342 */
@@ -1410,4 +1416,4 @@ stock bool RoundHasFlowTank()
14101416stock bool RoundHasFlowWitch ()
14111417{
14121418 return L4D2Direct_GetVSWitchToSpawnThisRound (InSecondHalfOfRound ());
1413- }
1419+ }
0 commit comments