Skip to content

Commit

Permalink
fix(HUD): Display mode 4/5
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushaway committed Sep 10, 2024
1 parent ef5767a commit 883b8c9
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 6 deletions.
64 changes: 60 additions & 4 deletions addons/sourcemod/scripting/entwatch/module_hud.inc
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ void EWM_Hud_Construct_String(int iClient, char[] sResult, int iSizeResult, char
case 3:
FormatItemWithUses(sBuf_woname[iIndex], ItemTest);
case 4:
FormatItemWithUses(sBuf_woname[iIndex], ItemTest);
FormatItemWithUsesAndCoolodown(sBuf_woname[iIndex], ItemTest);
case 5:
FormatItemWithUses(sBuf_woname[iIndex], ItemTest);
FormatItemCooldownAfterUses(sBuf_woname[iIndex], ItemTest);
case 6, 7:
FormatItemWithMathValue(sBuf_woname[iIndex], ItemTest);
default:
Expand All @@ -547,9 +547,9 @@ void EWM_Hud_Construct_String(int iClient, char[] sResult, int iSizeResult, char
case 3:
FormatItemWithUses(sBuf_woname[iIndex], ItemTest, true);
case 4:
FormatItemWithUses(sBuf_woname[iIndex], ItemTest, true);
FormatItemWithUsesAndCoolodown(sBuf_woname[iIndex], ItemTest, true);
case 5:
FormatItemWithUses(sBuf_woname[iIndex], ItemTest, true);
FormatItemCooldownAfterUses(sBuf_woname[iIndex], ItemTest, true);
case 6, 7:
FormatItemWithMathValue(sBuf_woname[iIndex], ItemTest, true);
}
Expand Down Expand Up @@ -619,6 +619,62 @@ void FormatItemWithUses(char[] sBuf_woname, class_ItemList ItemTest, bool bSecon
}
}

void FormatItemWithUsesAndCoolodown(char[] sBuf_woname, class_ItemList ItemTest, bool bSecond = false)
{
if (!bSecond)
{
if (ItemTest.Uses < ItemTest.MaxUses)
{
if (ItemTest.CoolDown > 0 && ItemTest.CheckCoolDown() > 0)
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[%d]", ItemTest.ShortName, ItemTest.RoundCoolDown());
else
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[%d/%d]", ItemTest.ShortName, ItemTest.Uses, ItemTest.MaxUses);
}
else
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[E]", ItemTest.ShortName);
}
else
{
if (ItemTest.Uses2 < ItemTest.MaxUses2)
{
if (ItemTest.CoolDown2 > 0 && ItemTest.CheckCoolDown(true) > 0)
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[%d]", sBuf_woname, ItemTest.RoundCoolDown(true));
else
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[%d/%d]", sBuf_woname, ItemTest.Uses2, ItemTest.MaxUses2);
}
else
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[E]", sBuf_woname);
}
}

void FormatItemCooldownAfterUses(char[] sBuf_woname, class_ItemList ItemTest, bool bSecond = false)
{
if (!bSecond)
{
if (ItemTest.Uses < ItemTest.MaxUses)
{
if (ItemTest.CoolDown > 0 && ItemTest.CheckCoolDown() > 0)
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[%d]", ItemTest.ShortName, ItemTest.RoundCoolDown());
else
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[%d/%d]", ItemTest.ShortName, ItemTest.Uses, ItemTest.MaxUses);
}
else
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[E]", ItemTest.ShortName);
}
else
{
if (ItemTest.Uses2 < ItemTest.MaxUses2)
{
if (ItemTest.CoolDown2 > 0 && ItemTest.CheckCoolDown(true) > 0)
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[%d]", sBuf_woname, ItemTest.RoundCoolDown(true));
else
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[%d/%d]", sBuf_woname, ItemTest.Uses2, ItemTest.MaxUses2);
}
else
FormatEx(sBuf_woname, MAX_SizeStringForItem, "%s[E]", sBuf_woname);
}
}

void FormatItemWithMathValue(char[] sBuf_woname, class_ItemList ItemTest, bool bSecond = false)
{
if (!bSecond)
Expand Down
6 changes: 4 additions & 2 deletions addons/sourcemod/scripting/entwatch_dz.sp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public Plugin myinfo =
name = "EntWatch",
author = "DarkerZ[RUS], AgentWesker, notkoen, sTc2201, maxime1907, Cmer, .Rushaway, Dolly",
description = "Notify players about entity interactions.",
version = "3.DZ.63",
version = "3.DZ.64",
url = "dark-skill.ru"
};

Expand Down Expand Up @@ -167,7 +167,6 @@ public void OnPluginStart()
continue;

OnClientPutInServer(i);
OnClientCookiesCached(i);
OnClientPostAdminCheck(i);
}
}
Expand Down Expand Up @@ -474,6 +473,9 @@ public void OnClientPostAdminCheck(int iClient)
{
if(!IsValidClient(iClient) || !IsClientConnected(iClient) || IsFakeClient(iClient)) return;

if (AreClientCookiesCached(iClient))
OnClientCookiesCached(iClient);

#if defined EW_MODULE_OFFLINE_EBAN
EWM_OfflineEban_OnClientPostAdminCheck(iClient);
#endif
Expand Down

0 comments on commit 883b8c9

Please sign in to comment.