From 544112da92cc6e4fae37e50cfad30e2040c5c31a Mon Sep 17 00:00:00 2001 From: neon <> Date: Thu, 12 Sep 2019 14:31:37 +0200 Subject: [PATCH] Hitmarker: update --- Hitmarker/scripting/Hitmarker.sp | 49 +++++++++++++++++++++++++++---- Hitmarker/sound/unloze/hm.mp3 | Bin 2088 -> 0 bytes Hitmarker/sound/unloze/hm_v2.mp3 | Bin 0 -> 4178 bytes 3 files changed, 43 insertions(+), 6 deletions(-) delete mode 100644 Hitmarker/sound/unloze/hm.mp3 create mode 100644 Hitmarker/sound/unloze/hm_v2.mp3 diff --git a/Hitmarker/scripting/Hitmarker.sp b/Hitmarker/scripting/Hitmarker.sp index 3cf4540c..a2771748 100644 --- a/Hitmarker/scripting/Hitmarker.sp +++ b/Hitmarker/scripting/Hitmarker.sp @@ -17,11 +17,14 @@ bool g_bShowBossHitmarker[MAXPLAYERS+1]; bool g_bShowZombieHitmarker[MAXPLAYERS+1]; bool g_bHitmarkerSound[MAXPLAYERS+1]; +int g_iHitmarkerSoundVolume[MAXPLAYERS+1] = {100,...}; + Handle g_hTimer[MAXPLAYERS+1] = {null,...}; Handle g_hCookie_ShowBossHitmarker; Handle g_hCookie_ShowZombieHitmarker; Handle g_hCookie_HitmarkerSound; +Handle g_hCookie_HitmarkerSoundVolume; //Handle g_hHudText; @@ -44,6 +47,7 @@ public void OnPluginStart() g_hCookie_ShowBossHitmarker = RegClientCookie("hitmarker_boss", "", CookieAccess_Private); g_hCookie_ShowZombieHitmarker = RegClientCookie("hitmarker_zombie", "", CookieAccess_Private); g_hCookie_HitmarkerSound = RegClientCookie("hitmarker_sound", "", CookieAccess_Private); + g_hCookie_HitmarkerSoundVolume = RegClientCookie("hitmarker_sound_volume", "", CookieAccess_Private); //g_hHudText = CreateHudSynchronizer(); @@ -68,8 +72,8 @@ public void OnMapStart() AddFileToDownloadsTable("materials/overlays/nano/hitmarker.vtf"); AddFileToDownloadsTable("materials/overlays/nano/hitmarker.vmt"); - PrecacheSound("unloze/hm.mp3"); - AddFileToDownloadsTable("sound/unloze/hm.mp3"); + PrecacheSound("unloze/hm_v2.mp3"); + AddFileToDownloadsTable("sound/unloze/hm_v2.mp3"); } //---------------------------------------------------------------------------------------------------- @@ -98,6 +102,13 @@ public void OnClientCookiesCached(int client) g_bHitmarkerSound[client] = true; else g_bHitmarkerSound[client] = false; + + GetClientCookie(client, g_hCookie_HitmarkerSoundVolume, sBuffer, sizeof(sBuffer)); + + if (sBuffer[0]) + g_iHitmarkerSoundVolume[client] = 100; + else + g_iHitmarkerSoundVolume[client] = StringToInt(sBuffer); } //---------------------------------------------------------------------------------------------------- @@ -108,6 +119,7 @@ public void OnClientDisconnect(int client) g_bShowBossHitmarker[client] = false; g_bShowZombieHitmarker[client] = false; g_bHitmarkerSound[client] = false; + g_iHitmarkerSoundVolume[client] = 100; } //---------------------------------------------------------------------------------------------------- @@ -136,7 +148,7 @@ public void ToggleBossHitmarker(int client) g_bShowBossHitmarker[client] = !g_bShowBossHitmarker[client]; SetClientCookie(client, g_hCookie_ShowBossHitmarker, g_bShowBossHitmarker[client] ? "1" : ""); - CPrintToChat(client, "{cyan}[Hitmarker] {white}%s", g_bShowBossHitmarker[client] ? "Boss Hitmarker Enabled." : "Boss Hitmarker Disabled."); + CPrintToChat(client, "{cyan}[Hitmarker] {white}%s.", g_bShowBossHitmarker[client] ? "Boss Hitmarker Enabled" : "Boss Hitmarker Disabled"); } //---------------------------------------------------------------------------------------------------- @@ -156,7 +168,7 @@ public void ToggleZombieHitmarker(int client) g_bShowZombieHitmarker[client] = !g_bShowZombieHitmarker[client]; SetClientCookie(client, g_hCookie_ShowZombieHitmarker, g_bShowZombieHitmarker[client] ? "1" : ""); - CPrintToChat(client, "{cyan}[Hitmarker] {white}%s", g_bShowZombieHitmarker[client] ? "Zombie Hitmarker Enabled." : "Zombie Hitmarker Disabled."); + CPrintToChat(client, "{cyan}[Hitmarker] {white}%s.", g_bShowZombieHitmarker[client] ? "Zombie Hitmarker Enabled" : "Zombie Hitmarker Disabled"); } //---------------------------------------------------------------------------------------------------- @@ -176,7 +188,25 @@ public void ToggleHitmarkerSound(int client) g_bHitmarkerSound[client] = !g_bHitmarkerSound[client]; SetClientCookie(client, g_hCookie_HitmarkerSound, g_bHitmarkerSound[client] ? "1" : ""); - CPrintToChat(client, "{cyan}[Hitmarker] {white}%s", g_bHitmarkerSound[client] ? "Hitmarker Sound Enabled." : "Hitmarker Sound Disabled."); + CPrintToChat(client, "{cyan}[Hitmarker] {white}%s.", g_bHitmarkerSound[client] ? "Hitmarker Sound Enabled" : "Hitmarker Sound Disabled"); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void ToggleHitmarkerSoundVolume(int client) +{ + g_iHitmarkerSoundVolume[client] += 25; + + if(g_iHitmarkerSoundVolume[client] > 100) + g_iHitmarkerSoundVolume[client] = 25; + + char sBuffer[16]; + IntToString(g_iHitmarkerSoundVolume[client], sBuffer, sizeof(sBuffer)); + + SetClientCookie(client, g_hCookie_HitmarkerSoundVolume, sBuffer); + + //CPrintToChat(client, "{cyan}[Hitmarker] {white}Hitmarker Sound Volume: %d\%", g_iHitmarkerSoundVolume[client]); } //---------------------------------------------------------------------------------------------------- @@ -199,6 +229,9 @@ public void ShowSettingsMenu(int client) Format(sBuffer, sizeof(sBuffer), "Hitmarker Sound: %s", g_bHitmarkerSound[client] ? "Enabled" : "Disabled"); menu.AddItem("2", sBuffer); + Format(sBuffer, sizeof(sBuffer), "Hitmarker Sound Volume: %d\%", g_iHitmarkerSoundVolume[client]); + menu.AddItem("3", sBuffer); + menu.ExitBackButton = true; menu.Display(client, MENU_TIME_FOREVER); @@ -236,6 +269,7 @@ public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int se case(0): ToggleBossHitmarker(client); case(1): ToggleZombieHitmarker(client); case(2): ToggleHitmarkerSound(client); + case(3): ToggleHitmarkerSoundVolume(client); } ShowSettingsMenu(client); @@ -328,7 +362,10 @@ public void OnClientHurt(Event hEvent, const char[] sEvent, bool bDontBroadcast) public void ShowOverlay(int client) { if (g_bHitmarkerSound[client]) - EmitSoundToClient(client, "unloze/hm.mp3", .volume=1.0); + { + float fVolume = g_iHitmarkerSoundVolume[client] / 100.0; + EmitSoundToClient(client, "unloze/hm_v2.mp3", .volume=fVolume); + } if (g_hTimer[client] != null) { diff --git a/Hitmarker/sound/unloze/hm.mp3 b/Hitmarker/sound/unloze/hm.mp3 deleted file mode 100644 index 7fd1e2c261c0fd4594b8ced1f9a87704138bbfc8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2088 zcmezWdqN5W0pOXJmJd|I55z1C3>+E^4mdyqE^q)B_>T(!?XvW7^mR4Xv$QN?Tm^EW zo;(ACNP`MXpdSN61IQhh^p7#Jmjc%>~n8h{=* zX$BHI&z59de8u1s)?femZ;t|lf|GLX%_k@C{r_Km|Br+tN5}5nHZzSfkJNwvq2~Af zh)eAM-!}~y99fi<>~{kNe(&D@`;H3`2&qtZF+>^c6I^3lL!Cg&BaF8P*TUmwMDX6>v?d@g5sFKP4{@%accKG-*@b9(;&|9{KF z|NsB-t?6oe_mGB-NY}65em*yd>0kMD@0< z*u{Uj3=9!A6Fxeu)?qMexMIt4G5(x!!2?c53w6dD>%!+N{r^2FMV)~yG%fC5>H}b8 z@G2Z&U=a759kp{MkOzsN!~b7>elSP4`N=Qm=~p?j*53dBxp3{uHFv|c;%qakRqp>x zpFM}y<-vW6{?%_+o%+4*|Nn36uXY_x-kP{?z4_I-Q)i_nzr1y8`Tzg+|34Q*NKIXL zb#C0+@T|VAQFjkbDL1)v{tqx8z1v?_yLI>5yt{R4N^joVH!X5m{qu@rUw;4-4THp_ z1v8FG{G7%-?Odj^fQOrf1bZY$10Q>sqHL&iB%Xns`<$Xx7#d%uIg#p~Uf`z{1PyE*kp(WDRz*o{^OR5_*OI#r6N`H5_gD z-*m#cmro-ou~hNcq$L|QRoSiopDc<9Vwxn$#hyt4(^XIAmBm`lIlce?$2}}Y4s7Zg%;&9E`&rw}*70ERn)Nia z`m5+#S6A2Bp?_Ul8#kEoujgxsux)!X*^N8UJ^qi-QW=kxTW&fX*E+Cat8vk?!_EbP zpcqo_`TRQRV7ep&I14>sVC1^$x5$AZ`vx$E8i3{6rB#8~zppyAYSq6pI+s?*U%TtD zHD$KgYMr~~T5HZ+*N!{8YW>lZYU{2AY`nB+(V_(h-D{Mc<{xa(4gH@w>9o$KNRR(& zVO$at3W?6lEHcUq3=-z@My9M;*x1CzAz<+$<0*3{Qb#$f5rO14AY-t#W|!5Ca1v U5G?_6flP1=VQ3l^pkoLC0OiQLrT_o{ diff --git a/Hitmarker/sound/unloze/hm_v2.mp3 b/Hitmarker/sound/unloze/hm_v2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..cda2a086e3f83458c439fe124c35ff8cef566dc4 GIT binary patch literal 4178 zcmeHJYc$kr7k_39CI(|de}tJaZf_lpOBQh$*W4o%N@kFfUKEOxGNf@ZF~l*+W#p1u zlJ2Er)`1b8C|W0^Qxy4V`%nwXqKbbrgx5GIKQxc~%ZJ&#ge zVEH%2cln)x?+pAs48VW(1ax<>ji?p{natYX$f*G2upREh*8x(+cH%TL0^}u706-w^ zGZW~PtlpBaqtn^>Be6>o_OC6Jb6-7&!pbx>NCA3K=?oOMU#jur*9Ns{1N(b1SnV#n z;m;yj(7-jT;%7<6rBT?Qyi9Kl-#eMIbaG<8ov5D?j3p!izYD!`Bc}<;=lnese(_)E zFMc%ObMi%9>@`BIiOiHS{2)}C6Ow*&;;GGh8{Bq&iQ${>P41j=3PamX+bZ|YJyrV$ zI9cKr>v>;2j77#&eYLvoauN!OPRvmM(EQ?z|LKWKVXr<5@T|LOe;~K_5)E4EEh=8g z-U72$=IANau4&#-DzjIa?^Ys*{Z)ok>z|`Vp8iRQxW&?S)TxsNLI5C+NG_V^t`pzf z0}G`M@a(HnIzR&;a4F#=_z~NTIkKp1jUl(epJBeiR}8sljmA)1foKdUc$81>f%O`e z7JDpU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