SHOW:
|
|
- or go back to the newest paste.
1 | /* Plugin generated by AMXX-Studio */ | |
2 | ||
3 | #include <amxmodx> | |
4 | #include <amxmisc> | |
5 | #include <cstrike> | |
6 | #include <fun> | |
7 | #include <hamsandwich> | |
8 | #include <fakemeta> | |
9 | #include <engine> | |
10 | ||
11 | #define PLUGIN "CS-Menu" | |
12 | #define VERSION "1.0" | |
13 | #define AUTHOR "Mostwanted" | |
14 | ||
15 | #define TAG "[CS]Admin" | |
16 | #define TAG2 "[CS]Member" | |
17 | #define Website "Coming Soon" | |
18 | #define menusize 300 | |
19 | //#define SoundName "Vote" | |
20 | ||
21 | // Reden (Voor kick, slay,..) | |
22 | new TotalReasons = 12 | |
23 | new const REDEN[][64] = { | |
24 | "Abuse", | |
25 | "Racism", | |
26 | "Advertisement", | |
27 | "Bug Using", | |
28 | "Harrasment", | |
29 | "Blocking", | |
30 | "Screaming in mic", | |
31 | "FunJump", | |
32 | "Understab", | |
33 | "Undercamp", | |
34 | "Scripts", | |
35 | "Rule Breaker" | |
36 | } | |
37 | ||
38 | // Namen, voor Bb | |
39 | new const BsNames[][64] = { | |
40 | "[C-S-Admin]", // ADMIN_LEVEL_A -> m | |
41 | "[C-S-Mini Admin]" // ADMIN_LEVEL_C -> o | |
42 | } | |
43 | new cStatus, cBanTime, cNoclipTime, cDamage, cQuadDmgTime, cMuteTime; | |
44 | new g_msgFade; | |
45 | new Name[33], Reason[33], Style[33], Num[33], QuadDamage[33], tTransfer[33]; | |
46 | new cVoting,cVotetype,cVoteYes,cVoteNo, bool:is_muted[33] | |
47 | ||
48 | public plugin_init() { | |
49 | register_plugin(PLUGIN, VERSION, AUTHOR) | |
50 | ||
51 | /* Cvar's */ | |
52 | cStatus = register_cvar("Collusion_status" , "1"); | |
53 | cDamage = register_cvar("Collusion_damage" , "2.0"); | |
54 | // Times | |
55 | cBanTime = register_cvar("Collusion_bantime" , "60.0"); | |
56 | cNoclipTime = register_cvar("Collusion_nocliptime", "10.0"); | |
57 | cQuadDmgTime = register_cvar("Collusion_quaddmgtime", "15.0"); | |
58 | cMuteTime = register_cvar("Collusion_mutetime" , "600.0"); | |
59 | ||
60 | /* Say Commands */ | |
61 | register_clcmd("say csmenu", "cmdShowMenu", -1, "- Displays cg menu") | |
62 | register_clcmd("say csmenu", "cmdShowMenu", -1, "- Displays cg menu") | |
63 | register_clcmd("say_team cspmenu", "cmdShowMenu", -1, "- Displays cg menu") | |
64 | ||
65 | /* Ham */ | |
66 | RegisterHam(Ham_Spawn, "player" , "PlayerSpawn", 1); | |
67 | RegisterHam(Ham_TakeDamage, "player" , "PlayerDamage"); | |
68 | ||
69 | /* Other Stuff */ | |
70 | g_msgFade = get_user_msgid("ScreenFade"); | |
71 | ||
72 | /* Menu Register */ | |
73 | register_menucmd(register_menuid("\dmTc:"), (1<<0|1<<1),"VoteMenu"); | |
74 | } | |
75 | public client_connect(id) | |
76 | tTransfer[id]=0 | |
77 | /* | |
78 | mTc: | |
79 | - Menu's | |
80 | */ | |
81 | public cmdShowMenu(id) { | |
82 | if(get_pcvar_num(cStatus) && is_user_connected(id)) { | |
83 | ScreenFadeIn(id) | |
84 | MainMenu(id) | |
85 | } | |
86 | return PLUGIN_HANDLED; | |
87 | } | |
88 | public MainMenu(id) { | |
89 | new Temp[101] | |
90 | formatex(Temp,100, "\d%s\y: Main Menu^n\wVisit\r %s", TAG, Website) | |
91 | new menu = menu_create(Temp, "menuHandler"); | |
92 | if(access(id, ADMIN_LEVEL_A)) menu_additem(menu, "\rAdmin\w Menu", "1", 0); | |
93 | else menu_additem(menu, "\dAdmin\w Menu", "1", 0); | |
94 | if(access(id, ADMIN_LEVEL_C)) menu_additem(menu, "\rMember\w Menu", "2", 0); | |
95 | else menu_additem(menu, "\dMember\w Menu", "2", 0); | |
96 | menu_display(id, menu, 0) | |
97 | } | |
98 | public AdminMenu(id) { | |
99 | new Temp[64] | |
100 | formatex(Temp,63, "\d%s\y: Admin Menu", TAG) | |
101 | new Adminmenu = menu_create(Temp, "AdminmenuHandler"); | |
102 | menu_additem(Adminmenu, "\rSlap\w Player", "1", 0); | |
103 | menu_additem(Adminmenu, "\rSlay\w Player", "2", 0); | |
104 | menu_additem(Adminmenu, "\rKick\w Player", "3", 0); | |
105 | menu_additem(Adminmenu, "\rBan\w Player", "4", 0); | |
106 | menu_additem(Adminmenu, "\rRevive\w Players", "5", 0); | |
107 | menu_additem(Adminmenu, "\rGive Noclip" ,"6", 0); | |
108 | menu_display(id, Adminmenu, 0) | |
109 | ||
110 | } | |
111 | public MiniAdminMenu(id) { | |
112 | new Temp[101] | |
113 | formatex(Temp,100, "\d%s\y: Members Menu^n\wVisit\r %s", TAG, Website) | |
114 | new Membermenu = menu_create(Temp, "MembermenuHandler"); | |
115 | menu_additem(Membermenu, "\rSlap\w Player", "1", 0); | |
116 | menu_additem(Membermenu, "\rSlay\w Player", "2", 0); | |
117 | menu_additem(Membermenu, "\rBan 60min\w Player", "3", 0); | |
118 | menu_additem(Membermenu, "\rPlayer\w Transfer", "4", 0); | |
119 | menu_display(id, Membermenu, 0) | |
120 | } | |
121 | public menuHandler(id, menu, key) { | |
122 | if( key == MENU_EXIT ) { | |
123 | ScreenFadeOut(id) | |
124 | menu_destroy(menu) | |
125 | return PLUGIN_HANDLED | |
126 | } | |
127 | switch(key) { | |
128 | case 0: { | |
129 | if(access(id, ADMIN_LEVEL_A)) AdminMenu(id) | |
130 | else cmdShowMenu(id) | |
131 | } | |
132 | case 1: { | |
133 | if(access(id, ADMIN_LEVEL_C)) MiniAdminMenu(id) | |
134 | else cmdShowMenu(id) | |
135 | } | |
136 | } | |
137 | menu_destroy(menu) | |
138 | return PLUGIN_HANDLED | |
139 | } | |
140 | public AdminmenuHandler(id, menu, key) { | |
141 | if( key == MENU_EXIT ) { | |
142 | MainMenu(id) | |
143 | menu_destroy(menu); | |
144 | return PLUGIN_HANDLED | |
145 | } | |
146 | ||
147 | switch(key) { | |
148 | case 0: { | |
149 | Style[id] = 0 // Slap | |
150 | Num[id] = 0 | |
151 | PlayerList(id) | |
152 | } | |
153 | case 1: { | |
154 | Style[id] = 1 // Slay | |
155 | Num[id] = 0 | |
156 | PlayerList(id) | |
157 | } | |
158 | case 2: { | |
159 | Style[id] = 2 // Kick | |
160 | Num[id] = 0 | |
161 | PlayerList(id) | |
162 | } | |
163 | case 3: { | |
164 | Style[id] = 3 // Ban | |
165 | Num[id] = 0 | |
166 | PlayerList(id) | |
167 | } | |
168 | case 4: { | |
169 | Style[id] = 8 // Revive | |
170 | Num[id] = 0 | |
171 | PlayerList2(id) | |
172 | } | |
173 | case 5: SwapPlayers(id, 0) | |
174 | //case 6: MapChange(id, 0) | |
175 | case 7: { | |
176 | Style[id] = 6 // Give Noclip | |
177 | Num[id] = 0 | |
178 | PlayerList2(id) | |
179 | } | |
180 | case 8: { | |
181 | Style[id] = 7 // Give Glow | |
182 | Num[id] = 0 | |
183 | PlayerList2(id) | |
184 | } | |
185 | case 9: { | |
186 | Style[id] = 9 // Give Drug | |
187 | Num[id] = 0 | |
188 | PlayerList2(id) | |
189 | } | |
190 | } | |
191 | return PLUGIN_HANDLED; | |
192 | } | |
193 | public VipmenuHandler(id, menu, key) { | |
194 | if( key == MENU_EXIT ) { | |
195 | MainMenu(id) | |
196 | menu_destroy(menu); | |
197 | return PLUGIN_HANDLED | |
198 | } | |
199 | ||
200 | switch(key) { | |
201 | case 0:{ | |
202 | if(access(id, ADMIN_LEVEL_B)) { | |
203 | Style[id] = 0 | |
204 | Num[id] = 1 | |
205 | PlayerList(id) // Slap | |
206 | } | |
207 | else MainMenu(id) | |
208 | } | |
209 | case 1: { | |
210 | if(access(id, ADMIN_LEVEL_B)) { | |
211 | Style[id] = 1 | |
212 | Num[id] = 1 | |
213 | PlayerList(id) // Slay | |
214 | } | |
215 | else MainMenu(id) | |
216 | } | |
217 | case 2: { | |
218 | if(access(id, ADMIN_LEVEL_B)) { | |
219 | Num[id] = 1 | |
220 | showtransfermenu(id) | |
221 | } | |
222 | else MainMenu(id) | |
223 | } | |
224 | case 3: { | |
225 | if(access(id, ADMIN_LEVEL_B)) | |
226 | NoclipPlayer(id, 1) | |
227 | else MainMenu(id) | |
228 | } | |
229 | case 4: { | |
230 | if(access(id, ADMIN_LEVEL_B)) | |
231 | QuaddmgPlayer(id, 1) | |
232 | else MainMenu(id) | |
233 | } | |
234 | case 5: { | |
235 | if(access(id, ADMIN_LEVEL_B)) { | |
236 | if(is_user_alive(id)) | |
237 | WeaponpacketPlayer(id, 1) | |
238 | } | |
239 | else MainMenu(id) | |
240 | } | |
241 | case 6: { | |
242 | Style[id] = 4 | |
243 | Num[id] = 1 | |
244 | cVoting = 1 | |
245 | cVotetype = 1 | |
246 | PlayerList(id) //Vote Kick | |
247 | } | |
248 | case 7: { | |
249 | Style[id] = 4 | |
250 | Num[id] = 1 | |
251 | cVoting = 1 | |
252 | cVotetype = 2 | |
253 | PlayerList(id) //Vote Ban | |
254 | } | |
255 | case 8: { | |
256 | Style[id] = 4 | |
257 | Num[id] = 1 | |
258 | cVoting = 1 | |
259 | cVotetype = 3 | |
260 | PlayerList(id) //Vote Mute | |
261 | } | |
262 | //case 8: VoteMap(id) | |
263 | } | |
264 | menu_destroy(menu) | |
265 | return PLUGIN_HANDLED; | |
266 | } | |
267 | public MembermenuHandler(id, menu, key) { | |
268 | if( key == MENU_EXIT ) { | |
269 | ScreenFadeOut(id) | |
270 | MainMenu(id) | |
271 | menu_destroy(menu); | |
272 | return PLUGIN_HANDLED | |
273 | } | |
274 | ||
275 | switch(key) { | |
276 | case 0: { | |
277 | Style[id] = 0 // Slap | |
278 | Num[id] = 2 | |
279 | PlayerList(id) | |
280 | } | |
281 | case 1: { | |
282 | Style[id] = 1 // Slay | |
283 | Num[id] = 2 | |
284 | PlayerList(id) | |
285 | } | |
286 | case 2: { | |
287 | Style[id] = 2 // Kick | |
288 | Num[id] = 2 | |
289 | PlayerList(id) | |
290 | } | |
291 | case 3: { | |
292 | Style[id] = 3 // Ban | |
293 | Num[id] = 2 | |
294 | PlayerList(id) | |
295 | } | |
296 | case 4: { | |
297 | Num[id] = 2 | |
298 | showtransfermenu(id) | |
299 | } | |
300 | //case 5: VoteMapChange(id, 0) | |
301 | } | |
302 | return PLUGIN_HANDLED; | |
303 | } | |
304 | // Team Transfer | |
305 | public showtransfermenu(id) { | |
306 | new menu = menu_create("\dmTc:\y Transfer Menu", "TransferMenu"); | |
307 | ||
308 | new players[32], name[32], pnum, player; | |
309 | new szplayer[6] | |
310 | get_players(players,pnum) | |
311 | ||
312 | switch(tTransfer[id]) { | |
313 | case 0:menu_additem(menu, "\r Counter Terrorist^n", "0", 0); | |
314 | case 1:menu_additem(menu, "\r Terrorist^n", "0", 0); | |
315 | case 2:menu_additem(menu, "\r Spectator^n", "0", 0); | |
316 | } | |
317 | ||
318 | for( new i; i<pnum; i++ ) { | |
319 | player = players[i] | |
320 | if((tTransfer[id] == 0 && cs_get_user_team(player) == CS_TEAM_CT) | |
321 | || (tTransfer[id] == 1 && cs_get_user_team(player) == CS_TEAM_T) | |
322 | || (tTransfer[id] == 2 && cs_get_user_team(player) == CS_TEAM_SPECTATOR)) | |
323 | continue; | |
324 | else { | |
325 | get_user_name(players[i],name,31) | |
326 | num_to_str(player,szplayer,5) | |
327 | menu_additem(menu, name, szplayer, 0); | |
328 | } | |
329 | } | |
330 | ||
331 | menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); | |
332 | menu_display(id, menu, 0); | |
333 | } | |
334 | /* | |
335 | CG: | |
336 | - Slap Player | |
337 | - Slay Player | |
338 | - Kick Player | |
339 | - Ban Player | |
340 | - Swap Teams | |
341 | - Quad Damage | |
342 | - WeaponPacket | |
343 | - NoClip | |
344 | - Glow Player | |
345 | - TransferPlayer | |
346 | - Map Change | |
347 | */ | |
348 | public SlapPlayer(id, num) { | |
349 | new name[32], name2[32] | |
350 | get_user_name(id, name, 31) | |
351 | get_user_name(Name[id], name2, 31) | |
352 | if(is_user_alive(Name[id])) { | |
353 | user_slap(Name[id], 0) | |
354 | user_slap(Name[id], 0) | |
355 | if(id == Name[id]) { | |
356 | ChatColor(0, "!g%s!team %s !ygives himself a hard slap. !g%s", TAG2,name, BsNames[num]) | |
357 | ScreenFadeOut(id) | |
358 | return PLUGIN_HANDLED | |
359 | } | |
360 | else | |
361 | ChatColor(0, "!g%s !team%s!y slapped !team%s!y for !team'%s'!g %s", TAG2, name, name2, REDEN[Reason[id]], BsNames[num]) | |
362 | } | |
363 | else ChatColor(id, "!g%s!team %s !yis dead?", TAG2, name2) | |
364 | ScreenFadeOut(id) | |
365 | return PLUGIN_HANDLED; | |
366 | } | |
367 | public SlayPlayer(id, num) { | |
368 | new name[32], name2[32] | |
369 | get_user_name(id, name, 31) | |
370 | get_user_name(Name[id], name2, 31) | |
371 | if(is_user_alive(Name[id])) { | |
372 | if(id == Name[id]) { | |
373 | user_silentkill(id) | |
374 | make_deathmsg(id, Name[id], 1, "deagle") | |
375 | ChatColor(0, "!g%s !team%s!y takes a revolver, points at hes head and fires. !g%s", TAG2, name, BsNames[num]) | |
376 | ScreenFadeOut(id) | |
377 | return PLUGIN_HANDLED; | |
378 | } | |
379 | else { | |
380 | user_silentkill(Name[id]) | |
381 | make_deathmsg(id, Name[id], 0, "worldspawn") | |
382 | ChatColor(0, "!g%s !team%s!y slayed !team%s!y for !team'%s'!g %s", TAG2, name, name2, REDEN[Reason[id]], BsNames[num]) | |
383 | } | |
384 | } | |
385 | else ChatColor(id, "!g%s!team %s !yis dead?", TAG2, name2) | |
386 | ScreenFadeOut(id) | |
387 | return PLUGIN_HANDLED; | |
388 | } | |
389 | public KickPlayer(id, num) { | |
390 | new name[32], name2[32] | |
391 | get_user_name(id, name, 31) | |
392 | get_user_name(Name[id], name2, 31) | |
393 | if(id == Name[id]) { | |
394 | server_cmd("kick ^"%s^"",name) | |
395 | ChatColor(0, "!g%s !team%s !ygot tired of the game and kicked himself. !g%s", TAG2, name, BsNames[num]) | |
396 | ScreenFadeOut(id) | |
397 | return PLUGIN_HANDLED; | |
398 | } | |
399 | else { | |
400 | server_cmd("kick ^"%s^"",name2) | |
401 | ChatColor(0, "!g%s !team%s!y kicked !team%s!y for !team'%s'!g %s", TAG2, name, name2, REDEN[Reason[id]], BsNames[num]) | |
402 | } | |
403 | ScreenFadeOut(id) | |
404 | return PLUGIN_HANDLED; | |
405 | } | |
406 | public BanPlayer(id, num) { | |
407 | new name[32], name2[32] | |
408 | get_user_name(id, name, 31) | |
409 | get_user_name(Name[id], name2, 31) | |
410 | server_cmd("banid %i #%i Banned;writeid",get_pcvar_num(cBanTime),get_user_userid(Name[id])) | |
411 | server_cmd("kick #%s ^"%s banned u for %s^"", Name[id], name, REDEN[Reason[id]]) | |
412 | ChatColor(0, "!g%s !team%s!y banned !team%s!y for !team'%s'!g %s", TAG2, name, name2, REDEN[Reason[id]], BsNames[num]) | |
413 | ScreenFadeOut(id) | |
414 | } | |
415 | public SwapPlayers(id, num) { | |
416 | new players[32], num, player | |
417 | get_players(players, num) | |
418 | for(new i = 0; i < num; i++) { | |
419 | player = players[i] | |
420 | cs_set_user_team(player, cs_get_user_team(player) == CS_TEAM_T ? CS_TEAM_CT:CS_TEAM_T) | |
421 | } | |
422 | new name[32] | |
423 | get_user_name(id, name, 31) | |
424 | ChatColor(0, "!g%s !team%s!y swapped the teams!", TAG2, name, BsNames[num]) | |
425 | server_cmd("sv_restartround 3") | |
426 | server_exec() | |
427 | ScreenFadeOut(id) | |
428 | return PLUGIN_HANDLED | |
429 | } | |
430 | public QuaddmgPlayer(id, num) { | |
431 | QuadDamage[id] = 1 | |
432 | new name[32] | |
433 | get_user_name(id, name, 31) | |
434 | ChatColor(0,"!g%s !team%s!y has now '!teamQuad Damage!y' for !g%i!ysec !g%s", TAG2, name, get_pcvar_num(cQuadDmgTime), BsNames[num]) | |
435 | set_user_rendering(id, kRenderFxGlowShell, 180, 255, 175, kRenderNormal, 20); | |
436 | ScreenFadeOut(id) | |
437 | set_task(get_pcvar_float(cQuadDmgTime), "ResetQuadDmg", id) | |
438 | } | |
439 | public ResetQuadDmg(id) { | |
440 | new name[32] | |
441 | get_user_name(id, name, 31) | |
442 | QuadDamage[id] = 0 | |
443 | ChatColor(0,"!g%s !team%s!y's QuadDamage is removed.", TAG2, name) | |
444 | set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0); | |
445 | } | |
446 | public WeaponpacketPlayer(id, num) { | |
447 | new name[32] | |
448 | get_user_name(id, name, 31) | |
449 | ChatColor(0,"!g%s !team%s!y has taked the '!teamWeapon Packet!y'!g %s", TAG2, name, BsNames[num]) | |
450 | strip_user_weapons(id) | |
451 | give_item(id, "weapon_knife"); | |
452 | give_item(id, "weapon_deagle") | |
453 | cs_set_user_bpammo(id,CSW_DEAGLE,35); | |
454 | give_item(id, "weapon_m4a1"); | |
455 | cs_set_user_bpammo(id,CSW_M4A1,90) | |
456 | give_item(id, "weapon_hegrenade"); | |
457 | ScreenFadeOut(id) | |
458 | } | |
459 | public GiveDrug(id, num) { | |
460 | if(!is_user_alive(Name[id])) | |
461 | return PLUGIN_HANDLED; | |
462 | ||
463 | message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id) | |
464 | write_byte(170) | |
465 | message_end() | |
466 | ||
467 | new name[32]; get_user_name(id, name, 31) | |
468 | new name2[32]; get_user_name(Name[id], name2, 31) | |
469 | if(id == Name[id]) { | |
470 | ChatColor(0, "!g%s !team%s !ygives himself !team'Drugs'!y. !g%s", TAG2, name, BsNames[num]) | |
471 | ScreenFadeOut(id) | |
472 | set_task(10.0, "DrugStop", Name[id]); | |
473 | return PLUGIN_HANDLED; | |
474 | } | |
475 | else | |
476 | ChatColor(0,"!g%s !team%s!y gives !team'Drugs'!y to !team%s!y for !g10!ysec!g %s", TAG2, name, name2, BsNames[num]) | |
477 | ScreenFadeOut(id) | |
478 | set_task(10.0, "DrugStop", Name[id]); | |
479 | return PLUGIN_HANDLED; | |
480 | } | |
481 | public DrugStop(id) { | |
482 | if(is_user_alive(id)) { | |
483 | message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id) | |
484 | write_byte(90) | |
485 | message_end() | |
486 | } | |
487 | } | |
488 | public GiveGlow(id, num) { | |
489 | if(!is_user_alive(Name[id])) | |
490 | return PLUGIN_HANDLED; | |
491 | set_user_rendering(Name[id], kRenderFxGlowShell, random_num(0,255), random_num(0,255), random_num(0,255), kRenderNormal, 0); | |
492 | new name[32]; get_user_name(id, name, 31) | |
493 | new name2[32]; get_user_name(Name[id], name2, 31) | |
494 | if(id == Name[id]) { | |
495 | ChatColor(0, "!g%s!team %s !ygives himself a !team'Random Glow'!y. !g%s", TAG2, name, BsNames[num]) | |
496 | ScreenFadeOut(id) | |
497 | return PLUGIN_HANDLED; | |
498 | } | |
499 | else | |
500 | ChatColor(0,"!g%s !team%s!y gives !team'Random Glow'!y to !team%s!y for !g%i!ysec!g %s", TAG2, name, name2, BsNames[num]) | |
501 | ScreenFadeOut(id) | |
502 | return PLUGIN_HANDLED; | |
503 | } | |
504 | public GiveNoclip(id, num) { | |
505 | if(!is_user_alive(Name[id])) | |
506 | return PLUGIN_HANDLED; | |
507 | ||
508 | set_user_noclip(Name[id], 1) | |
509 | new name[32]; get_user_name(id, name, 31) | |
510 | new name2[32]; get_user_name(Name[id], name2, 31) | |
511 | ChatColor(0,"!g%s !team%s!y gives !team'Noclip'!y to !team%s!y for !g%i!ysec!g %s", TAG2, name, name2, get_pcvar_num(cNoclipTime), BsNames[num]) | |
512 | ScreenFadeOut(id) | |
513 | set_task(get_pcvar_float(cNoclipTime), "ResetNoclip", Name[id]) | |
514 | return PLUGIN_HANDLED; | |
515 | } | |
516 | public NoclipPlayer(id, num) { | |
517 | if(!is_user_alive(id)) | |
518 | return PLUGIN_HANDLED; | |
519 | set_user_noclip(id, 1) | |
520 | new name[32] | |
521 | get_user_name(id, name, 31) | |
522 | ChatColor(0,"!g%s !team%s!y has now '!teamNoclip!y' for !g%i!ysec!g %s", TAG2, name, get_pcvar_num(cNoclipTime), BsNames[num]) | |
523 | ScreenFadeOut(id) | |
524 | set_task(get_pcvar_float(cNoclipTime), "ResetNoclip", id) | |
525 | return PLUGIN_HANDLED; | |
526 | } | |
527 | public ResetNoclip(id) { | |
528 | if(is_user_alive(id)) { | |
529 | new name[32] | |
530 | get_user_name(id, name, 31) | |
531 | set_user_noclip(id, 0) | |
532 | ChatColor(0,"!g%s !team%s!y's NoClip is removed.", TAG2, name) | |
533 | } | |
534 | } | |
535 | public RevivePlayer(id, num) { | |
536 | ExecuteHamB( Ham_CS_RoundRespawn, Name[id] ); | |
537 | new name[32]; get_user_name(id, name, 31) | |
538 | new name2[32]; get_user_name(Name[id], name2, 31) | |
539 | if(id == Name[id]) | |
540 | ChatColor(0, "!g%s!team %s!y revived himself. !g%s", TAG2, name, BsNames[num]) | |
541 | ChatColor(0,"!g%s !team%s!y revived !team%s!g %s", TAG2, name, name2, BsNames[num]) | |
542 | ||
543 | ScreenFadeOut(id) | |
544 | } | |
545 | ||
546 | public TransferMenu(id, menu, item) { | |
547 | if( item == MENU_EXIT ) { | |
548 | menu_destroy(menu); | |
549 | MainMenu(id) | |
550 | return PLUGIN_HANDLED; | |
551 | } | |
552 | ||
553 | new data[6], iName[64]; | |
554 | new access, callback; | |
555 | menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); | |
556 | ||
557 | new player = str_to_num(data) | |
558 | ||
559 | if(!player) { | |
560 | switch(tTransfer[id]) { | |
561 | case 2: tTransfer[id]=0 | |
562 | default: tTransfer[id]++ | |
563 | } | |
564 | showtransfermenu(id) | |
565 | return PLUGIN_CONTINUE; | |
566 | } | |
567 | ||
568 | new name[2][32] | |
569 | get_user_name(player,name[1],31) | |
570 | get_user_name(id,name[0],31) | |
571 | ||
572 | switch(tTransfer[id]) { | |
573 | case 0: { | |
574 | cs_set_user_team(player, CS_TEAM_CT) | |
575 | user_silentkill(player) | |
576 | ChatColor(0, "!g%s !team%s !ytransfered !team%s!y to the 'Counter-Terrorists'. !g%s", TAG2, name[0] ,name[1], BsNames[Num[id]]) | |
577 | } | |
578 | case 1: { | |
579 | cs_set_user_team(player, CS_TEAM_T) | |
580 | user_silentkill(player) | |
581 | ChatColor(0, "!g%s !team%s !ytransfered !team%s!y to the 'Terrorists'. !g%s", TAG2, name[0] ,name[1], BsNames[Num[id]]) | |
582 | } | |
583 | case 2: { | |
584 | cs_set_user_team(player, CS_TEAM_SPECTATOR) | |
585 | user_silentkill(player) | |
586 | ChatColor(0, "!g%s !team%s !ytransfered !team%s!y to the 'Spectators'. !g%s", TAG2, name[0] ,name[1], BsNames[Num[id]]) | |
587 | } | |
588 | } | |
589 | /* | |
590 | new ctime[64] | |
591 | get_time("%m/%d/%Y - %H:%M:%S", ctime, 63) | |
592 | ||
593 | new temp[100] | |
594 | formatex(temp,99, "%s : Transfer %s",ctime,name[1]) | |
595 | VipLog(id, temp) | |
596 | */ | |
597 | showtransfermenu(id) | |
598 | return PLUGIN_CONTINUE; | |
599 | } | |
600 | /* | |
601 | mTc: | |
602 | - Player List | |
603 | - Reasons | |
604 | */ | |
605 | public PlayerList(id) { | |
606 | new Playermenu, Temp[64] | |
607 | formatex(Temp,63, "\d%s\y: Choose a player:", TAG) | |
608 | Playermenu = menu_create(Temp, "PlayerHandler"); | |
609 | ||
610 | new players[32], pnum, tempid; | |
611 | new szName[32], szTempid[10]; | |
612 | get_players(players, pnum, "ch"); | |
613 | for( new i; i<pnum; i++ ) { | |
614 | //if (get_user_flags(players[i]) & ADMIN_IMMUNITY) | |
615 | // continue; | |
616 | ||
617 | tempid = players[i]; | |
618 | get_user_name(tempid, szName, 31); | |
619 | num_to_str(tempid, szTempid, 9); | |
620 | menu_additem(Playermenu, szName, szTempid, 0); | |
621 | } | |
622 | menu_display(id, Playermenu); | |
623 | return PLUGIN_HANDLED; | |
624 | } | |
625 | public ReasonList(id) { | |
626 | new Reasonmenu, Temp[64] | |
627 | formatex(Temp,63, "\d%s\y: Choose a reason:", TAG) | |
628 | Reasonmenu = menu_create(Temp, "ReasonHandler"); | |
629 | new key[6] | |
630 | for(new i; i < TotalReasons; i++) { | |
631 | num_to_str(i,key,sizeof(key)-1) | |
632 | menu_additem(Reasonmenu, REDEN[i], key, 0); | |
633 | } | |
634 | menu_display(id, Reasonmenu); | |
635 | return PLUGIN_HANDLED; | |
636 | } | |
637 | public ReasonHandler(id, menu, item) { | |
638 | if( item == MENU_EXIT ) { | |
639 | menu_destroy(menu); | |
640 | return PLUGIN_HANDLED; | |
641 | } | |
642 | new data[6], iName[64]; | |
643 | new access, callback; | |
644 | menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); | |
645 | ||
646 | Reason[id] = str_to_num(data); | |
647 | ||
648 | switch(Style[id]) { | |
649 | case 0: SlapPlayer(id, Num[id]) // Slap | |
650 | case 1: SlayPlayer(id, Num[id]) // Slay | |
651 | case 2: KickPlayer(id, Num[id]) // Kick | |
652 | case 3: BanPlayer(id, Num[id]) // Ban | |
653 | case 4: showvotemenu(id) // Vote stuff | |
654 | } | |
655 | menu_destroy(menu); | |
656 | return PLUGIN_HANDLED; | |
657 | } | |
658 | public PlayerHandler(id, menu, item) { | |
659 | if( item == MENU_EXIT ) { | |
660 | menu_destroy(menu); | |
661 | ScreenFadeOut(id) | |
662 | return PLUGIN_HANDLED; | |
663 | } | |
664 | new data[6], iName[64]; | |
665 | new access, callback; | |
666 | menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); | |
667 | ||
668 | Name[id] = str_to_num(data); | |
669 | ReasonList(id) | |
670 | menu_destroy(menu); | |
671 | return PLUGIN_HANDLED; | |
672 | } | |
673 | public PlayerList2(id) { | |
674 | new Playermenu, Temp[64] | |
675 | formatex(Temp,63, "\d%s\y: Choose a player:", TAG) | |
676 | Playermenu = menu_create(Temp, "PlayerHandler2"); | |
677 | ||
678 | new players[32], pnum, tempid; | |
679 | new szName[32], szTempid[10]; | |
680 | get_players(players, pnum, "ch"); | |
681 | for( new i; i<pnum; i++ ) { | |
682 | //if (get_user_flags(players[i]) & ADMIN_IMMUNITY) | |
683 | // continue; | |
684 | ||
685 | tempid = players[i]; | |
686 | get_user_name(tempid, szName, 31); | |
687 | num_to_str(tempid, szTempid, 9); | |
688 | menu_additem(Playermenu, szName, szTempid, 0); | |
689 | } | |
690 | menu_display(id, Playermenu); | |
691 | return PLUGIN_HANDLED; | |
692 | } | |
693 | public PlayerHandler2(id, menu, item) { | |
694 | if( item == MENU_EXIT ) { | |
695 | menu_destroy(menu); | |
696 | ScreenFadeOut(id) | |
697 | return PLUGIN_HANDLED; | |
698 | } | |
699 | new data[6], iName[64]; | |
700 | new access, callback; | |
701 | menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); | |
702 | ||
703 | Name[id] = str_to_num(data); | |
704 | switch(Style[id]) { | |
705 | case 6: GiveNoclip(id, Num[id]) | |
706 | case 7: GiveGlow(id, Num[id]) | |
707 | case 8: RevivePlayer(id, Num[id]) | |
708 | case 9: GiveDrug(id, Num[id]) | |
709 | } | |
710 | menu_destroy(menu); | |
711 | return PLUGIN_HANDLED; | |
712 | } | |
713 | /* | |
714 | mTc: | |
715 | - Screen Fade: In & Out | |
716 | */ | |
717 | ScreenFadeIn(id) { | |
718 | message_begin(MSG_ONE, g_msgFade, {0,0,0}, id); // use the magic #1 for "one client" | |
719 | write_short( ~0 ); // fade lasts this long duration | |
720 | write_short( ~0 ); // fade lasts this long hold time | |
721 | write_short( 1<<12 ); // fade type | |
722 | write_byte( 0 ); // fade red | |
723 | write_byte( 0 ); // fade green | |
724 | write_byte( 0 ); // fade blue | |
725 | write_byte( 175 ); // fade alpha | |
726 | message_end( ); | |
727 | return PLUGIN_CONTINUE; | |
728 | } | |
729 | ScreenFadeOut(id) { | |
730 | message_begin(MSG_ONE, g_msgFade, {0,0,0}, id); // use the magic #1 for "one client" | |
731 | write_short( 1<<12 ); // fade lasts this long duration | |
732 | write_short( 1<<8 ); // fade lasts this long hold time | |
733 | write_short( 1<<1 ); // fade type | |
734 | write_byte( 0 ); // fade red | |
735 | write_byte( 0 ); // fade green | |
736 | write_byte( 0 ); // fade blue | |
737 | write_byte( 128 ); // fade alpha | |
738 | message_end( ); | |
739 | return PLUGIN_CONTINUE; | |
740 | } | |
741 | /* | |
742 | mTc: | |
743 | - Player Spawn | |
744 | - Player Damage | |
745 | */ | |
746 | public PlayerSpawn(id) { | |
747 | if(get_pcvar_num(cStatus) && is_user_connected(id)) { | |
748 | QuadDamage[id] = 0 | |
749 | if(access(id, ADMIN_LEVEL_A)) | |
750 | cs_set_user_vip(id, 0, 0, 1) | |
751 | } | |
752 | } | |
753 | public PlayerDamage(id, iInflictor, iAttacker, Float:flDamage, iDamageBits) { | |
754 | if(QuadDamage[iAttacker] && is_user_connected(id) && is_user_alive(iAttacker)) | |
755 | SetHamParamFloat(4,floatmul(flDamage,get_pcvar_float(cDamage))) | |
756 | } | |
757 | /* | |
758 | mTc: | |
759 | - Save Stuff | |
760 | ||
761 | VipLog(id, data[]) { | |
762 | new authid[32],name[32] | |
763 | get_user_authid(id,authid,31) | |
764 | get_user_name(id,name,31) | |
765 | ||
766 | new iFile = fopen(Logpath, "a"); | |
767 | if( !iFile ) | |
768 | return; | |
769 | ||
770 | ||
771 | fprintf(iFile, "^"%s^" ^"%s^" ^"%s^" ^n",authid,name,data) | |
772 | fclose(iFile); | |
773 | } | |
774 | ||
775 | mTc: | |
776 | - Color Chat | |
777 | */ | |
778 | stock ChatColor(const id, const input[], any:...) { | |
779 | new count = 1, players[32] | |
780 | static msg[191] | |
781 | vformat(msg, 190, input, 3) | |
782 | ||
783 | replace_all(msg, 190, "!g", "^4") // Green Color | |
784 | replace_all(msg, 190, "!y", "^1") // Default Color | |
785 | replace_all(msg, 190, "!team", "^3") // Team Color | |
786 | ||
787 | if (id) | |
788 | players[0] = id | |
789 | else { | |
790 | get_players(players, count, "ch") | |
791 | for (new i = 0; i < count; i++) { | |
792 | message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]) | |
793 | write_byte(players[i]); | |
794 | write_string(msg); | |
795 | message_end(); | |
796 | } | |
797 | } | |
798 | } | |
799 | public showvotemenu(id) | |
800 | { | |
801 | new name[32], name2[32] | |
802 | get_user_name(Name[id],name,31) | |
803 | get_user_name(id,name2,31) | |
804 | ||
805 | new keys = (1<<0|1<<1); | |
806 | ||
807 | new szMenuBody[menusize - 1]; | |
808 | new line[84] | |
809 | switch(cVotetype) { | |
810 | case 1:formatex(line,99,"\r %s \ywanne kick\r %s \yfor\r %s^n\w Do you accept?", name2, name, REDEN[Reason[id]]) | |
811 | case 2:formatex(line,99,"\r %s \ywanne ban\r %s \yfor\r %s^n\w Do you accept?", name2, name, REDEN[Reason[id]]) | |
812 | case 3:formatex(line,99,"\r %s \ywanne mute\r %s \yfor\r %s^n\w Do you accept?", name2, name, REDEN[Reason[id]]) | |
813 | } | |
814 | ||
815 | new nLen = format(szMenuBody, menusize, "\dmTc:%s^n",line); | |
816 | ||
817 | nLen += format(szMenuBody[nLen], menusize-nLen, "^n\w1. Yes"); | |
818 | nLen += format(szMenuBody[nLen], menusize-nLen, "^n\w2. No"); | |
819 | ||
820 | cVoteYes=0 | |
821 | cVoteNo=0 | |
822 | ||
823 | new players[32], pnum; | |
824 | get_players(players, pnum); | |
825 | ||
826 | for( new i; i<pnum; i++ ) { | |
827 | show_menu(players[i], keys, szMenuBody, 10); | |
828 | } | |
829 | set_task(10.0, "EndVote", id); | |
830 | } | |
831 | ||
832 | public VoteMenu(id, key) { | |
833 | switch(key) { | |
834 | case 0: { | |
835 | if(cVoting) { | |
836 | cVoteYes++ | |
837 | ChatColor(id, "!g%s!y You voted!team Yes!y.", TAG2) | |
838 | } | |
839 | } | |
840 | case 1: { | |
841 | if(cVoting) { | |
842 | cVoteNo++ | |
843 | ChatColor(id, "!g%s!y You voted!team No!y.", TAG2) | |
844 | } | |
845 | } | |
846 | } | |
847 | return PLUGIN_HANDLED | |
848 | } | |
849 | ||
850 | public EndVote(id) | |
851 | { | |
852 | new name[32] | |
853 | get_user_name(Name[id],name,31) | |
854 | ||
855 | if(cVoteYes > cVoteNo) { | |
856 | switch(cVotetype) { | |
857 | case 1: { | |
858 | ChatColor(id, "!g%s!y Vote to kick!team %s!y succesfull.", TAG2, name) | |
859 | ||
860 | server_cmd("kick ^"%s^"",name) | |
861 | } | |
862 | case 2: { | |
863 | ChatColor(id, "!g%s!y Vote to ban!team %s!y succesfull.", TAG2, name) | |
864 | ||
865 | server_cmd("banid %i #%i Banned;writeid",get_pcvar_num(cBanTime),get_user_userid(Name[id])) | |
866 | server_cmd("kick ^"%s^"",name) | |
867 | } | |
868 | case 3: { | |
869 | ChatColor(id, "!g%s!y Vote to mute!team %s!y succesfull.", TAG2, name) | |
870 | ||
871 | is_muted[id]=true | |
872 | set_speak( id, SPEAK_MUTED ); | |
873 | ||
874 | set_task(get_pcvar_float(cMuteTime), "UnMute", id) | |
875 | } | |
876 | } | |
877 | } | |
878 | else { | |
879 | switch(cVotetype) { | |
880 | case 1: { | |
881 | ChatColor(id, "!g%s!y Vote to kick!team %s!y failed.", TAG2, name) | |
882 | } | |
883 | case 2: { | |
884 | ChatColor(id, "!g%s!y Vote to ban!team %s!y failed.", TAG2, name) | |
885 | } | |
886 | case 3: { | |
887 | ChatColor(id, "!g%s!y Vote to mute!team %s!y failed.", TAG2, name) | |
888 | } | |
889 | } | |
890 | } | |
891 | ||
892 | cVoting = 0 | |
893 | } | |
894 | ||
895 | public UnMute(id) { | |
896 | if(is_muted[id]) { | |
897 | is_muted[id]=false | |
898 | set_speak(id, SPEAK_NORMAL); | |
899 | ChatColor(id, "!g%s!y You are now unmuted.", TAG2) | |
900 | } | |
901 | } |