summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-quiet/soundscape.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/soundscape.sp
parent38f1140c11724da05a23a10385061200b907cf6e (diff)
bbbbbbbbwaaaaaaaaaaa
Diffstat (limited to 'sourcemod/scripting/gokz-quiet/soundscape.sp')
-rw-r--r--sourcemod/scripting/gokz-quiet/soundscape.sp30
1 files changed, 30 insertions, 0 deletions
diff --git a/sourcemod/scripting/gokz-quiet/soundscape.sp b/sourcemod/scripting/gokz-quiet/soundscape.sp
new file mode 100644
index 0000000..f320ad3
--- /dev/null
+++ b/sourcemod/scripting/gokz-quiet/soundscape.sp
@@ -0,0 +1,30 @@
+/*
+ Toggle soundscapes.
+*/
+
+static int currentSoundscapeIndex[MAXPLAYERS + 1] = {BLANK_SOUNDSCAPEINDEX, ...};
+
+void EnableSoundscape(int client)
+{
+ if (currentSoundscapeIndex[client] != BLANK_SOUNDSCAPEINDEX)
+ {
+ SetEntProp(client, Prop_Data, "soundscapeIndex", currentSoundscapeIndex[client]);
+ }
+}
+
+void OnPlayerRunCmdPost_Soundscape(int client)
+{
+ int soundscapeIndex = GetEntProp(client, Prop_Data, "soundscapeIndex");
+ if (GOKZ_GetOption(client, gC_QTOptionNames[QTOption_Soundscapes]) == Soundscapes_Disabled)
+ {
+ if (soundscapeIndex != BLANK_SOUNDSCAPEINDEX)
+ {
+ currentSoundscapeIndex[client] = soundscapeIndex;
+ }
+ SetEntProp(client, Prop_Data, "soundscapeIndex", BLANK_SOUNDSCAPEINDEX);
+ }
+ else
+ {
+ currentSoundscapeIndex[client] = soundscapeIndex;
+ }
+} \ No newline at end of file