summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-quiet/soundscape.sp
blob: f320ad39bfe12c86768f5fb2d86e2c6e48524d56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
	}
}