|
ds@1952
|
1 |
/** |
|
ds@1952
|
2 |
* vim: set ts=4 : |
|
ds@1952
|
3 |
* ============================================================================= |
|
ds@1952
|
4 |
* SourceMod Basecomm |
|
ds@1952
|
5 |
* Part of Basecomm plugin, menu and other functionality. |
|
ds@1952
|
6 |
* |
|
ds@1952
|
7 |
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. |
|
ds@1952
|
8 |
* ============================================================================= |
|
ds@1952
|
9 |
* |
|
ds@1952
|
10 |
* This program is free software; you can redistribute it and/or modify it under |
|
ds@1952
|
11 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
ds@1952
|
12 |
* Free Software Foundation. |
|
ds@1952
|
13 |
* |
|
ds@1952
|
14 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
ds@1952
|
15 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
ds@1952
|
16 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
ds@1952
|
17 |
* details. |
|
ds@1952
|
18 |
* |
|
ds@1952
|
19 |
* You should have received a copy of the GNU General Public License along with |
|
ds@1952
|
20 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
ds@1952
|
21 |
* |
|
ds@1952
|
22 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
ds@1952
|
23 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
ds@1952
|
24 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
ds@1952
|
25 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
ds@1952
|
26 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
ds@1952
|
27 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
ds@1952
|
28 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
ds@1952
|
29 |
* or <http://www.sourcemod.net/license.php>. |
|
ds@1952
|
30 |
* |
|
ds@1952
|
31 |
* Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $ |
|
ds@1952
|
32 |
*/ |
|
ds@1952
|
33 |
|
|
ds@1952
|
34 |
enum CommType |
|
ds@1952
|
35 |
{ |
|
ds@1952
|
36 |
CommType_Mute, |
|
ds@1952
|
37 |
CommType_UnMute, |
|
ds@1952
|
38 |
CommType_Gag, |
|
ds@1952
|
39 |
CommType_UnGag, |
|
ds@1952
|
40 |
CommType_Silence, |
|
ds@1952
|
41 |
CommType_UnSilence |
|
ds@1952
|
42 |
}; |
|
ds@1952
|
43 |
|
|
ds@1952
|
44 |
DisplayGagTypesMenu(client) |
|
ds@1952
|
45 |
{ |
|
ds@1952
|
46 |
new Handle:menu = CreateMenu(MenuHandler_GagTypes); |
|
ds@1952
|
47 |
|
|
ds@1952
|
48 |
decl String:title[100]; |
|
ds@1952
|
49 |
Format(title, sizeof(title), "%T:", "Choose Type", client); |
|
ds@1952
|
50 |
SetMenuTitle(menu, title); |
|
ds@1952
|
51 |
SetMenuExitBackButton(menu, true); |
|
ds@1952
|
52 |
|
|
ds@1952
|
53 |
new target = g_GagTarget[client]; |
|
ds@1952
|
54 |
|
|
ds@1952
|
55 |
if (!g_Muted[target]) |
|
ds@1952
|
56 |
{ |
|
ds@1952
|
57 |
AddMenuItem(menu, "0", "Mute Player"); |
|
ds@1952
|
58 |
} |
|
ds@1952
|
59 |
else |
|
ds@1952
|
60 |
{ |
|
ds@1952
|
61 |
AddMenuItem(menu, "1", "UnMute Player"); |
|
ds@1952
|
62 |
} |
|
ds@1952
|
63 |
|
|
ds@1952
|
64 |
if (!g_Gagged[target]) |
|
ds@1952
|
65 |
{ |
|
ds@1952
|
66 |
AddMenuItem(menu, "2", "Gag Player"); |
|
ds@1952
|
67 |
} |
|
ds@1952
|
68 |
else |
|
ds@1952
|
69 |
{ |
|
ds@1952
|
70 |
AddMenuItem(menu, "3", "UnGag Player"); |
|
ds@1952
|
71 |
} |
|
ds@1952
|
72 |
|
|
ds@1952
|
73 |
if (!g_Muted[target] || !g_Gagged[target]) |
|
ds@1952
|
74 |
{ |
|
ds@1952
|
75 |
AddMenuItem(menu, "4", "Silence Player"); |
|
ds@1952
|
76 |
} |
|
ds@1952
|
77 |
else |
|
ds@1952
|
78 |
{ |
|
ds@1952
|
79 |
AddMenuItem(menu, "5", "UnSilence Player"); |
|
ds@1952
|
80 |
} |
|
ds@1952
|
81 |
|
|
ds@1952
|
82 |
DisplayMenu(menu, client, MENU_TIME_FOREVER); |
|
ds@1952
|
83 |
} |
|
ds@1952
|
84 |
|
|
ds@1952
|
85 |
DisplayGagPlayerMenu(client) |
|
ds@1952
|
86 |
{ |
|
ds@1952
|
87 |
new Handle:menu = CreateMenu(MenuHandler_GagPlayer); |
|
ds@1952
|
88 |
|
|
ds@1952
|
89 |
decl String:title[100]; |
|
ds@1952
|
90 |
Format(title, sizeof(title), "%T:", "Gag/Mute player", client); |
|
ds@1952
|
91 |
SetMenuTitle(menu, title); |
|
ds@1952
|
92 |
SetMenuExitBackButton(menu, true); |
|
ds@1952
|
93 |
|
|
ds@1952
|
94 |
AddTargetsToMenu(menu, client, true, false); |
|
ds@1952
|
95 |
|
|
ds@1952
|
96 |
DisplayMenu(menu, client, MENU_TIME_FOREVER); |
|
ds@1952
|
97 |
} |
|
ds@1952
|
98 |
|
|
ds@1952
|
99 |
public AdminMenu_Gag(Handle:topmenu, |
|
ds@1952
|
100 |
TopMenuAction:action, |
|
ds@1952
|
101 |
TopMenuObject:object_id, |
|
ds@1952
|
102 |
param, |
|
ds@1952
|
103 |
String:buffer[], |
|
ds@1952
|
104 |
maxlength) |
|
ds@1952
|
105 |
{ |
|
ds@1952
|
106 |
if (action == TopMenuAction_DisplayOption) |
|
ds@1952
|
107 |
{ |
|
ds@1952
|
108 |
Format(buffer, maxlength, "%T", "Gag/Mute player", param); |
|
ds@1952
|
109 |
} |
|
ds@1952
|
110 |
else if (action == TopMenuAction_SelectOption) |
|
ds@1952
|
111 |
{ |
|
ds@1952
|
112 |
DisplayGagPlayerMenu(param); |
|
ds@1952
|
113 |
} |
|
ds@1952
|
114 |
} |
|
ds@1952
|
115 |
|
|
ds@1952
|
116 |
public MenuHandler_GagPlayer(Handle:menu, MenuAction:action, param1, param2) |
|
ds@1952
|
117 |
{ |
|
ds@1952
|
118 |
if (action == MenuAction_End) |
|
ds@1952
|
119 |
{ |
|
ds@1952
|
120 |
CloseHandle(menu); |
|
ds@1952
|
121 |
} |
|
ds@1952
|
122 |
else if (action == MenuAction_Cancel) |
|
ds@1952
|
123 |
{ |
|
ds@1952
|
124 |
if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE) |
|
ds@1952
|
125 |
{ |
|
ds@1952
|
126 |
DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory); |
|
ds@1952
|
127 |
} |
|
ds@1952
|
128 |
} |
|
ds@1952
|
129 |
else if (action == MenuAction_Select) |
|
ds@1952
|
130 |
{ |
|
ds@1952
|
131 |
decl String:info[32]; |
|
ds@1952
|
132 |
new userid, target; |
|
ds@1952
|
133 |
|
|
ds@1952
|
134 |
GetMenuItem(menu, param2, info, sizeof(info)); |
|
ds@1952
|
135 |
userid = StringToInt(info); |
|
ds@1952
|
136 |
|
|
ds@1952
|
137 |
if ((target = GetClientOfUserId(userid)) == 0) |
|
ds@1952
|
138 |
{ |
|
ds@1952
|
139 |
PrintToChat(param1, "[SM] %t", "Player no longer available"); |
|
ds@1952
|
140 |
} |
|
ds@1952
|
141 |
else if (!CanUserTarget(param1, target)) |
|
ds@1952
|
142 |
{ |
|
ds@1952
|
143 |
PrintToChat(param1, "[SM] %t", "Unable to target"); |
|
ds@1952
|
144 |
} |
|
ds@1952
|
145 |
else |
|
ds@1952
|
146 |
{ |
|
ds@1952
|
147 |
g_GagTarget[param1] = GetClientOfUserId(userid); |
|
ds@1952
|
148 |
DisplayGagTypesMenu(param1); |
|
ds@1952
|
149 |
} |
|
ds@1952
|
150 |
} |
|
ds@1952
|
151 |
} |
|
ds@1952
|
152 |
|
|
ds@1952
|
153 |
public MenuHandler_GagTypes(Handle:menu, MenuAction:action, param1, param2) |
|
ds@1952
|
154 |
{ |
|
ds@1952
|
155 |
if (action == MenuAction_End) |
|
ds@1952
|
156 |
{ |
|
ds@1952
|
157 |
CloseHandle(menu); |
|
ds@1952
|
158 |
} |
|
ds@1952
|
159 |
else if (action == MenuAction_Cancel) |
|
ds@1952
|
160 |
{ |
|
ds@1952
|
161 |
if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE) |
|
ds@1952
|
162 |
{ |
|
ds@1952
|
163 |
DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory); |
|
ds@1952
|
164 |
} |
|
ds@1952
|
165 |
} |
|
ds@1952
|
166 |
else if (action == MenuAction_Select) |
|
ds@1952
|
167 |
{ |
|
ds@1952
|
168 |
decl String:info[32]; |
|
ds@1952
|
169 |
new CommType:type; |
|
ds@1952
|
170 |
|
|
ds@1952
|
171 |
GetMenuItem(menu, param2, info, sizeof(info)); |
|
ds@1952
|
172 |
type = CommType:StringToInt(info); |
|
ds@1952
|
173 |
|
|
ds@1952
|
174 |
decl String:name[MAX_NAME_LENGTH]; |
|
ds@1952
|
175 |
GetClientName(g_GagTarget[param1], name, sizeof(name)); |
|
ds@1952
|
176 |
|
|
ds@1952
|
177 |
switch (type) |
|
ds@1952
|
178 |
{ |
|
ds@1952
|
179 |
case CommType_Mute: |
|
ds@1952
|
180 |
{ |
|
ds@1952
|
181 |
PerformMute(param1, g_GagTarget[param1]); |
|
ds@1952
|
182 |
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name); |
|
ds@1952
|
183 |
} |
|
ds@1952
|
184 |
case CommType_UnMute: |
|
ds@1952
|
185 |
{ |
|
ds@1952
|
186 |
PerformUnMute(param1, g_GagTarget[param1]); |
|
ds@1952
|
187 |
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name); |
|
ds@1952
|
188 |
} |
|
ds@1952
|
189 |
case CommType_Gag: |
|
ds@1952
|
190 |
{ |
|
ds@1952
|
191 |
PerformGag(param1, g_GagTarget[param1]); |
|
ds@1952
|
192 |
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name); |
|
ds@1952
|
193 |
} |
|
ds@1952
|
194 |
case CommType_UnGag: |
|
ds@1952
|
195 |
{ |
|
ds@1952
|
196 |
PerformUnGag(param1, g_GagTarget[param1]); |
|
ds@1952
|
197 |
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name); |
|
ds@1952
|
198 |
} |
|
ds@1952
|
199 |
case CommType_Silence: |
|
ds@1952
|
200 |
{ |
|
ds@1952
|
201 |
PerformSilence(param1, g_GagTarget[param1]); |
|
ds@1952
|
202 |
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name); |
|
ds@1952
|
203 |
} |
|
ds@1952
|
204 |
case CommType_UnSilence: |
|
ds@1952
|
205 |
{ |
|
ds@1952
|
206 |
PerformUnSilence(param1, g_GagTarget[param1]); |
|
ds@1952
|
207 |
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name); |
|
ds@1952
|
208 |
} |
|
ds@1952
|
209 |
} |
|
ds@1952
|
210 |
} |
|
ds@1952
|
211 |
} |
|
ds@1952
|
212 |
|
|
ds@1952
|
213 |
PerformMute(client, target) |
|
ds@1952
|
214 |
{ |
|
ds@1952
|
215 |
g_Muted[target] = true; |
|
ds@1952
|
216 |
SetClientListeningFlags(target, VOICE_MUTED); |
|
ds@1952
|
217 |
LogAction(client, target, "\"%L\" muted \"%L\"", client, target); |
|
ds@1952
|
218 |
} |
|
ds@1952
|
219 |
|
|
ds@1952
|
220 |
PerformUnMute(client, target) |
|
ds@1952
|
221 |
{ |
|
ds@1952
|
222 |
g_Muted[target] = false; |
|
ds@1952
|
223 |
if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target)) |
|
ds@1952
|
224 |
{ |
|
ds@1952
|
225 |
SetClientListeningFlags(target, VOICE_LISTENALL); |
|
ds@1952
|
226 |
} |
|
ds@1952
|
227 |
else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target)) |
|
ds@1952
|
228 |
{ |
|
ds@1952
|
229 |
SetClientListeningFlags(target, VOICE_TEAM); |
|
ds@1952
|
230 |
} |
|
ds@1952
|
231 |
else |
|
ds@1952
|
232 |
{ |
|
ds@1952
|
233 |
SetClientListeningFlags(target, VOICE_NORMAL); |
|
ds@1952
|
234 |
} |
|
ds@1952
|
235 |
|
|
ds@1952
|
236 |
LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target); |
|
ds@1952
|
237 |
} |
|
ds@1952
|
238 |
|
|
ds@1952
|
239 |
PerformGag(client, target) |
|
ds@1952
|
240 |
{ |
|
ds@1952
|
241 |
g_Gagged[target] = true; |
|
ds@1952
|
242 |
LogAction(client, target, "\"%L\" gagged \"%L\"", client, target); |
|
ds@1952
|
243 |
} |
|
ds@1952
|
244 |
|
|
ds@1952
|
245 |
PerformUnGag(client, target) |
|
ds@1952
|
246 |
{ |
|
ds@1952
|
247 |
g_Gagged[target] = false; |
|
ds@1952
|
248 |
LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target); |
|
ds@1952
|
249 |
} |
|
ds@1952
|
250 |
|
|
ds@1952
|
251 |
PerformSilence(client, target) |
|
ds@1952
|
252 |
{ |
|
ds@1952
|
253 |
if (!g_Gagged[target]) |
|
ds@1952
|
254 |
{ |
|
ds@1952
|
255 |
g_Gagged[target] = true; |
|
ds@1952
|
256 |
} |
|
ds@1952
|
257 |
|
|
ds@1952
|
258 |
if (!g_Muted[target]) |
|
ds@1952
|
259 |
{ |
|
ds@1952
|
260 |
g_Muted[target] = true; |
|
ds@1952
|
261 |
SetClientListeningFlags(target, VOICE_MUTED); |
|
ds@1952
|
262 |
} |
|
ds@1952
|
263 |
|
|
ds@1952
|
264 |
LogAction(client, target, "\"%L\" silenced \"%L\"", client, target); |
|
ds@1952
|
265 |
} |
|
ds@1952
|
266 |
|
|
ds@1952
|
267 |
PerformUnSilence(client, target) |
|
ds@1952
|
268 |
{ |
|
ds@1952
|
269 |
if (g_Gagged[target]) |
|
ds@1952
|
270 |
{ |
|
ds@1952
|
271 |
g_Gagged[target] = false; |
|
ds@1952
|
272 |
} |
|
ds@1952
|
273 |
|
|
ds@1952
|
274 |
if (g_Muted[target]) |
|
ds@1952
|
275 |
{ |
|
ds@1952
|
276 |
g_Muted[target] = false; |
|
ds@1952
|
277 |
|
|
ds@1952
|
278 |
if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target)) |
|
ds@1952
|
279 |
{ |
|
ds@1952
|
280 |
SetClientListeningFlags(target, VOICE_LISTENALL); |
|
ds@1952
|
281 |
} |
|
ds@1952
|
282 |
else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target)) |
|
ds@1952
|
283 |
{ |
|
ds@1952
|
284 |
SetClientListeningFlags(target, VOICE_TEAM); |
|
ds@1952
|
285 |
} |
|
ds@1952
|
286 |
else |
|
ds@1952
|
287 |
{ |
|
ds@1952
|
288 |
SetClientListeningFlags(target, VOICE_NORMAL); |
|
ds@1952
|
289 |
} |
|
ds@1952
|
290 |
} |
|
ds@1952
|
291 |
|
|
ds@1952
|
292 |
LogAction(client, target, "\"%L\" unsilenced \"%L\"", client, target); |
|
ds@1952
|
293 |
} |
|
ds@1952
|
294 |
|
|
ds@1952
|
295 |
public Action:Command_Mute(client, args) |
|
ds@1952
|
296 |
{ |
|
ds@1952
|
297 |
if (args < 1) |
|
ds@1952
|
298 |
{ |
|
ds@1952
|
299 |
ReplyToCommand(client, "[SM] Usage: sm_mute <player>"); |
|
ds@1952
|
300 |
return Plugin_Handled; |
|
ds@1952
|
301 |
} |
|
ds@1952
|
302 |
|
|
ds@1952
|
303 |
decl String:arg[64]; |
|
ds@1952
|
304 |
GetCmdArg(1, arg, sizeof(arg)); |
|
ds@1952
|
305 |
|
|
ds@1952
|
306 |
decl String:target_name[MAX_TARGET_LENGTH]; |
|
ds@1952
|
307 |
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; |
|
ds@1952
|
308 |
|
|
ds@1952
|
309 |
if ((target_count = ProcessTargetString( |
|
ds@1952
|
310 |
arg, |
|
ds@1952
|
311 |
client, |
|
ds@1952
|
312 |
target_list, |
|
ds@1952
|
313 |
MAXPLAYERS, |
|
ds@1952
|
314 |
0, |
|
ds@1952
|
315 |
target_name, |
|
ds@1952
|
316 |
sizeof(target_name), |
|
ds@1952
|
317 |
tn_is_ml)) <= 0) |
|
ds@1952
|
318 |
{ |
|
ds@1952
|
319 |
ReplyToTargetError(client, target_count); |
|
ds@1952
|
320 |
return Plugin_Handled; |
|
ds@1952
|
321 |
} |
|
ds@1952
|
322 |
|
|
ds@1952
|
323 |
for (new i = 0; i < target_count; i++) |
|
ds@1952
|
324 |
{ |
|
ds@1952
|
325 |
new target = target_list[i]; |
|
ds@1952
|
326 |
|
|
ds@1952
|
327 |
PerformMute(client, target); |
|
ds@1952
|
328 |
} |
|
ds@1952
|
329 |
|
|
ds@1952
|
330 |
if (tn_is_ml) |
|
ds@1952
|
331 |
{ |
|
ds@1952
|
332 |
ShowActivity2(client, "[SM] ", "%t", "Muted target", target_name); |
|
ds@1952
|
333 |
} |
|
ds@1952
|
334 |
else |
|
ds@1952
|
335 |
{ |
|
ds@1952
|
336 |
ShowActivity2(client, "[SM] ", "%t", "Muted target", "_s", target_name); |
|
ds@1952
|
337 |
} |
|
ds@1952
|
338 |
|
|
ds@1952
|
339 |
return Plugin_Handled; |
|
ds@1952
|
340 |
} |
|
ds@1952
|
341 |
|
|
ds@1952
|
342 |
public Action:Command_Gag(client, args) |
|
ds@1952
|
343 |
{ |
|
ds@1952
|
344 |
if (args < 1) |
|
ds@1952
|
345 |
{ |
|
ds@1952
|
346 |
ReplyToCommand(client, "[SM] Usage: sm_gag <player>"); |
|
ds@1952
|
347 |
return Plugin_Handled; |
|
ds@1952
|
348 |
} |
|
ds@1952
|
349 |
|
|
ds@1952
|
350 |
decl String:arg[64]; |
|
ds@1952
|
351 |
GetCmdArg(1, arg, sizeof(arg)); |
|
ds@1952
|
352 |
|
|
ds@1952
|
353 |
decl String:target_name[MAX_TARGET_LENGTH]; |
|
ds@1952
|
354 |
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; |
|
ds@1952
|
355 |
|
|
ds@1952
|
356 |
if ((target_count = ProcessTargetString( |
|
ds@1952
|
357 |
arg, |
|
ds@1952
|
358 |
client, |
|
ds@1952
|
359 |
target_list, |
|
ds@1952
|
360 |
MAXPLAYERS, |
|
ds@1952
|
361 |
0, |
|
ds@1952
|
362 |
target_name, |
|
ds@1952
|
363 |
sizeof(target_name), |
|
ds@1952
|
364 |
tn_is_ml)) <= 0) |
|
ds@1952
|
365 |
{ |
|
ds@1952
|
366 |
ReplyToTargetError(client, target_count); |
|
ds@1952
|
367 |
return Plugin_Handled; |
|
ds@1952
|
368 |
} |
|
ds@1952
|
369 |
|
|
ds@1952
|
370 |
for (new i = 0; i < target_count; i++) |
|
ds@1952
|
371 |
{ |
|
ds@1952
|
372 |
new target = target_list[i]; |
|
ds@1952
|
373 |
|
|
ds@1952
|
374 |
PerformGag(client, target); |
|
ds@1952
|
375 |
} |
|
ds@1952
|
376 |
|
|
ds@1952
|
377 |
if (tn_is_ml) |
|
ds@1952
|
378 |
{ |
|
ds@1952
|
379 |
ShowActivity2(client, "[SM] ", "%t", "Gagged target", target_name); |
|
ds@1952
|
380 |
} |
|
ds@1952
|
381 |
else |
|
ds@1952
|
382 |
{ |
|
ds@1952
|
383 |
ShowActivity2(client, "[SM] ", "%t", "Gagged target", "_s", target_name); |
|
ds@1952
|
384 |
} |
|
ds@1952
|
385 |
|
|
ds@1952
|
386 |
return Plugin_Handled; |
|
ds@1952
|
387 |
} |
|
ds@1952
|
388 |
|
|
ds@1952
|
389 |
public Action:Command_Silence(client, args) |
|
ds@1952
|
390 |
{ |
|
ds@1952
|
391 |
if (args < 1) |
|
ds@1952
|
392 |
{ |
|
ds@1952
|
393 |
ReplyToCommand(client, "[SM] Usage: sm_silence <player>"); |
|
ds@1952
|
394 |
return Plugin_Handled; |
|
ds@1952
|
395 |
} |
|
ds@1952
|
396 |
|
|
ds@1952
|
397 |
decl String:arg[64]; |
|
ds@1952
|
398 |
GetCmdArg(1, arg, sizeof(arg)); |
|
ds@1952
|
399 |
|
|
ds@1952
|
400 |
decl String:target_name[MAX_TARGET_LENGTH]; |
|
ds@1952
|
401 |
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; |
|
ds@1952
|
402 |
|
|
ds@1952
|
403 |
if ((target_count = ProcessTargetString( |
|
ds@1952
|
404 |
arg, |
|
ds@1952
|
405 |
client, |
|
ds@1952
|
406 |
target_list, |
|
ds@1952
|
407 |
MAXPLAYERS, |
|
ds@1952
|
408 |
0, |
|
ds@1952
|
409 |
target_name, |
|
ds@1952
|
410 |
sizeof(target_name), |
|
ds@1952
|
411 |
tn_is_ml)) <= 0) |
|
ds@1952
|
412 |
{ |
|
ds@1952
|
413 |
ReplyToTargetError(client, target_count); |
|
ds@1952
|
414 |
return Plugin_Handled; |
|
ds@1952
|
415 |
} |
|
ds@1952
|
416 |
|
|
ds@1952
|
417 |
for (new i = 0; i < target_count; i++) |
|
ds@1952
|
418 |
{ |
|
ds@1952
|
419 |
new target = target_list[i]; |
|
ds@1952
|
420 |
|
|
ds@1952
|
421 |
PerformSilence(client, target); |
|
ds@1952
|
422 |
} |
|
ds@1952
|
423 |
|
|
ds@1952
|
424 |
if (tn_is_ml) |
|
ds@1952
|
425 |
{ |
|
ds@1952
|
426 |
ShowActivity2(client, "[SM] ", "%t", "Silenced target", target_name); |
|
ds@1952
|
427 |
} |
|
ds@1952
|
428 |
else |
|
ds@1952
|
429 |
{ |
|
ds@1952
|
430 |
ShowActivity2(client, "[SM] ", "%t", "Silenced target", "_s", target_name); |
|
ds@1952
|
431 |
} |
|
ds@1952
|
432 |
|
|
ds@1952
|
433 |
return Plugin_Handled; |
|
ds@1952
|
434 |
} |
|
ds@1952
|
435 |
|
|
ds@1952
|
436 |
public Action:Command_Unmute(client, args) |
|
ds@1952
|
437 |
{ |
|
ds@1952
|
438 |
if (args < 1) |
|
ds@1952
|
439 |
{ |
|
ds@1952
|
440 |
ReplyToCommand(client, "[SM] Usage: sm_unmute <player>"); |
|
ds@1952
|
441 |
return Plugin_Handled; |
|
ds@1952
|
442 |
} |
|
ds@1952
|
443 |
|
|
ds@1952
|
444 |
decl String:arg[64]; |
|
ds@1952
|
445 |
GetCmdArg(1, arg, sizeof(arg)); |
|
ds@1952
|
446 |
|
|
ds@1952
|
447 |
decl String:target_name[MAX_TARGET_LENGTH]; |
|
ds@1952
|
448 |
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; |
|
ds@1952
|
449 |
|
|
ds@1952
|
450 |
if ((target_count = ProcessTargetString( |
|
ds@1952
|
451 |
arg, |
|
ds@1952
|
452 |
client, |
|
ds@1952
|
453 |
target_list, |
|
ds@1952
|
454 |
MAXPLAYERS, |
|
ds@1952
|
455 |
0, |
|
ds@1952
|
456 |
target_name, |
|
ds@1952
|
457 |
sizeof(target_name), |
|
ds@1952
|
458 |
tn_is_ml)) <= 0) |
|
ds@1952
|
459 |
{ |
|
ds@1952
|
460 |
ReplyToTargetError(client, target_count); |
|
ds@1952
|
461 |
return Plugin_Handled; |
|
ds@1952
|
462 |
} |
|
ds@1952
|
463 |
|
|
ds@1952
|
464 |
for (new i = 0; i < target_count; i++) |
|
ds@1952
|
465 |
{ |
|
ds@1952
|
466 |
new target = target_list[i]; |
|
ds@1952
|
467 |
|
|
ds@1952
|
468 |
if (!g_Muted[target]) |
|
ds@1952
|
469 |
{ |
|
ds@1952
|
470 |
continue; |
|
ds@1952
|
471 |
} |
|
ds@1952
|
472 |
|
|
ds@1952
|
473 |
PerformUnMute(client, target); |
|
ds@1952
|
474 |
} |
|
ds@1952
|
475 |
|
|
ds@1952
|
476 |
if (tn_is_ml) |
|
ds@1952
|
477 |
{ |
|
ds@1952
|
478 |
ShowActivity2(client, "[SM] ", "%t", "Unmuted target", target_name); |
|
ds@1952
|
479 |
} |
|
ds@1952
|
480 |
else |
|
ds@1952
|
481 |
{ |
|
ds@1952
|
482 |
ShowActivity2(client, "[SM] ", "%t", "Unmuted target", "_s", target_name); |
|
ds@1952
|
483 |
} |
|
ds@1952
|
484 |
|
|
ds@1952
|
485 |
return Plugin_Handled; |
|
ds@1952
|
486 |
} |
|
ds@1952
|
487 |
|
|
ds@1952
|
488 |
public Action:Command_Ungag(client, args) |
|
ds@1952
|
489 |
{ |
|
ds@1952
|
490 |
if (args < 1) |
|
ds@1952
|
491 |
{ |
|
ds@1952
|
492 |
ReplyToCommand(client, "[SM] Usage: sm_ungag <player>"); |
|
ds@1952
|
493 |
return Plugin_Handled; |
|
ds@1952
|
494 |
} |
|
ds@1952
|
495 |
|
|
ds@1952
|
496 |
decl String:arg[64]; |
|
ds@1952
|
497 |
GetCmdArg(1, arg, sizeof(arg)); |
|
ds@1952
|
498 |
|
|
ds@1952
|
499 |
decl String:target_name[MAX_TARGET_LENGTH]; |
|
ds@1952
|
500 |
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; |
|
ds@1952
|
501 |
|
|
ds@1952
|
502 |
if ((target_count = ProcessTargetString( |
|
ds@1952
|
503 |
arg, |
|
ds@1952
|
504 |
client, |
|
ds@1952
|
505 |
target_list, |
|
ds@1952
|
506 |
MAXPLAYERS, |
|
ds@1952
|
507 |
0, |
|
ds@1952
|
508 |
target_name, |
|
ds@1952
|
509 |
sizeof(target_name), |
|
ds@1952
|
510 |
tn_is_ml)) <= 0) |
|
ds@1952
|
511 |
{ |
|
ds@1952
|
512 |
ReplyToTargetError(client, target_count); |
|
ds@1952
|
513 |
return Plugin_Handled; |
|
ds@1952
|
514 |
} |
|
ds@1952
|
515 |
|
|
ds@1952
|
516 |
for (new i = 0; i < target_count; i++) |
|
ds@1952
|
517 |
{ |
|
ds@1952
|
518 |
new target = target_list[i]; |
|
ds@1952
|
519 |
|
|
ds@1952
|
520 |
PerformUnGag(client, target); |
|
ds@1952
|
521 |
} |
|
ds@1952
|
522 |
|
|
ds@1952
|
523 |
if (tn_is_ml) |
|
ds@1952
|
524 |
{ |
|
ds@1952
|
525 |
ShowActivity2(client, "[SM] ", "%t", "Ungagged target", target_name); |
|
ds@1952
|
526 |
} |
|
ds@1952
|
527 |
else |
|
ds@1952
|
528 |
{ |
|
ds@1952
|
529 |
ShowActivity2(client, "[SM] ", "%t", "Ungagged target", "_s", target_name); |
|
ds@1952
|
530 |
} |
|
ds@1952
|
531 |
|
|
ds@1952
|
532 |
return Plugin_Handled; |
|
ds@1952
|
533 |
} |
|
ds@1952
|
534 |
|
|
ds@1952
|
535 |
public Action:Command_Unsilence(client, args) |
|
ds@1952
|
536 |
{ |
|
ds@1952
|
537 |
if (args < 1) |
|
ds@1952
|
538 |
{ |
|
ds@1952
|
539 |
ReplyToCommand(client, "[SM] Usage: sm_unsilence <player>"); |
|
ds@1952
|
540 |
return Plugin_Handled; |
|
ds@1952
|
541 |
} |
|
ds@1952
|
542 |
|
|
ds@1952
|
543 |
decl String:arg[64]; |
|
ds@1952
|
544 |
GetCmdArg(1, arg, sizeof(arg)); |
|
ds@1952
|
545 |
|
|
ds@1952
|
546 |
decl String:target_name[MAX_TARGET_LENGTH]; |
|
ds@1952
|
547 |
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; |
|
ds@1952
|
548 |
|
|
ds@1952
|
549 |
if ((target_count = ProcessTargetString( |
|
ds@1952
|
550 |
arg, |
|
ds@1952
|
551 |
client, |
|
ds@1952
|
552 |
target_list, |
|
ds@1952
|
553 |
MAXPLAYERS, |
|
ds@1952
|
554 |
0, |
|
ds@1952
|
555 |
target_name, |
|
ds@1952
|
556 |
sizeof(target_name), |
|
ds@1952
|
557 |
tn_is_ml)) <= 0) |
|
ds@1952
|
558 |
{ |
|
ds@1952
|
559 |
ReplyToTargetError(client, target_count); |
|
ds@1952
|
560 |
return Plugin_Handled; |
|
ds@1952
|
561 |
} |
|
ds@1952
|
562 |
|
|
ds@1952
|
563 |
for (new i = 0; i < target_count; i++) |
|
ds@1952
|
564 |
{ |
|
ds@1952
|
565 |
new target = target_list[i]; |
|
ds@1952
|
566 |
|
|
ds@1952
|
567 |
PerformUnSilence(client, target); |
|
ds@1952
|
568 |
} |
|
ds@1952
|
569 |
|
|
ds@1952
|
570 |
if (tn_is_ml) |
|
ds@1952
|
571 |
{ |
|
ds@1952
|
572 |
ShowActivity2(client, "[SM] ", "%t", "Unsilenced target", target_name); |
|
ds@1952
|
573 |
} |
|
ds@1952
|
574 |
else |
|
ds@1952
|
575 |
{ |
|
ds@1952
|
576 |
ShowActivity2(client, "[SM] ", "%t", "Unsilenced target", "_s", target_name); |
|
ds@1952
|
577 |
} |
|
ds@1952
|
578 |
|
|
ds@1952
|
579 |
return Plugin_Handled; |
|
ds@1952
|
580 |
} |