summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-quiet/falldamage.sp
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-12-04 18:06:10 +0100
committernavewindre <nw@moneybot.cc>2023-12-04 18:06:10 +0100
commitaef0d1c1268ab7d4bc18996c9c6b4da16a40aadc (patch)
tree43e766b51704f4ab8b383583bdc1871eeeb9c698 /sourcemod/scripting/gokz-quiet/falldamage.sp
parent38f1140c11724da05a23a10385061200b907cf6e (diff)
bbbbbbbbwaaaaaaaaaaa
Diffstat (limited to 'sourcemod/scripting/gokz-quiet/falldamage.sp')
-rw-r--r--sourcemod/scripting/gokz-quiet/falldamage.sp40
1 files changed, 40 insertions, 0 deletions
diff --git a/sourcemod/scripting/gokz-quiet/falldamage.sp b/sourcemod/scripting/gokz-quiet/falldamage.sp
new file mode 100644
index 0000000..6bd0533
--- /dev/null
+++ b/sourcemod/scripting/gokz-quiet/falldamage.sp
@@ -0,0 +1,40 @@
+/*
+ Toggle player's fall damage sounds.
+*/
+
+void OnPluginStart_FallDamage()
+{
+ AddNormalSoundHook(Hook_NormalSound);
+}
+
+static Action Hook_NormalSound(int clients[MAXPLAYERS], int& numClients, char sample[PLATFORM_MAX_PATH], int& entity, int& channel, float& volume, int& level, int& pitch, int& flags, char soundEntry[PLATFORM_MAX_PATH], int& seed)
+{
+ if (!StrEqual(soundEntry, "Player.FallDamage"))
+ {
+ return Plugin_Continue;
+ }
+
+ for (int i = 0; i < numClients; i++)
+ {
+ int client = clients[i];
+ if (!IsValidClient(client))
+ {
+ continue;
+ }
+ int clientArray[1];
+ clientArray[0] = client;
+ float newVolume;
+ if (GOKZ_QT_GetOption(client, QTOption_FallDamageSound) == -1 || GOKZ_QT_GetOption(client, QTOption_FallDamageSound) == 10)
+ {
+ newVolume = volume;
+ }
+ else
+ {
+ float volumeFactor = float(GOKZ_QT_GetOption(client, QTOption_FallDamageSound)) * 0.1;
+ newVolume = volume * volumeFactor;
+ }
+
+ EmitSoundEntry(clientArray, 1, soundEntry, sample, entity, channel, level, seed, flags, newVolume, pitch);
+ }
+ return Plugin_Handled;
+} \ No newline at end of file