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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
/*
gokz-quiet Plugin Include
Website: https://bitbucket.org/kztimerglobalteam/gokz
*/
#if defined _gokz_quiet_included_
#endinput
#endif
#define _gokz_quiet_included_
// =====[ ENUMS ]=====
enum QTOption:
{
QTOPTION_INVALID = -1,
QTOption_ShowPlayers,
QTOption_Soundscapes,
QTOption_FallDamageSound,
QTOption_AmbientSounds,
QTOption_CheckpointVolume,
QTOption_TeleportVolume,
QTOption_TimerVolume,
QTOption_ErrorVolume,
QTOption_ServerRecordVolume,
QTOption_WorldRecordVolume,
QTOption_JumpstatsVolume,
QTOPTION_COUNT
};
enum
{
ShowPlayers_Disabled = 0,
ShowPlayers_Enabled,
SHOWPLAYERS_COUNT
};
enum
{
Soundscapes_Disabled = 0,
Soundscapes_Enabled,
SOUNDSCAPES_COUNT
};
// =====[ CONSTANTS ]=====
#define QUIET_OPTION_CATEGORY "Quiet"
#define DEFAULT_VOLUME 10
#define VOLUME_COUNT 21 // Maximum of 200%
#define EFFECT_IMPACT 8
#define EFFECT_KNIFESLASH 2
#define BLANK_SOUNDSCAPEINDEX 482 // Search for "coopcementplant.missionselect_blank" id with sv_soundscape_printdebuginfo.
stock char gC_QTOptionNames[QTOPTION_COUNT][] =
{
"GOKZ QT - Show Players",
"GOKZ QT - Soundscapes",
"GOKZ QT - Fall Damage Sound",
"GOKZ QT - Ambient Sounds",
"GOKZ QT - Checkpoint Volume",
"GOKZ QT - Teleport Volume",
"GOKZ QT - Timer Volume",
"GOKZ QT - Error Volume",
"GOKZ QT - Server Record Volume",
"GOKZ QT - World Record Volume",
"GOKZ QT - Jumpstats Volume"
};
stock char gC_QTOptionDescriptions[QTOPTION_COUNT][] =
{
"Visibility of Other Players - 0 = Disabled, 1 = Enabled",
"Play Soundscapes - 0 = Disabled, 1 = Enabled",
"Play Fall Damage Sound - 0 to 20 = 0% to 200%",
"Play Ambient Sounds - 0 to 20 = 0% to 200%",
"Checkpoint Volume - 0 to 20 = 0% to 200%",
"Teleport Volume - 0 to 20 = 0% to 200%",
"Timer Volume - 0 to 20 = 0% to 200%",
"Error Volume - 0 to 20 = 0% to 200%",
"Server Record Volume - 0 to 20 = 0% to 200%",
"World Record Volume - 0 to 20 = 0% to 200%",
"Jumpstats Volume - 0 to 20 = 0% to 200%"
};
stock int gI_QTOptionDefaultValues[QTOPTION_COUNT] =
{
ShowPlayers_Enabled,
Soundscapes_Enabled,
DEFAULT_VOLUME, // Fall damage volume
DEFAULT_VOLUME, // Ambient volume
DEFAULT_VOLUME, // Checkpoint volume
DEFAULT_VOLUME, // Teleport volume
DEFAULT_VOLUME, // Timer volume
DEFAULT_VOLUME, // Error volume
DEFAULT_VOLUME, // Server Record Volume
DEFAULT_VOLUME, // World Record Volume
DEFAULT_VOLUME // Jumpstats Volume
};
stock int gI_QTOptionCounts[QTOPTION_COUNT] =
{
SHOWPLAYERS_COUNT,
SOUNDSCAPES_COUNT,
VOLUME_COUNT, // Fall damage volume
VOLUME_COUNT, // Ambient volume
VOLUME_COUNT, // Checkpoint volume
VOLUME_COUNT, // Teleport volume
VOLUME_COUNT, // Timer volume
VOLUME_COUNT, // Error volume
VOLUME_COUNT, // Server Record volume
VOLUME_COUNT, // World Record volume
VOLUME_COUNT // Jumpstats volume
};
stock char gC_QTOptionPhrases[QTOPTION_COUNT][] =
{
"Options Menu - Show Players",
"Options Menu - Soundscapes",
"Options Menu - Fall Damage Sounds",
"Options Menu - Ambient Sounds",
"Options Menu - Checkpoint Volume",
"Options Menu - Teleport Volume",
"Options Menu - Timer Volume",
"Options Menu - Error Volume",
"Options Menu - Server Record Volume",
"Options Menu - World Record Volume",
"Options Menu - Jumpstats Volume"
};
// =====[ STOCKS ]=====
/**
* Returns whether an option is a gokz-quiet option.
*
* @param option Option name.
* @param optionEnum Variable to store enumerated gokz-quiet option (if it is one).
* @return Whether option is a gokz-quiet option.
*/
stock bool GOKZ_QT_IsQTOption(const char[] option, QTOption &optionEnum = QTOPTION_INVALID)
{
for (QTOption i; i < QTOPTION_COUNT; i++)
{
if (StrEqual(option, gC_QTOptionNames[i]))
{
optionEnum = i;
return true;
}
}
return false;
}
/**
* Gets the current value of a player's gokz-quiet option.
*
* @param client Client index.
* @param option gokz-quiet option.
* @return Current value of option.
*/
stock any GOKZ_QT_GetOption(int client, QTOption option)
{
return GOKZ_GetOption(client, gC_QTOptionNames[option]);
}
/**
* Sets a player's gokz-quiet option's value.
*
* @param client Client index.
* @param option gokz-quiet option.
* @param value New option value.
* @return Whether option was successfully set.
*/
stock bool GOKZ_QT_SetOption(int client, QTOption option, any value)
{
return GOKZ_SetOption(client, gC_QTOptionNames[option], value);
}
/**
* Increment an integer-type gokz-quiet option's value.
* Loops back to '0' if max value is exceeded.
*
* @param client Client index.
* @param option gokz-quiet option.
* @return Whether option was successfully set.
*/
stock bool GOKZ_QT_CycleOption(int client, QTOption option)
{
return GOKZ_CycleOption(client, gC_QTOptionNames[option]);
}
// =====[ DEPENDENCY ]=====
public SharedPlugin __pl_gokz_quiet =
{
name = "gokz-quiet",
file = "gokz-quiet.smx",
#if defined REQUIRE_PLUGIN
required = 1,
#else
required = 0,
#endif
};
|