Parent Directory | Revision Log
Revision 44 - (view) (download)
1 : | ian | 44 | /* AMX Mod X |
2 : | * Misc. Stats Plugin | ||
3 : | * | ||
4 : | * by the AMX Mod X Development Team | ||
5 : | * originally developed by OLO | ||
6 : | * | ||
7 : | * This file is part of AMX Mod X. | ||
8 : | * | ||
9 : | * | ||
10 : | * This program is free software; you can redistribute it and/or modify it | ||
11 : | * under the terms of the GNU General Public License as published by the | ||
12 : | * Free Software Foundation; either version 2 of the License, or (at | ||
13 : | * your option) any later version. | ||
14 : | * | ||
15 : | * This program is distributed in the hope that it will be useful, but | ||
16 : | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
18 : | * General Public License for more details. | ||
19 : | * | ||
20 : | * You should have received a copy of the GNU General Public License | ||
21 : | * along with this program; if not, write to the Free Software Foundation, | ||
22 : | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 : | * | ||
24 : | * In addition, as a special exception, the author gives permission to | ||
25 : | * link the code of this program with the Half-Life Game Engine ("HL | ||
26 : | * Engine") and Modified Game Libraries ("MODs") developed by Valve, | ||
27 : | * L.L.C ("Valve"). You must obey the GNU General Public License in all | ||
28 : | * respects for all of the code used other than the HL Engine and MODs | ||
29 : | * from Valve. If you modify this file, you may extend this exception | ||
30 : | * to your version of the file, but you are not obligated to do so. If | ||
31 : | * you do not wish to do so, delete this exception statement from your | ||
32 : | * version. | ||
33 : | */ | ||
34 : | |||
35 : | #include <amxmodx> | ||
36 : | #include <csx> | ||
37 : | #include <cstrike> | ||
38 : | |||
39 : | public MultiKill | ||
40 : | public MultiKillSound | ||
41 : | public BombPlanting | ||
42 : | public BombDefusing | ||
43 : | public BombPlanted | ||
44 : | public BombDefused | ||
45 : | public BombFailed | ||
46 : | public BombPickUp | ||
47 : | public BombDrop | ||
48 : | public BombCountVoice | ||
49 : | public BombCountDef | ||
50 : | public BombReached | ||
51 : | public ItalyBonusKill | ||
52 : | public EnemyRemaining | ||
53 : | public LastMan | ||
54 : | public KnifeKill | ||
55 : | public KnifeKillSound | ||
56 : | public GrenadeKill | ||
57 : | public GrenadeSuicide | ||
58 : | public HeadShotKill | ||
59 : | public HeadShotKillSound | ||
60 : | public RoundCounterSound | ||
61 : | public RoundCounter | ||
62 : | public KillingStreak | ||
63 : | public KillingStreakSound | ||
64 : | public DoubleKill | ||
65 : | public DoubleKillSound | ||
66 : | public PlayerName | ||
67 : | public FirstBloodSound | ||
68 : | |||
69 : | new g_streakKills[33][2] | ||
70 : | new g_multiKills[33][2] | ||
71 : | new g_C4Timer | ||
72 : | new g_Defusing | ||
73 : | new g_Planter | ||
74 : | new Float:g_LastOmg | ||
75 : | new g_LastAnnounce | ||
76 : | new g_roundCount | ||
77 : | new Float:g_doubleKill | ||
78 : | new g_doubleKillId | ||
79 : | new g_friend[33] | ||
80 : | new g_firstBlood | ||
81 : | new g_center1_sync | ||
82 : | new g_announce_sync | ||
83 : | new g_status_sync | ||
84 : | new g_left_sync | ||
85 : | new g_bottom_sync | ||
86 : | new g_he_sync | ||
87 : | |||
88 : | new g_MultiKillMsg[7][] = | ||
89 : | { | ||
90 : | "Multi-Kill! %s^n%L %d %L (%d %L)", | ||
91 : | "Ultra-Kill!!! %s^n%L %d %L (%d %L)", | ||
92 : | "%s IS ON A KILLING SPREE!!!^n%L %d %L (%d %L)", | ||
93 : | "RAMPAGE!!! %s^n%L %d %L (%d hs)", | ||
94 : | "%s IS UNSTOPPABLE!!!^n%L %d %L (%d %L)", | ||
95 : | "%s IS A MONSTER!^n%L %d %L (%d %L)", | ||
96 : | "%s IS GODLIKE!!!!^n%L %d %L (%d %L)" | ||
97 : | } | ||
98 : | |||
99 : | new g_Sounds[7][] = | ||
100 : | { | ||
101 : | "multikill", | ||
102 : | "ultrakill", | ||
103 : | "killingspree", | ||
104 : | "rampage", | ||
105 : | "unstoppable", | ||
106 : | "monsterkill", | ||
107 : | "godlike" | ||
108 : | } | ||
109 : | new g_KillingMsg[7][] = | ||
110 : | { | ||
111 : | "%s: Multi-Kill!", | ||
112 : | "%s: Ultra-Kill!!!", | ||
113 : | "%s IS ON A KILLING SPREE!!!", | ||
114 : | "%s: RAMPAGE!!!", | ||
115 : | "%s IS UNSTOPPABLE!!!", | ||
116 : | "%s IS A MONSTER!", | ||
117 : | "%s IS GODLIKE!!!" | ||
118 : | } | ||
119 : | |||
120 : | new g_KinfeMsg[4][] = | ||
121 : | { | ||
122 : | "KNIFE_MSG_1", | ||
123 : | "KNIFE_MSG_2", | ||
124 : | "KNIFE_MSG_3", | ||
125 : | "KNIFE_MSG_4" | ||
126 : | } | ||
127 : | |||
128 : | new g_LastMessages[4][] = | ||
129 : | { | ||
130 : | "LAST_MSG_1", | ||
131 : | "LAST_MSG_2", | ||
132 : | "LAST_MSG_3", | ||
133 : | "LAST_MSG_4" | ||
134 : | } | ||
135 : | |||
136 : | new g_HeMessages[4][] = | ||
137 : | { | ||
138 : | "HE_MSG_1", | ||
139 : | "HE_MSG_2", | ||
140 : | "HE_MSG_3", | ||
141 : | "HE_MSG_4" | ||
142 : | } | ||
143 : | |||
144 : | new g_SHeMessages[4][] = | ||
145 : | { | ||
146 : | "SHE_MSG_1", | ||
147 : | "SHE_MSG_2", | ||
148 : | "SHE_MSG_3", | ||
149 : | "SHE_MSG_4" | ||
150 : | } | ||
151 : | |||
152 : | new g_HeadShots[7][] = | ||
153 : | { | ||
154 : | "HS_MSG_1", | ||
155 : | "HS_MSG_2", | ||
156 : | "HS_MSG_3", | ||
157 : | "HS_MSG_4", | ||
158 : | "HS_MSG_5", | ||
159 : | "HS_MSG_6", | ||
160 : | "HS_MSG_7" | ||
161 : | } | ||
162 : | |||
163 : | new g_teamsNames[4][] = | ||
164 : | { | ||
165 : | "TERRORIST", | ||
166 : | "CT", | ||
167 : | "TERRORISTS", | ||
168 : | "CTS" | ||
169 : | } | ||
170 : | |||
171 : | public plugin_init() | ||
172 : | { | ||
173 : | register_plugin("CS Misc. Stats", AMXX_VERSION_STR, "AMXX Dev Team") | ||
174 : | register_dictionary("miscstats.txt") | ||
175 : | register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w") | ||
176 : | register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw") | ||
177 : | register_event("RoundTime", "eNewRound", "bc") | ||
178 : | register_event("StatusValue", "setTeam", "be", "1=1") | ||
179 : | register_event("StatusValue", "showStatus", "be", "1=2", "2!0") | ||
180 : | register_event("StatusValue", "hideStatus", "be", "1=1", "2=0") | ||
181 : | |||
182 : | new mapname[32] | ||
183 : | get_mapname(mapname, 31) | ||
184 : | |||
185 : | if (equali(mapname, "de_", 3) || equali(mapname, "csde_", 5)) | ||
186 : | { | ||
187 : | register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4") | ||
188 : | register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") | ||
189 : | register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") | ||
190 : | } | ||
191 : | else if (equali(mapname, "cs_italy")) | ||
192 : | { | ||
193 : | register_event("23", "chickenKill", "a", "1=108", /*"12=106", */ "15=4") | ||
194 : | register_event("23", "radioKill", "a", "1=108", /*"12=294", */ "15=2") | ||
195 : | } | ||
196 : | |||
197 : | g_center1_sync = CreateHudSyncObj() | ||
198 : | g_announce_sync = CreateHudSyncObj() | ||
199 : | g_status_sync = CreateHudSyncObj() | ||
200 : | g_left_sync = CreateHudSyncObj() | ||
201 : | g_bottom_sync = CreateHudSyncObj() | ||
202 : | g_he_sync = CreateHudSyncObj() | ||
203 : | } | ||
204 : | |||
205 : | public plugin_cfg() | ||
206 : | { | ||
207 : | new g_addStast[] = "amx_statscfg add ^"%s^" %s" | ||
208 : | |||
209 : | server_cmd(g_addStast, "ST_MULTI_KILL", "MultiKill") | ||
210 : | server_cmd(g_addStast, "ST_MULTI_KILL_SOUND", "MultiKillSound") | ||
211 : | server_cmd(g_addStast, "ST_BOMB_PLANTING", "BombPlanting") | ||
212 : | server_cmd(g_addStast, "ST_BOMB_DEFUSING", "BombDefusing") | ||
213 : | server_cmd(g_addStast, "ST_BOMB_PLANTED", "BombPlanted") | ||
214 : | server_cmd(g_addStast, "ST_BOMB_DEF_SUCC", "BombDefused") | ||
215 : | server_cmd(g_addStast, "ST_BOMB_DEF_FAIL", "BombFailed") | ||
216 : | server_cmd(g_addStast, "ST_BOMB_PICKUP", "BombPickUp") | ||
217 : | server_cmd(g_addStast, "ST_BOMB_DROP", "BombDrop") | ||
218 : | server_cmd(g_addStast, "ST_BOMB_CD_VOICE", "BombCountVoice") | ||
219 : | server_cmd(g_addStast, "ST_BOMB_CD_DEF", "BombCountDef") | ||
220 : | server_cmd(g_addStast, "ST_BOMB_SITE", "BombReached") | ||
221 : | server_cmd(g_addStast, "ST_ITALY_BONUS", "ItalyBonusKill") | ||
222 : | server_cmd(g_addStast, "ST_LAST_MAN", "LastMan") | ||
223 : | server_cmd(g_addStast, "ST_KNIFE_KILL", "KnifeKill") | ||
224 : | server_cmd(g_addStast, "ST_KNIFE_KILL_SOUND", "KnifeKillSound") | ||
225 : | server_cmd(g_addStast, "ST_HE_KILL", "GrenadeKill") | ||
226 : | server_cmd(g_addStast, "ST_HE_SUICIDE", "GrenadeSuicide") | ||
227 : | server_cmd(g_addStast, "ST_HS_KILL", "HeadShotKill") | ||
228 : | server_cmd(g_addStast, "ST_HS_KILL_SOUND", "HeadShotKillSound") | ||
229 : | server_cmd(g_addStast, "ST_ROUND_CNT", "RoundCounter") | ||
230 : | server_cmd(g_addStast, "ST_ROUND_CNT_SOUND", "RoundCounterSound") | ||
231 : | server_cmd(g_addStast, "ST_KILL_STR", "KillingStreak") | ||
232 : | server_cmd(g_addStast, "ST_KILL_STR_SOUND", "KillingStreakSound") | ||
233 : | server_cmd(g_addStast, "ST_ENEMY_REM", "EnemyRemaining") | ||
234 : | server_cmd(g_addStast, "ST_DOUBLE_KILL", "DoubleKill") | ||
235 : | server_cmd(g_addStast, "ST_DOUBLE_KILL_SOUND", "DoubleKillSound") | ||
236 : | server_cmd(g_addStast, "ST_PLAYER_NAME", "PlayerName") | ||
237 : | server_cmd(g_addStast, "ST_FIRST_BLOOD_SOUND", "FirstBloodSound") | ||
238 : | } | ||
239 : | |||
240 : | public client_putinserver(id) | ||
241 : | { | ||
242 : | g_multiKills[id] = {0, 0} | ||
243 : | g_streakKills[id] = {0, 0} | ||
244 : | } | ||
245 : | |||
246 : | public client_death(killer, victim, wpnindex, hitplace, TK) | ||
247 : | { | ||
248 : | if (wpnindex == CSW_C4) | ||
249 : | return | ||
250 : | |||
251 : | new headshot = (hitplace == HIT_HEAD) ? 1 : 0 | ||
252 : | new selfkill = (killer == victim) ? 1 : 0 | ||
253 : | |||
254 : | if (g_firstBlood) | ||
255 : | { | ||
256 : | g_firstBlood = 0 | ||
257 : | if (FirstBloodSound) | ||
258 : | play_sound("misc/firstblood") | ||
259 : | } | ||
260 : | |||
261 : | if ((KillingStreak || KillingStreakSound) && !TK) | ||
262 : | { | ||
263 : | g_streakKills[victim][1]++ | ||
264 : | g_streakKills[victim][0] = 0 | ||
265 : | |||
266 : | if (!selfkill) | ||
267 : | { | ||
268 : | g_streakKills[killer][0]++ | ||
269 : | g_streakKills[killer][1] = 0 | ||
270 : | |||
271 : | new a = g_streakKills[killer][0] - 3 | ||
272 : | |||
273 : | if ((a > -1) && !(a % 2)) | ||
274 : | { | ||
275 : | new name[32] | ||
276 : | get_user_name(killer, name, 31) | ||
277 : | |||
278 : | if ((a >>= 1) > 6) | ||
279 : | a = 6 | ||
280 : | |||
281 : | if (KillingStreak) | ||
282 : | { | ||
283 : | set_hudmessage(0, 100, 255, 0.05, 0.50, 2, 0.02, 6.0, 0.01, 0.1, -1) | ||
284 : | ShowSyncHudMsg(0, g_left_sync, g_KillingMsg[a], name) | ||
285 : | } | ||
286 : | |||
287 : | if (KillingStreakSound) | ||
288 : | { | ||
289 : | new file[32] | ||
290 : | |||
291 : | format(file, 31, "misc/%s", g_Sounds[a]) | ||
292 : | play_sound(file) | ||
293 : | } | ||
294 : | } | ||
295 : | } | ||
296 : | } | ||
297 : | |||
298 : | if (MultiKill || MultiKillSound) | ||
299 : | { | ||
300 : | if (!selfkill && !TK && killer) | ||
301 : | { | ||
302 : | g_multiKills[killer][0]++ | ||
303 : | g_multiKills[killer][1] += headshot | ||
304 : | |||
305 : | new param[2] | ||
306 : | |||
307 : | param[0] = killer | ||
308 : | param[1] = g_multiKills[killer][0] | ||
309 : | set_task(4.0 + float(param[1]), "checkKills", 0, param, 2) | ||
310 : | } | ||
311 : | } | ||
312 : | |||
313 : | if (EnemyRemaining && is_user_connected(victim)) | ||
314 : | { | ||
315 : | new ppl[32], pplnum = 0, maxplayers = get_maxplayers() | ||
316 : | new epplnum = 0 | ||
317 : | new CsTeams:team = cs_get_user_team(victim) | ||
318 : | new CsTeams:other_team | ||
319 : | new CsTeams:enemy_team = (team == CS_TEAM_T) ? CS_TEAM_CT : CS_TEAM_T | ||
320 : | |||
321 : | if (team == CS_TEAM_T || team == CS_TEAM_CT) | ||
322 : | { | ||
323 : | for (new i=1; i<=maxplayers; i++) | ||
324 : | { | ||
325 : | if (!is_user_connected(i)) | ||
326 : | { | ||
327 : | continue | ||
328 : | } | ||
329 : | if (i == victim) | ||
330 : | { | ||
331 : | continue | ||
332 : | } | ||
333 : | other_team = cs_get_user_team(i) | ||
334 : | if (other_team == team && is_user_alive(i)) | ||
335 : | { | ||
336 : | epplnum++ | ||
337 : | } else if (other_team == enemy_team) { | ||
338 : | ppl[pplnum++] = i | ||
339 : | } | ||
340 : | } | ||
341 : | |||
342 : | if (pplnum && epplnum) | ||
343 : | { | ||
344 : | new message[128], team_name[32] | ||
345 : | |||
346 : | set_hudmessage(255, 255, 255, 0.02, 0.85, 2, 0.05, 0.1, 0.02, 3.0, -1) | ||
347 : | |||
348 : | /* This is a pretty stupid thing to translate, but whatever */ | ||
349 : | new _teamname[32] | ||
350 : | if (team == CS_TEAM_T) | ||
351 : | { | ||
352 : | format(_teamname, 31, "TERRORIST%s", (epplnum == 1) ? "" : "S") | ||
353 : | } else if (team == CS_TEAM_CT) { | ||
354 : | format(_teamname, 31, "CT%s", (epplnum == 1) ? "" : "S") | ||
355 : | } | ||
356 : | |||
357 : | for (new a = 0; a < pplnum; ++a) | ||
358 : | { | ||
359 : | format(team_name, 31, "%L", ppl[a], _teamname) | ||
360 : | format(message, 127, "%L", ppl[a], "REMAINING", epplnum, team_name) | ||
361 : | ShowSyncHudMsg(ppl[a], g_bottom_sync, "%s", message) | ||
362 : | } | ||
363 : | } | ||
364 : | } | ||
365 : | } | ||
366 : | |||
367 : | if (LastMan) | ||
368 : | { | ||
369 : | new cts[32], ts[32], ctsnum, tsnum | ||
370 : | new maxplayers = get_maxplayers() | ||
371 : | new CsTeams:team | ||
372 : | |||
373 : | for (new i=1; i<=maxplayers; i++) | ||
374 : | { | ||
375 : | if (!is_user_connected(i) || !is_user_alive(i)) | ||
376 : | { | ||
377 : | continue | ||
378 : | } | ||
379 : | team = cs_get_user_team(i) | ||
380 : | if (team == CS_TEAM_T) | ||
381 : | { | ||
382 : | ts[tsnum++] = i | ||
383 : | } else if (team == CS_TEAM_CT) { | ||
384 : | cts[ctsnum++] = i | ||
385 : | } | ||
386 : | } | ||
387 : | |||
388 : | if (ctsnum == 1 && tsnum == 1) | ||
389 : | { | ||
390 : | new ctname[32], tname[32] | ||
391 : | |||
392 : | get_user_name(cts[0], ctname, 31) | ||
393 : | get_user_name(ts[0], tname, 31) | ||
394 : | |||
395 : | set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, -1) | ||
396 : | ShowSyncHudMsg(0, g_center1_sync, "%s vs. %s", ctname, tname) | ||
397 : | |||
398 : | play_sound("misc/maytheforce") | ||
399 : | } | ||
400 : | else if (!g_LastAnnounce) | ||
401 : | { | ||
402 : | new oposite = 0, _team = 0 | ||
403 : | |||
404 : | if (ctsnum == 1 && tsnum > 1) | ||
405 : | { | ||
406 : | g_LastAnnounce = cts[0] | ||
407 : | oposite = tsnum | ||
408 : | _team = 0 | ||
409 : | } | ||
410 : | else if (tsnum == 1 && ctsnum > 1) | ||
411 : | { | ||
412 : | g_LastAnnounce = ts[0] | ||
413 : | oposite = ctsnum | ||
414 : | _team = 1 | ||
415 : | } | ||
416 : | |||
417 : | if (g_LastAnnounce) | ||
418 : | { | ||
419 : | new name[32] | ||
420 : | |||
421 : | get_user_name(g_LastAnnounce, name, 31) | ||
422 : | |||
423 : | set_hudmessage(0, 255, 255, -1.0, 0.38, 0, 6.0, 6.0, 0.5, 0.15, -1) | ||
424 : | ShowSyncHudMsg(0, g_center1_sync, "%s (%d HP) vs. %d %s%s: %L", name, get_user_health(g_LastAnnounce), oposite, g_teamsNames[_team], (oposite == 1) ? "" : "S", LANG_PLAYER, g_LastMessages[random_num(0, 3)]) | ||
425 : | |||
426 : | if (!is_user_connecting(g_LastAnnounce)) | ||
427 : | { | ||
428 : | client_cmd(g_LastAnnounce, "spk misc/oneandonly") | ||
429 : | } | ||
430 : | } | ||
431 : | } | ||
432 : | } | ||
433 : | |||
434 : | if (wpnindex == CSW_KNIFE && (KnifeKill || KnifeKillSound)) | ||
435 : | { | ||
436 : | if (KnifeKill) | ||
437 : | { | ||
438 : | new killer_name[32], victim_name[32] | ||
439 : | |||
440 : | get_user_name(killer, killer_name, 31) | ||
441 : | get_user_name(victim, victim_name, 31) | ||
442 : | |||
443 : | set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, -1) | ||
444 : | ShowSyncHudMsg(0, g_he_sync, "%L", LANG_PLAYER, g_KinfeMsg[random_num(0, 3)], killer_name, victim_name) | ||
445 : | } | ||
446 : | |||
447 : | if (KnifeKillSound) | ||
448 : | play_sound("misc/humiliation") | ||
449 : | } | ||
450 : | |||
451 : | if (wpnindex == CSW_HEGRENADE && (GrenadeKill || GrenadeSuicide)) | ||
452 : | { | ||
453 : | new killer_name[32], victim_name[32] | ||
454 : | |||
455 : | get_user_name(killer, killer_name, 31) | ||
456 : | get_user_name(victim, victim_name, 31) | ||
457 : | |||
458 : | set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, -1) | ||
459 : | |||
460 : | if (!selfkill) | ||
461 : | { | ||
462 : | if (GrenadeKill) | ||
463 : | ShowSyncHudMsg(0, g_he_sync, "%L", LANG_PLAYER, g_HeMessages[random_num(0, 3)], killer_name, victim_name) | ||
464 : | } | ||
465 : | else if (GrenadeSuicide) | ||
466 : | ShowSyncHudMsg(0, g_he_sync, "%L", LANG_PLAYER, g_SHeMessages[random_num(0, 3)], victim_name) | ||
467 : | } | ||
468 : | |||
469 : | if (headshot && (HeadShotKill || HeadShotKillSound)) | ||
470 : | { | ||
471 : | if (HeadShotKill && wpnindex) | ||
472 : | { | ||
473 : | new killer_name[32], victim_name[32], weapon_name[32], message[256], players[32], pnum | ||
474 : | |||
475 : | xmod_get_wpnname(wpnindex, weapon_name, 31) | ||
476 : | get_user_name(killer, killer_name, 31) | ||
477 : | get_user_name(victim, victim_name, 31) | ||
478 : | get_players(players, pnum, "c") | ||
479 : | |||
480 : | for (new i = 0; i < pnum; i++) | ||
481 : | { | ||
482 : | format(message, sizeof(message)-1, "%L", players[i], g_HeadShots[random_num(0, 6)]) | ||
483 : | |||
484 : | replace(message, sizeof(message)-1, "$vn", victim_name) | ||
485 : | replace(message, sizeof(message)-1, "$wn", weapon_name) | ||
486 : | replace(message, sizeof(message)-1, "$kn", killer_name) | ||
487 : | |||
488 : | set_hudmessage(100, 100, 255, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, -1) | ||
489 : | ShowSyncHudMsg(players[i], g_announce_sync, "%s", message) | ||
490 : | } | ||
491 : | } | ||
492 : | |||
493 : | if (HeadShotKillSound) | ||
494 : | { | ||
495 : | client_cmd(killer, "spk misc/headshot") | ||
496 : | client_cmd(victim, "spk misc/headshot") | ||
497 : | } | ||
498 : | } | ||
499 : | |||
500 : | if ((DoubleKill || DoubleKillSound) && !selfkill) | ||
501 : | { | ||
502 : | new Float:nowtime = get_gametime() | ||
503 : | |||
504 : | if (g_doubleKill == nowtime && g_doubleKillId == killer) | ||
505 : | { | ||
506 : | if (DoubleKill) | ||
507 : | { | ||
508 : | new name[32] | ||
509 : | |||
510 : | get_user_name(killer, name, 31) | ||
511 : | |||
512 : | set_hudmessage(255, 0, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, -1) | ||
513 : | ShowSyncHudMsg(0, g_center1_sync, "%L", LANG_PLAYER, "DOUBLE_KILL", name) | ||
514 : | } | ||
515 : | |||
516 : | if (DoubleKillSound) | ||
517 : | play_sound("misc/doublekill") | ||
518 : | } | ||
519 : | |||
520 : | g_doubleKill = nowtime | ||
521 : | g_doubleKillId = killer | ||
522 : | } | ||
523 : | } | ||
524 : | |||
525 : | public hideStatus(id) | ||
526 : | { | ||
527 : | if (PlayerName) | ||
528 : | { | ||
529 : | ClearSyncHud(id, g_status_sync) | ||
530 : | } | ||
531 : | } | ||
532 : | |||
533 : | public setTeam(id) | ||
534 : | g_friend[id] = read_data(2) | ||
535 : | |||
536 : | public showStatus(id) | ||
537 : | { | ||
538 : | if(!is_user_bot(id) && is_user_connected(id) && PlayerName) | ||
539 : | { | ||
540 : | new name[32], pid = read_data(2) | ||
541 : | |||
542 : | get_user_name(pid, name, 31) | ||
543 : | new color1 = 0, color2 = 0 | ||
544 : | |||
545 : | if (get_user_team(pid) == 1) | ||
546 : | color1 = 255 | ||
547 : | else | ||
548 : | color2 = 255 | ||
549 : | |||
550 : | if (g_friend[id] == 1) // friend | ||
551 : | { | ||
552 : | new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo) | ||
553 : | new wpnname[32] | ||
554 : | |||
555 : | if (wpnid) | ||
556 : | xmod_get_wpnname(wpnid, wpnname, 31) | ||
557 : | |||
558 : | set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -1) | ||
559 : | ShowSyncHudMsg(id, g_status_sync, "%s -- %d HP / %d AP / %s", name, get_user_health(pid), get_user_armor(pid), wpnname) | ||
560 : | } else { | ||
561 : | set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -1) | ||
562 : | ShowSyncHudMsg(id, g_status_sync, "%s", name) | ||
563 : | } | ||
564 : | } | ||
565 : | } | ||
566 : | |||
567 : | public eNewRound() | ||
568 : | { | ||
569 : | if (read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0,floatround_floor)) | ||
570 : | { | ||
571 : | g_firstBlood = 1 | ||
572 : | g_C4Timer = 0 | ||
573 : | ++g_roundCount | ||
574 : | |||
575 : | if (RoundCounter) | ||
576 : | { | ||
577 : | set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, -1) | ||
578 : | ShowSyncHudMsg(0, g_announce_sync, "%L", LANG_PLAYER, "PREPARE_FIGHT", g_roundCount) | ||
579 : | } | ||
580 : | |||
581 : | if (RoundCounterSound) | ||
582 : | play_sound("misc/prepare") | ||
583 : | |||
584 : | if (KillingStreak) | ||
585 : | { | ||
586 : | new appl[32], ppl, i | ||
587 : | get_players(appl, ppl, "ac") | ||
588 : | |||
589 : | for (new a = 0; a < ppl; ++a) | ||
590 : | { | ||
591 : | i = appl[a] | ||
592 : | |||
593 : | if (g_streakKills[i][0] >= 2) | ||
594 : | client_print(i, print_chat, "* %L", i, "KILLED_ROW", g_streakKills[i][0]) | ||
595 : | else if (g_streakKills[i][1] >= 2) | ||
596 : | client_print(i, print_chat, "* %L", i, "DIED_ROUNDS", g_streakKills[i][1]) | ||
597 : | } | ||
598 : | } | ||
599 : | } | ||
600 : | } | ||
601 : | |||
602 : | public eRestart() | ||
603 : | { | ||
604 : | eEndRound() | ||
605 : | g_roundCount = 0 | ||
606 : | g_firstBlood = 1 | ||
607 : | } | ||
608 : | |||
609 : | public eEndRound() | ||
610 : | { | ||
611 : | g_C4Timer = -2 | ||
612 : | g_LastOmg = 0.0 | ||
613 : | remove_task(8038) | ||
614 : | g_LastAnnounce = 0 | ||
615 : | } | ||
616 : | |||
617 : | public checkKills(param[]) | ||
618 : | { | ||
619 : | new id = param[0] | ||
620 : | new a = param[1] | ||
621 : | |||
622 : | if (a == g_multiKills[id][0]) | ||
623 : | { | ||
624 : | a -= 3 | ||
625 : | |||
626 : | if (a > -1) | ||
627 : | { | ||
628 : | if (a > 6) | ||
629 : | { | ||
630 : | a = 6 | ||
631 : | } | ||
632 : | |||
633 : | if (MultiKill) | ||
634 : | { | ||
635 : | new name[32] | ||
636 : | |||
637 : | get_user_name(id, name, 31) | ||
638 : | set_hudmessage(255, 0, 100, 0.05, 0.50, 2, 0.02, 6.0, 0.01, 0.1, -1) | ||
639 : | |||
640 : | ShowSyncHudMsg(0, g_left_sync, g_MultiKillMsg[a], name, LANG_PLAYER, "WITH", g_multiKills[id][0], LANG_PLAYER, "KILLS", g_multiKills[id][1], LANG_PLAYER, "HS") | ||
641 : | } | ||
642 : | |||
643 : | if (MultiKillSound) | ||
644 : | { | ||
645 : | new sound[24] | ||
646 : | format(sound, 23, "misc/%s", g_Sounds[a]) | ||
647 : | play_sound(sound) | ||
648 : | } | ||
649 : | } | ||
650 : | g_multiKills[id] = {0, 0} | ||
651 : | } | ||
652 : | } | ||
653 : | |||
654 : | public chickenKill() | ||
655 : | { | ||
656 : | if (ItalyBonusKill) | ||
657 : | announceEvent(0, "KILLED_CHICKEN") | ||
658 : | } | ||
659 : | |||
660 : | public radioKill() | ||
661 : | { | ||
662 : | if (ItalyBonusKill) | ||
663 : | announceEvent(0, "BLEW_RADIO") | ||
664 : | } | ||
665 : | |||
666 : | announceEvent(id, message[]) | ||
667 : | { | ||
668 : | new name[32] | ||
669 : | |||
670 : | get_user_name(id, name, 31) | ||
671 : | set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, -1) | ||
672 : | ShowSyncHudMsg(0, g_announce_sync, "%L", LANG_PLAYER, message, name) | ||
673 : | } | ||
674 : | |||
675 : | public eBombPickUp(id) | ||
676 : | { | ||
677 : | if (BombPickUp) | ||
678 : | announceEvent(id, "PICKED_BOMB") | ||
679 : | } | ||
680 : | |||
681 : | public eBombDrop() | ||
682 : | { | ||
683 : | if (BombDrop) | ||
684 : | announceEvent(g_Planter, "DROPPED_BOMB") | ||
685 : | } | ||
686 : | |||
687 : | public eGotBomb(id) | ||
688 : | { | ||
689 : | g_Planter = id | ||
690 : | |||
691 : | if (BombReached && read_data(1) == 2 && g_LastOmg < get_gametime()) | ||
692 : | { | ||
693 : | g_LastOmg = get_gametime() + 15.0 | ||
694 : | announceEvent(g_Planter, "REACHED_TARGET") | ||
695 : | } | ||
696 : | } | ||
697 : | |||
698 : | public bombTimer() | ||
699 : | { | ||
700 : | if (--g_C4Timer > 0) | ||
701 : | { | ||
702 : | if (BombCountVoice) | ||
703 : | { | ||
704 : | if (g_C4Timer == 30 || g_C4Timer == 20) | ||
705 : | { | ||
706 : | new temp[64] | ||
707 : | |||
708 : | num_to_word(g_C4Timer, temp, 63) | ||
709 : | format(temp, 63, "^"vox/%s seconds until explosion^"", temp) | ||
710 : | play_sound(temp) | ||
711 : | } | ||
712 : | else if (g_C4Timer < 11) | ||
713 : | { | ||
714 : | new temp[64] | ||
715 : | |||
716 : | num_to_word(g_C4Timer, temp, 63) | ||
717 : | format(temp, 63, "^"vox/%s^"", temp) | ||
718 : | play_sound(temp) | ||
719 : | } | ||
720 : | } | ||
721 : | if (BombCountDef && g_Defusing) | ||
722 : | client_print(g_Defusing, print_center, "%d", g_C4Timer) | ||
723 : | } | ||
724 : | else | ||
725 : | remove_task(8038) | ||
726 : | } | ||
727 : | |||
728 : | public bomb_planted(planter) | ||
729 : | { | ||
730 : | g_Defusing = 0 | ||
731 : | |||
732 : | if (BombPlanted) | ||
733 : | announceEvent(planter, "SET_UP_BOMB") | ||
734 : | |||
735 : | g_C4Timer = get_cvar_num("mp_c4timer") | ||
736 : | set_task(1.0, "bombTimer", 8038, "", 0, "b") | ||
737 : | } | ||
738 : | |||
739 : | public bomb_planting(planter) | ||
740 : | { | ||
741 : | if (BombPlanting) | ||
742 : | announceEvent(planter, "PLANT_BOMB") | ||
743 : | } | ||
744 : | |||
745 : | public bomb_defusing(defuser) | ||
746 : | { | ||
747 : | if (BombDefusing) | ||
748 : | announceEvent(defuser, "DEFUSING_BOMB") | ||
749 : | |||
750 : | g_Defusing = defuser | ||
751 : | } | ||
752 : | |||
753 : | public bomb_defused(defuser) | ||
754 : | { | ||
755 : | if (BombDefused) | ||
756 : | announceEvent(defuser, "DEFUSED_BOMB") | ||
757 : | } | ||
758 : | |||
759 : | public bomb_explode(planter, defuser) | ||
760 : | { | ||
761 : | if (BombFailed && defuser) | ||
762 : | announceEvent(defuser, "FAILED_DEFU") | ||
763 : | } | ||
764 : | |||
765 : | public play_sound(sound[]) | ||
766 : | { | ||
767 : | new players[32], pnum | ||
768 : | get_players(players, pnum, "c") | ||
769 : | new i | ||
770 : | |||
771 : | for (i = 0; i < pnum; i++) | ||
772 : | { | ||
773 : | if (is_user_connecting(players[i])) | ||
774 : | continue | ||
775 : | |||
776 : | client_cmd(players[i], "spk %s", sound) | ||
777 : | } | ||
778 : | } |
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |