Skip to content

Commit 133c4e5

Browse files
shavit-hud.sp - add perf% to center hud (#1259)
Co-authored-by: rtldg <[email protected]>
1 parent 7cbb250 commit 133c4e5

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

addons/sourcemod/scripting/include/shavit/hud.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define HUD_GLOCK (1 << 14) // makes you spawn with a Glock
4343
#define HUD_DEBUGTARGETNAME (1 << 15) // admin option to show current targetname & classname
4444
#define HUD_SPECTATORSDEAD (1 << 16) // for only showing spectators list when you're dead/spectating.
45+
#define HUD_PERFS_CENTER (1 << 17) // for the perf percentage in the center hud. e.g. "Jumps: 20 (66.6%)"
4546

4647
// HUD2 - these settings will *disable* elements for the main hud
4748
#define HUD2_TIME (1 << 0)

addons/sourcemod/scripting/shavit-hud.sp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ public void OnPluginStart()
209209
..."HUD_USP 8192\n"
210210
..."HUD_GLOCK 16384\n"
211211
..."HUD_SPECTATORSDEAD 65536\n"
212+
..."HUD_PERFS_CENTER 131072\n"
212213
);
213214

214215
IntToString(HUD_DEFAULT2, defaultHUD, 8);
@@ -776,6 +777,10 @@ Action ShowHUDMenu(int client, int item)
776777
FormatEx(sHudItem, 64, "%T", "HudPerfs", client);
777778
menu.AddItem(sInfo, sHudItem);
778779

780+
FormatEx(sInfo, 16, "!%d", HUD_PERFS_CENTER);
781+
FormatEx(sHudItem, 64, "%T", "HudPerfsCenter", client);
782+
menu.AddItem(sInfo, sHudItem);
783+
779784
FormatEx(sInfo, 16, "@%d", HUD2_STYLE);
780785
FormatEx(sHudItem, 64, "%T", "HudStyleText", client);
781786
menu.AddItem(sInfo, sHudItem);
@@ -1369,7 +1374,15 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
13691374

13701375
if((gI_HUD2Settings[client] & HUD2_JUMPS) == 0)
13711376
{
1372-
FormatEx(sLine, 128, "%T: %d", "HudJumpsText", client, data.iJumps);
1377+
if (!Shavit_GetStyleSettingBool(data.iStyle, "autobhop") && (gI_HUDSettings[client] & HUD_PERFS_CENTER))
1378+
{
1379+
FormatEx(sLine, 128, "%T: %d (%.1f%)", "HudJumpsText", client, data.iJumps, Shavit_GetPerfectJumps(data.iTarget));
1380+
}
1381+
else
1382+
{
1383+
FormatEx(sLine, 128, "%T: %d", "HudJumpsText", client, data.iJumps);
1384+
}
1385+
13731386
AddHUDLine(buffer, maxlen, sLine, iLines);
13741387
}
13751388

addons/sourcemod/translations/shavit-hud.phrases.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
{
8686
"en" "Perfect jumps"
8787
}
88+
"HudPerfsCenter"
89+
{
90+
"en" "Perfect jumps (center hud)"
91+
}
8892
"HudDefaultPistol"
8993
{
9094
"en" "Default Pistol: 1=USP 2=Glock"

0 commit comments

Comments
 (0)