· 8 years ago · May 23, 2018, 07:48 PM
1/*================ Aktualizacje ================
2
3~ Wersja "0.1" >> Pierwsze wydanie pluginu.
4~ Wersja "0.2" >> Przepisanie pluginy na nowy syntax.
5~ Wersja "0.3" >> Dodano wiadomości na czacie przy danych eventach.
6~ Wersja "0.4" >> Poprawa wszelkich bugów oraz błędów.
7~ Wersja "0.5" >> Dodano translacje oraz poprawiono wyglÄ…d kodu.
8~ Wersja "0.6" >> Dodano Panel Administracyjny, poprawiono wiele błędów, usunięto pare zbędnych menu oraz usunięto translacje.
9~ Wersja "0.7" >> Zmieniono 3/4 kodu, poprawiono wygląd kodu oraz naprawiono wiele błędów i bugów.
10~ Wersja "0.8" >> Usunięto informacje na czacie pod !ranga, teraz !ranga wyświetla menu z wszystkimi potrzebnymi informacjami dla użytkownika.
11~ Wersja "0.9" >> Plugin został przepisany na zapis MYSQL.
12~ Wersja "1.0" >> Wszystko.
13~ Wersja "1.1" >> Dodanie odznak by xBonio, poprawiono kod na mysql, optymalizacja pluginu, dodanie nowych opcji do panelu administratora. //Zezwolenie by xBonio na użycie kodu z jego pluginu.
14~ Wersja "1.2" >> Dodanie topki w menu, dodanie kilku cvarów, poprawiono kod, oraz mała optymalizacja.
15~ Wersja "1.3" >> Dodanie punktów za zabójstwo z noża.
16~ Wersja "1.4" >> Naprawiono nativy, dodano nowe cvary, zoptymalizowano kod.
17~ Wersja "1.5" >> Dodano overlaye + dodatkowo została dodana opcja by włączyć/wyłączyć overlay'e.
18
19//Special credits for n.o.x, helped me a lot with mysql, and some other stuff, big love <3.
20//Special credits for xBonio, for his coins code.
21
22==============================================*/
23
24/* << compiller definitions >> */
25#pragma semicolon 1
26#pragma newdecls required
27
28/* << includes >> */
29#include <sourcemod>
30#include <sdktools>
31#include <sdkhooks>
32#include <cstrike>
33#include <clientprefs>
34#include <multicolors>
35#include <h2k_rangi>
36
37// ----------------------------- Macro ---------------------------
38#define LoopItemCount(%1) for(int %1 = 0; %1 < menu.ItemCount; %1++)
39#define LoopRanks(%1) for(int %1 = 1; %1 < sizeof g_iRankTable; %1++)
40#define LoopClients(%1) for(int %1 = 1; %1 <= MaxClients; %1++)\
41if(IsClientInGame(%1))
42
43#define ILOSC_COIN 200
44
45/* << ConVars >> */
46ConVar g_Cvar_PluginEnabled;
47ConVar g_Cvar_PunktyRozgrzewka;
48ConVar g_Cvar_MinimalnaIloscGraczy;
49ConVar g_Cvar_PunktyKill;
50ConVar g_Cvar_PunktyKillVip;
51ConVar g_Cvar_PunktyHs;
52ConVar g_Cvar_PunktyHsVip;
53ConVar g_Cvar_PunktyBombEnabled;
54ConVar g_Cvar_PunktyBombPlanted;
55ConVar g_Cvar_PunktyBombPlantedVip;
56ConVar g_Cvar_PunktyBombDefused;
57ConVar g_Cvar_PunktyBombDefusedVip;
58ConVar g_Cvar_PunktyWygranaRundaVip;
59ConVar g_Cvar_PunktyWygranaRunda;
60ConVar g_Cvar_PunktyMvpEnabled;
61ConVar g_Cvar_PunktyMvpPlayerVip;
62ConVar g_Cvar_PunktyMvpPlayer;
63ConVar g_Cvar_PunktyKnifeEnabled;
64ConVar g_Cvar_PunktyKnifeKill;
65ConVar g_Cvar_PunktyKnifeKillVip;
66ConVar g_Cvar_HudEnabled;
67
68bool g_bHUD[MAXPLAYERS+1];
69
70/* << Handles >> */
71Handle g_hSql;
72
73/* << Integers >> */
74int g_MinimalnaIloscGraczy; //taken from kento_rankme
75int g_iPoints[MAXPLAYERS+1];
76int g_iRank[MAXPLAYERS+1];
77int iCoin[65];
78int iCoin_Enable[65];
79
80int g_iRankTable[] =
81{
82 25,
83 50,
84 100,
85 250,
86 500,
87 750,
88 1000,
89 1250,
90 1500,
91 2000,
92 2500,
93 5000,
94 7500,
95 10000,
96 12500,
97 15000,
98 17000,
99 24000,
100 24000
101};
102
103char g_sRanksNames[][] =
104{
105 "Unranked",
106 "Silver 1",
107 "Silver 2",
108 "Silver 3",
109 "Silver 4",
110 "Silver Elite",
111 "Silver Elite Master",
112 "Gold Nova 1",
113 "Gold Nova 2",
114 "Gold Nova 3",
115 "Gold Nova Master",
116 "Master Guardian 1",
117 "Master Guardian 2",
118 "Master Guardian Elite",
119 "DMG",
120 "Legendary Eagle",
121 "Legendary Eagle Master",
122 "Supreme Master First Class",
123 "The Global Elite"
124};
125
126char nazwa_coina[ILOSC_COIN+1][300] = {
127 "Brak odznaki",
128 "Five Year Service Coin",
129
130 /*** Major ***/
131 "DH.SS 2013 Champion",
132 "DH.SS 2013 Finalist",
133 "DH.SS 2013 Semifinalist",
134 "DH.SS 2013 Quarterfinalist",
135
136 "EMS.O.K 2014 Champion",
137 "EMS.O.K 2014 Finalist",
138 "EMS.O.K 2014 Semifinalist",
139 "EMS.O.K 2014 Quarterfinalist",
140
141 "ESL.O.C 2014 Champion",
142 "ESL.O.C 2014 Finalist",
143 "ESL.O.C 2014 Semifinalist",
144 "ESL.O.C 2014 Quarterfinalist",
145 "ESL.O.C 2014 PEC Bronze",
146 "ESL.O.C 2014 PEC Silver",
147 "ESL.O.C 2014 PEC Gold",
148
149 "DH.W 2014 Champion",
150 "DH.W 2014 Finalist",
151 "DH.W 2014 Semifinalist",
152 "DH.W 2014 Quarterfinalist",
153 "DH.W 2014 PEC Bronze",
154 "DH.W 2014 PEC Silver",
155 "DH.W 2014 PEC Gold",
156
157 "ESL.O.K 2015 Champion",
158 "ESL.O.K 2015 Finalist",
159 "ESL.O.K 2015 Semifinalist",
160 "ESL.O.K 2015 Quarterfinalist",
161 "ESL.O.K 2015 PEC Bronze",
162 "ESL.O.K 2015 PEC Silver",
163 "ESL.O.K 2015 PEC Gold",
164
165 "ESL.O.C 2015 Champion",
166 "ESL.O.C 2015 Finalist",
167 "ESL.O.C 2015 Semifinalist",
168 "ESL.O.C 2015 Quarterfinalist",
169 "ESL.O.C 2015 PEC Bronze",
170 "ESL.O.C 2015 PEC Silver",
171 "ESL.O.C 2015 PEC Gold",
172
173 "DH.C-N 2015 PEC Bronze",
174 "DH.C-N 2015 PEC Silver",
175 "DH.C-N 2015 PEC Gold",
176 "DH.C-N 2015 FT Bronze",
177 "DH.C-N 2015 FT Silver",
178 "DH.C-N 2015 FT Gold",
179 "DH.C-N 2015 Champion",
180 "DH.C-N 2015 Finalist",
181 "DH.C-N 2015 Semifinalist",
182 "DH.C-N 2015 Quarterfinalist",
183
184 "MLG.C 2016 PEC Bronze",
185 "MLG.C 2016 PEC Silver",
186 "MLG.C 2016 PEC Gold",
187 "MLG.C 2016 FT Bronze",
188 "MLG.C 2016 FT Silver",
189 "MLG.C 2016 FT Gold",
190 "MLG.C 2016 Champion",
191 "MLG.C 2016 Finalist",
192 "MLG.C 2016 Semifinalist",
193 "MLG.C 2016 Quarterfinalist",
194
195 "ESL.O.C 2016 Champion",
196 "ESL.O.C 2016 Finalist",
197 "ESL.O.C 2016 Semifinalist",
198 "ESL.O.C 2016 Quarterfinalist",
199 "ESL.O.C 2016 PEC Bronze",
200 "ESL.O.C 2016 PEC Silver",
201 "ESL.O.C 2016 PEC Gold",
202 "ESL.O.C 2016 FT Bronze",
203 "ESL.O.C 2016 FT Silver",
204 "ESL.O.C 2016 FT Gold",
205
206 "E.Atlanta 2017 Champion",
207 "E.Atlanta 2017 Finalist",
208 "E.Atlanta 2017 Semifinalist",
209 "E.Atlanta 2017 Quarterfinalist",
210 "E.Atlanta 2017 PEC Bronze",
211 "E.Atlanta 2017 PEC Silver",
212 "E.Atlanta 2017 PEC Gold",
213
214 "PGL.K 2017 Champion",
215 "PGL.K 2017 Finalist",
216 "PGL.K 2017 Semifinalist",
217 "PGL.K 2017 Quarterfinalist",
218 "PGL.K 2017 PEC Bronze",
219 "PGL.K 2017 PEC Silver",
220 "PGL.K 2017 PEC Gold",
221
222 "E.Boston 2018 Champion",
223 "E.Boston 2018 Finalist",
224 "E.Boston 2018 Semifinalist",
225 "E.Boston 2018 Quarterfinalist",
226 "E.Boston 2018 PEC Bronze",
227 "E.Boston 2018 PEC Silver",
228 "E.Boston 2018 PEC Gold",
229
230 /*** Operation ***/
231 "Op.Payback Challenge",
232 "Op.Payback Silver",
233 "Op.Payback Gold",
234 "Op.Bravo Challenge",
235 "Op.Bravo Silver",
236 "Op.Bravo Gold",
237 "Op.Pheonix Challenge",
238 "Op.Pheonix Silver",
239 "Op.Pheonix Gold",
240 "Op.Breakout Challenge",
241 "Op.Breakout Silver",
242 "Op.Breakout Gold",
243 "Op.Vanguard Challenge",
244 "Op.Vanguard Silver",
245 "Op.Vanguard Gold",
246 "Op.Bloodhound Challenge",
247 "Op.Bloodhound Silver",
248 "Op.Bloodhound Gold",
249 "Op.Wildfire Challenge",
250 "Op.Wildfire Silver",
251 "Op.Wildfire Gold",
252 "Op.Hydra Challenge",
253 "Op.Hydra Silver",
254 "Op.Hydra Gold",
255 "Op.Hydra Diamond",
256
257 /*** Collectible Pin ***/
258 "C-Pin.O > Dust II",
259 "C-Pin.O > Guardian Elite",
260 "C-Pin.O > Mirage",
261 "C-Pin.O > Inferno",
262 "C-Pin.O > Italy",
263 "C-Pin.O > Victory",
264 "C-Pin.O > Militia",
265 "C-Pin.O > Nuke",
266 "C-Pin.O > Train",
267 "C-Pin.O > Guardian",
268 "C-Pin.O > Tactics",
269 "C-Pin.O > Guardian 2",
270 "C-Pin.O > Bravo",
271 "C-Pin.O > Baggage",
272 "C-Pin.O > Phoenix",
273 "C-Pin.O > Office",
274 "C-Pin.O > Cobblestone",
275 "C-Pin.O > Overpass",
276 "C-Pin.O > Bloodhound",
277 "C-Pin.O > Cache",
278 "C-Pin.O > Valeria Phoenix",
279 "C-Pin.O > Chrome",
280 "C-Pin.O > Guardian 3",
281 "C-Pin.O > Canals",
282 "C-Pin.O > Welcome to the Clutch",
283 "C-Pin.O > Death Sentence",
284 "C-Pin.O > Inferno 2",
285 "C-Pin.O > Wildfire",
286 "C-Pin.O > Easy Peasy",
287 "C-Pin.O > Aces High",
288 "C-Pin.O > Hydra",
289 "C-Pin.O > Howl",
290 "C-Pin.O > Brigadier General",
291
292 "C-Pin > Dust II",
293 "C-Pin > Guardian Elite",
294 "C-Pin > Mirage",
295 "C-Pin > Inferno",
296 "C-Pin > Italy",
297 "C-Pin > Victory",
298 "C-Pin > Militia",
299 "C-Pin > Nuke",
300 "C-Pin > Train",
301 "C-Pin > Guardian",
302 "C-Pin > Tactics",
303 "C-Pin > Guardian 2",
304 "C-Pin > Bravo",
305 "C-Pin > Baggage",
306 "C-Pin > Pheonix",
307 "C-Pin > Office",
308 "C-Pin > Cobblestone",
309 "C-Pin > Overpass",
310 "C-Pin > Bloodhound",
311 "C-Pin > Cache",
312 "C-Pin > Valeria Phoenix",
313 "C-Pin > Chrome",
314 "C-Pin > Guardian 3",
315 "C-Pin > Canals",
316 "C-Pin > Welcome to the Clutch",
317 "C-Pin > Death Sentence",
318 "C-Pin > Inferno 2",
319 "C-Pin > Wildfire",
320 "C-Pin > Easy Peasy",
321 "C-Pin > Aces High",
322 "C-Pin > Hydra",
323 "C-Pin > Howl",
324 "C-Pin > Brigadier General",
325
326 /*** Community ***/
327 "CCoin 2015 - 1",
328 "CCoin 2015 - 2",
329 "CCoin 2016 - 1",
330 "CCoin 2016 - 2",
331 "CCoin 2016 - 3",
332 "CCoin 2016 - 4",
333 "CCoin 2016 - 5",
334 "CCoin 2016 - 6",
335 "CCoin 2017 - 1",
336 "CCoin 2017 - 2",
337 "CCoin 2017 - 3",
338 "CCoin 2017 - 4",
339 "CCoin 2017 - 5",
340 "CCoin 2017 - 6",
341 "CCoin 2017 - 7",
342 "CCoin 2018 - 1",
343 "CCoin 2018 - 2",
344 "CCoin 2018 - 3",
345 "CCoin 2018 - 4",
346 "CCoin 2018 - 5",
347 "CCoin 2018 - 6"
348};
349
350int id_coina[ILOSC_COIN+1] = {
351 0, 874,
352 /*** Major ***/
353 875, 876, 877, 878, //DreamHack SteelSeries 2013
354 879, 880, 881, 882, //ESL One Katowice 2014
355 883, 884, 885, 886, 887, 888, 889, //ESL One Cologne 2014
356 890, 891, 892, 893, 894, 895, 896, //DreamHack Winter 2014
357 897, 898, 899, 900, 901, 902, 903, //ESL One Katowice 2015
358 904, 905, 906, 907, 908, 909, 910, //ESL One Cologne 2015
359 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, //DreamHack Cluj-Napoca 2015
360 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, //MLG Columbus 2016
361 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, //ESL One Cologne 2017
362 941, 942, 943, 944, 945, 946, 947, //ELEAGUE Atlanta 2017
363 948, 949, 950, 951, 952, 953, 954, //PGL Krakow 2017
364 955, 956, 957, 958, 959, 960, 961, //ELEAGUE Boston 2018
365 /*** Operation ***/
366 1001, 1002, 1003, //Payback
367 1013, 1014, 1015, //Bravo
368 1024, 1025, 1026, //Pheonix
369 1028, 1029, 1030, //Breakout
370 1316, 1317, 1318, //Vanguard
371 1327, 1328, 1329, //Bloodhound
372 1336, 1337, 1338, //Wildfire
373 4353, 4534, 4535, 4536, //Hydra
374 /*** Collectible ***/
375 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010,
376 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, 6020,
377 6021, 6022,
378 6023, 6024, 6025, 6026, 6027, 6028, 6029, 6030, 6031, 6032, 6033, //Original
379 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110,
380 6111, 6112, 6113, 6114, 6115, 6116, 6117, 6118, 6119, 6120,
381 6121, 6122,
382 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, //No Original
383 /*** Community ***/
384 1331, 1332, //2015
385 1339, 1340, 1341, 1342, 1343, 1344, //2016
386 1357, 1358, 1359, 1360, 1361, 1362, 1363, //2017
387 1367, 1368, 1369, 1370, 1371, 1372 //2018
388};
389
390/* << Informacje o pluginie >> */
391public Plugin myinfo =
392{
393 name = "[CS:GO] Rangi",
394 author = "Mesharsky & n.o.x",
395 description = "[CS:GO] Rangi & Odznaki + System punktów",
396 version = "1.4",
397 url = "http://steamcommunity.com/id/mesharskyH2K"
398};
399
400public void OnPluginStart()
401{
402 CreateTimer(0.1, Timer_UpdateHUD, INVALID_HANDLE, TIMER_REPEAT);
403
404 // <<- Eventy ->>
405 HookEvent("round_start", Event_RoundStart);
406 HookEvent("round_end", Event_RoundEnd);
407 HookEvent("round_mvp", Event_RoundMvp);
408 HookEvent("player_death", Event_PlayerDeath);
409 HookEvent("bomb_planted", Event_BombPlanted);
410 HookEvent("bomb_defused", Event_BombDefused);
411
412 // <<- Komendy Gracza ->>
413 RegConsoleCmd("sm_hud", CMD_HUD);
414 RegConsoleCmd("sm_ranga", CMD_MenuGlowne);
415 RegConsoleCmd("sm_lvl", CMD_MenuGlowne);
416 RegConsoleCmd("sm_coin", Command_CoinMenu);
417 RegConsoleCmd("sm_coins", Command_CoinMenu);
418
419 // <<- Komendy Admina ->>
420 RegAdminCmd("sm_panel", CMD_PanelRangi, ADMFLAG_ROOT); //Panel na flage "z"
421
422 // <<- ConVary ->>
423 g_Cvar_PluginEnabled = CreateConVar("rangi_enabled", "1", "Włączyć czy wyłączyć rangi?");
424 g_Cvar_PunktyRozgrzewka = CreateConVar("rangi_rozgrzewka", "0", "Czy naliczać punkty podczas rozgrzewki?");
425 g_Cvar_PunktyBombEnabled = CreateConVar("rangi_bomb_enabled", "1", "Czy włączyć naliczanie punktów za podłożenie/rozbrojenie bomby?");
426 g_Cvar_PunktyMvpEnabled = CreateConVar("rangi_mvp_enabled", "1", "Czy włączyć naliczanie punktów za bycie MVP?");
427 g_Cvar_PunktyKnifeEnabled = CreateConVar("rangi_knife_enabled", "1", "Czy włączyć naliczanie punktów za zabójstwo z noża?");
428 g_Cvar_HudEnabled = CreateConVar("rangi_hud_enabled", "1", "Hud na środku ekranu ma być włączony czy wyłączony?");
429 g_Cvar_MinimalnaIloscGraczy = CreateConVar("rangi_ilosc_graczy", "2", "Ile musi być graczy żeby punkty działały.", _, true, 0.0);
430 g_Cvar_PunktyKill = CreateConVar("rangi_kill", "1", "Ila dodawać punktów za zabójstwo");
431 g_Cvar_PunktyKillVip = CreateConVar("rangi_kill_vip", "2", "Ile dodawać punktów za zabójstwo (VIP)");
432 g_Cvar_PunktyHs = CreateConVar("rangi_kill_hs", "3", "Ile dodawać punktów za headshot'a?");
433 g_Cvar_PunktyHsVip = CreateConVar("rangi_kill_hs_vip", "5", "Ile dodawać punktów za headshot'a (VIP)");
434 g_Cvar_PunktyBombPlanted = CreateConVar("rangi_bomb_planted", "2", "Ile dodawać punktów za podłożenie bomby");
435 g_Cvar_PunktyBombPlantedVip = CreateConVar("rangi_bomb_planted_vip", "5", "Ile dodawać pkt za podłożenie bomby (VIP)");
436 g_Cvar_PunktyBombDefused = CreateConVar("rangi_bomb_defused", "2", "Ile dodawać punktów za rozbrojenie bomby");
437 g_Cvar_PunktyBombDefusedVip = CreateConVar("rangi_bomb_defused_vip", "5", "Ile dodawać pkt za rozbrojenie bomby (VIP)");
438 g_Cvar_PunktyWygranaRunda = CreateConVar("wygrana_runda", "2", "Ile dodawać punktów za wygranie rundy");
439 g_Cvar_PunktyWygranaRundaVip = CreateConVar("wygrana_runda_vip", "4", "Ile dodawać punktów za wygranie rundy (VIP)");
440 g_Cvar_PunktyMvpPlayer = CreateConVar("mvp_player", "3", "Ile dostanie punktów gracz MVP?");
441 g_Cvar_PunktyMvpPlayerVip = CreateConVar("mvp_player_vip", "5", "Ile dostanie punktów gracz MVP (VIP)?");
442 g_Cvar_PunktyKnifeKill = CreateConVar("rangi_kill_knife", "4", "Ile dostanie punktów gracz za zabójstwo z noża?");
443 g_Cvar_PunktyKnifeKillVip = CreateConVar("rangi_kill_knife_vip", "7", "Ile dostanie punktów gracz za zabójstwo z noża (VIP)?");
444
445 // <<- Generowanie pliku do edycji ConVar ->>
446 AutoExecConfig(true, "H2K_RangiCoins_Config");
447
448 // <<- MySQL Shit ->>
449 DB_Connect();
450}
451
452public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
453{
454 CreateNative("Rangi_GetPointsAmount", Native_GetPointsAmount);
455 CreateNative("Rangi_GetRank", Native_GetRank);
456 CreateNative("Rangi_GetCoin", Native_GetCoin);
457
458 RegPluginLibrary("h2k_rangi");
459
460 return APLRes_Success;
461}
462
463public void OnConfigsExecuted() {
464 g_MinimalnaIloscGraczy = GetConVarInt(g_Cvar_MinimalnaIloscGraczy);
465}
466
467/* << Na starcie mapy >> */
468public void OnMapStart()
469{
470 SDKHook(FindEntityByClassname(MAXPLAYERS + 1, "cs_player_manager"), SDKHook_ThinkPost, Hook_OnThinkPost);
471
472 // Download and precache overlays
473 char sBuffer[64];
474 LoopRanks(i)
475 {
476 Format(sBuffer, sizeof(sBuffer), "materials/kat_overlay/rank_%d.vmt", i);
477 AddFileToDownloadsTable(sBuffer);
478 Format(sBuffer, sizeof(sBuffer), "materials/kat_overlay/rank_%d.vtf", i);
479 AddFileToDownloadsTable(sBuffer);
480 Format(sBuffer, sizeof(sBuffer), "kat_overlay/rank_%d.vmt", i);
481 PrecacheDecal(sBuffer, true);
482 Format(sBuffer, sizeof(sBuffer), "kat_overlay/rank_%d.vmt", i);
483 PrecacheDecal(sBuffer, true);
484 }
485
486 // <<- Pobieramy nasz dźwięk ->>
487 AddFileToDownloadsTable("sound/kat/rangi/awans.mp3");
488 PrecacheSound("*/kat/rangi/awans.mp3", true);
489}
490
491/* << Na końcu mapy >> */
492public void OnMapEnd()
493{
494 LoopClients(i)
495 DB_SaveInfo(i); //Zapis pod koniec mapy
496 SDKUnhook(FindEntityByClassname(MAXPLAYERS + 1, "cs_player_manager"), SDKHook_ThinkPost, Hook_OnThinkPost);
497}
498
499public void OnClientPutInServer(int client)
500{
501 if (!g_Cvar_PluginEnabled.BoolValue)
502 {
503 return;
504 }
505
506 g_iRank[client] = 0;
507 g_iPoints[client] = 0;
508 iCoin[client] = 0;
509 iCoin_Enable[client] = 0;
510
511 if (g_Cvar_HudEnabled.BoolValue)
512 {
513 g_bHUD[client] = true;
514 }
515 else
516 {
517 g_bHUD[client] = false;
518 }
519
520 DB_LoadInfo(client);
521}
522
523public void OnClientDisconnect(int client)
524{
525 if (!g_Cvar_PluginEnabled.BoolValue)
526 {
527 return;
528 }
529
530 DB_SaveInfo(client);
531
532 g_iRank[client] = 0;
533 g_iPoints[client] = 0;
534 iCoin[client] = 0;
535 iCoin_Enable[client] = 0;
536}
537
538/* << MySQL Shit >> */
539public Action DB_Connect()
540{
541 if (!g_Cvar_PluginEnabled.BoolValue)
542 {
543 return;
544 }
545
546 if(SQL_CheckConfig("h2k_rangi"))
547 {
548 char DBBuffer[512];
549 g_hSql = SQL_Connect("h2k_rangi", true, DBBuffer, sizeof(DBBuffer));
550 if (g_hSql == INVALID_HANDLE)
551 LogError("[H2K] Could not connect: %s", DBBuffer);
552 else
553 {
554 SQL_LockDatabase(g_hSql);
555 SQL_FastQuery(g_hSql, "CREATE TABLE IF NOT EXISTS `h2k_user` (`auth_data` VARCHAR(64) NOT NULL, `name` VARCHAR(64) NOT NULL, `points` INT NOT NULL, `rank` INT NOT NULL, `coin` INT(6), `ma_coina` INT(1), UNIQUE KEY `auth_data` (`auth_data`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;");
556 SQL_UnlockDatabase(g_hSql);
557 }
558 }
559 else
560 SetFailState("Nie mozna odnalezc konfiguracji 'h2k_rangi' w databases.cfg.");
561}
562
563public void DB_LoadInfo(int client)
564{
565 if(g_hSql != INVALID_HANDLE)
566 {
567 char _authid[64];
568 GetClientAuthId(client, AuthId_Steam2, _authid, 63);
569
570 char sQuery[256];
571 Format(sQuery, sizeof(sQuery), "SELECT points, rank, coin, ma_coina FROM h2k_user WHERE auth_data = '%s';", _authid);
572
573 SQL_LockDatabase(g_hSql);
574 Handle hQuery = SQL_Query(g_hSql, sQuery);
575
576 if(hQuery == INVALID_HANDLE)
577 {
578 char blad[255];
579 SQL_GetError(g_hSql, blad, sizeof(blad));
580 LogError("Nie mozna odszukac z tabeli. (blad: %s)", blad);
581 CloseHandle(g_hSql);
582 }
583 else if(SQL_FetchRow(hQuery))
584 {
585 g_iPoints[client] = SQL_FetchInt(hQuery, 0);
586 g_iRank[client] = SQL_FetchInt(hQuery, 1);
587 iCoin[client] = SQL_FetchInt(hQuery, 2);
588 iCoin_Enable[client] = SQL_FetchInt(hQuery, 3);
589 }
590 else
591 {
592 g_iRank[client] = 0;
593 g_iPoints[client] = 0;
594 iCoin[client] = 0;
595 iCoin_Enable[client] = 0;
596 }
597 CloseHandle(hQuery);
598 SQL_UnlockDatabase(g_hSql);
599 }
600}
601
602public void DB_SaveInfo(int client)
603{
604 if(!IsValidClient(client) || IsFakeClient(client))
605 return;
606
607 char authid[64];
608 if(!GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid)))
609 return;
610
611 char nick[64];
612 char EscapedName[64];
613
614 GetClientName(client, nick, sizeof(nick));
615 SQL_EscapeString(g_hSql, nick, EscapedName, sizeof(nick));
616
617 char sQuery[5000];
618 Format(sQuery, sizeof(sQuery), "INSERT INTO `h2k_user` (auth_data, name, points, rank, coin, ma_coina) VALUES ('%s', '%s', %d, %d, %i, %i) ON DUPLICATE KEY UPDATE name=VALUES(name), points=VALUES(points), rank=VALUES(rank), coin=VALUES(coin), ma_coina=VALUES(ma_coina)", authid, EscapedName, g_iPoints[client], g_iRank[client], iCoin[client], iCoin_Enable[client]);
619 SQL_TQuery(g_hSql, DB_SaveInfoCallback, sQuery);
620}
621
622public Action PokazTopke(int client, int args)
623{
624 char query[256];
625
626 DataPack info_pack = new DataPack();
627 info_pack.WriteCell(client); // client
628
629 Format(query,sizeof(query), "SELECT name, points, rank FROM h2k_user WHERE 1 ORDER BY points DESC");
630 SQL_TQuery(g_hSql, DB_TopCallback, query, info_pack);
631 return Plugin_Handled;
632}
633
634public void DB_TopCallback(Handle owner, Handle hndl, const char[] error, DataPack info_pack)
635{
636 if(hndl == INVALID_HANDLE)
637 {
638 LogError("[TOP] Query failed! %s", error);
639 return;
640 }
641
642 info_pack.Reset(); // Get some info !
643 int client = info_pack.ReadCell();
644
645 if(client == 0 || !IsClientInGame(client))
646 return;
647
648 delete info_pack;
649
650 int i;
651
652 Menu menu = new Menu(TOP_Handler, MENU_ACTIONS_ALL);
653 menu.SetTitle("[#TOP] Nick - Ranga - Punkty");
654
655 char menu_item[256];
656
657 while(SQL_FetchRow(hndl))
658 {
659 i++;
660 SQL_FetchString(hndl, 0, menu_item, sizeof(menu_item));
661
662 Format(menu_item, sizeof(menu_item), "#%d - %s - %s - [ %d ]", i, menu_item, g_sRanksNames[SQL_FetchInt(hndl, 2)], SQL_FetchInt(hndl, 1));
663 menu.AddItem("", menu_item);
664 }
665
666 if(i == 0)
667 menu.AddItem("no_records", "Wygląda na to, że ranking jest czysty.");
668
669 menu.ExitButton = true;
670 menu.Display(client, 0);
671}
672
673public int TOP_Handler(Menu menu, MenuAction action, int param1, int param2)
674{
675 return 0;
676}
677
678public Action Potwierdz_Reset(int client, int args)
679{
680 Menu menureset = new Menu(Menu_ResetRang);
681 menureset.SetTitle("Czy na pewno chcesz wyczyścyć wszystkie rangi & punkty & odznaki graczy?\nPamiętaj że tej akcji nie możesz cofnąć!");
682 menureset.AddItem("opcja1", "» NIE!");
683 menureset.AddItem("opcja1", "» NIE!");
684 menureset.AddItem("opcja2", "» TAK!!!");
685 menureset.AddItem("opcja1", "» NIE!");
686 menureset.ExitButton = true;
687 menureset.Display(client, 0);
688}
689
690public int Menu_ResetRang(Menu menureset, MenuAction action, int client, int itemNum)
691{
692 if (action == MenuAction_Select)
693 {
694 char info[32];
695 GetMenuItem(menureset, itemNum, info, sizeof(info));
696
697 if (strcmp(info, "opcja1") == 0) {
698 CMD_PanelRangi(client, 0);
699 }
700 else if (strcmp(info, "opcja2") == 0) {
701 Wyczysc_Wszystko(client, 0);
702 }
703 }
704
705 else if (action == MenuAction_End) {
706 CloseHandle(menureset);
707 }
708}
709
710public Action Wyczysc_Wszystko(int client, int args)
711{
712 char sQuery[1000];
713 Format(sQuery, sizeof(sQuery), "DELETE FROM `h2k_user` WHERE 1=1");
714 SQL_TQuery(g_hSql, DB_SaveInfoCallback, sQuery);
715
716 LoopClients(i){
717 if(IsClientInGame(i))
718 OnClientPutInServer(i);
719 }
720
721 CPrintToChat(client, "★ {lightred}[Katujemy.eu -> Rangi]{yellow} Baza została wyczyszczona.");
722 return Plugin_Handled;
723}
724
725public int DB_SaveInfoCallback(Handle owner, Handle query, const char[] error, any data)
726{
727 if(query == INVALID_HANDLE)
728 {
729 LogError("[RANKS] Failed to save client info (error: %s)", error);
730 return;
731 }
732}
733
734/* << Eventy >> */
735public Action Event_PlayerDeath(Event hEvent, const char[] chName, bool bDontBroadcast)
736{
737 if (!g_Cvar_PluginEnabled.BoolValue)
738 {
739 return;
740 }
741
742 if (GetCurrentPlayers() < g_MinimalnaIloscGraczy)
743 return;
744
745 bool headshot = GetEventBool(hEvent, "headshot");
746 int attacker = GetClientOfUserId(hEvent.GetInt("attacker"));
747 int client = GetClientOfUserId(hEvent.GetInt("userid"));
748 int iPoints;
749
750 char weapon[64];
751 GetEventString(hEvent, "weapon", weapon, sizeof(weapon));
752 ReplaceString(weapon, sizeof(weapon), "weapon_", "");
753
754 if (StrEqual(weapon, "knife_default_ct") || StrEqual(weapon, "knife_default_t") || StrEqual(weapon, "knife_t") || StrEqual(weapon, "knifegg") || StrEqual(weapon, "knife_flip") || StrEqual(weapon, "knife_gut") || StrEqual(weapon, "knife_karambit") || StrEqual(weapon, "bayonet") || StrEqual(weapon, "knife_m9_bayonet") || StrEqual(weapon, "knife_butterfly") || StrEqual(weapon, "knife_tactical") || StrEqual(weapon, "knife_falchion") || StrEqual(weapon, "knife_push") || StrEqual(weapon, "knife_survival_bowie")) {
755 weapon = "knife";
756 }
757
758 if (JestRozgrzewka() && !g_Cvar_PunktyRozgrzewka.BoolValue)
759 {
760 return;
761 }
762
763 if (!attacker)
764 return;
765
766 if (attacker == client)
767 return;
768
769 if (!IsValidClient(attacker))
770 return;
771
772 if (IsPlayerVIP(attacker)) // Zamiast pakować tutaj kupe kodu można użyć operatora warunkowego: warunek ? wyrazenie_true : wyrazenie_false
773 {
774 iPoints = headshot?GetConVarInt(g_Cvar_PunktyHsVip):GetConVarInt(g_Cvar_PunktyKillVip);
775 GivePoints(attacker, iPoints);
776 CPrintToChat(attacker, "★ {lightred}[Rangi -> Vip]{yellow} Jako {green}VIP {yellow}otrzymałeś {green}%i {yellow}punktów za {darkred}%s.", iPoints, headshot?"HeadShota":"zabójstwo");
777
778 if (StrEqual(weapon, "knife"))
779 {
780 if (!g_Cvar_PunktyKnifeEnabled.BoolValue)
781 {
782 return;
783 }
784
785 iPoints = GetConVarInt(g_Cvar_PunktyKnifeKillVip);
786 GivePoints(attacker, iPoints);
787 CPrintToChat(attacker, "★ {lightred}[Rangi -> Vip]{yellow} Jako {green}VIP {yellow}otrzymałeś {green}%i {yellow}punktów za zabójstwo z noża", iPoints);
788 }
789 }
790 else
791 {
792 iPoints = headshot?GetConVarInt(g_Cvar_PunktyHs):GetConVarInt(g_Cvar_PunktyKill);
793 GivePoints(attacker, iPoints);
794 CPrintToChat(attacker, "★ {lightred}[Rangi]{yellow} Otrzymałeś {green}%i {yellow}punkty za {darkred}%s.", iPoints, headshot?"HeadShota":"zabójstwo");
795
796 if (StrEqual(weapon, "knife"))
797 {
798 if (!g_Cvar_PunktyKnifeEnabled.BoolValue)
799 {
800 return;
801 }
802
803 iPoints = GetConVarInt(g_Cvar_PunktyKnifeKill);
804 GivePoints(attacker, iPoints);
805 CPrintToChat(attacker, "★ {lightred}[Rangi]{yellow} Otrzymałeś {green}%i {yellow}punktów za zabójstwo z noża", iPoints);
806 }
807 }
808}
809
810public Action Event_BombPlanted(Handle hEvent, const char[] chName, bool bDontBroadcast)
811{
812 if (!g_Cvar_PluginEnabled.BoolValue)
813 {
814 return;
815 }
816
817 if (!g_Cvar_PunktyBombEnabled.BoolValue)
818 {
819 return;
820 }
821
822 if (GetCurrentPlayers() < g_MinimalnaIloscGraczy)
823 return;
824
825 int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
826
827 if (!IsValidClient(client))
828 return;
829
830 int iPoints = IsPlayerVIP(client)?GetConVarInt(g_Cvar_PunktyBombPlantedVip):GetConVarInt(g_Cvar_PunktyBombPlanted);
831 GivePoints(client, iPoints);
832 CPrintToChat(client, "★ {lightred}%s{green}%i {yellow}punktów za {darkred}Podłożenie Bomby", IsPlayerVIP(client)?"[Rangi -> Vip]{yellow} Jako {green}VIP {yellow}otrzymałeś ":"[Rangi]{yellow} Otrzymałeś ", iPoints);
833}
834
835public Action Event_BombDefused(Handle hEvent, const char[] chName, bool bDontBroadcast)
836{
837 if (!g_Cvar_PluginEnabled.BoolValue)
838 {
839 return;
840 }
841
842 if (!g_Cvar_PunktyBombEnabled.BoolValue)
843 {
844 return;
845 }
846
847 if (GetCurrentPlayers() < g_MinimalnaIloscGraczy)
848 return;
849
850 int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
851
852 if (!IsValidClient(client))
853 return;
854
855 int iPoints = IsPlayerVIP(client)?GetConVarInt(g_Cvar_PunktyBombDefusedVip):GetConVarInt(g_Cvar_PunktyBombDefused);
856 GivePoints(client, iPoints);
857 CPrintToChat(client, "★ {lightred}%s{green}%i {yellow}punktów za {darkred}Rozbrojenie Bomby", IsPlayerVIP(client)?"[Rangi -> Vip]{yellow} Jako {green}VIP {yellow}otrzymałeś ":"[Rangi]{yellow} Otrzymałeś ", iPoints);
858}
859
860public Action Event_RoundMvp(Event event, char[] chName, bool bDontBroadcast)
861{
862 if (!g_Cvar_PluginEnabled.BoolValue)
863 {
864 return;
865 }
866
867 if (!g_Cvar_PunktyMvpEnabled.BoolValue)
868 {
869 return;
870 }
871
872 if (GetCurrentPlayers() < g_MinimalnaIloscGraczy)
873 return;
874
875 int client = GetClientOfUserId(GetEventInt(event, "userid"));
876
877 if (!IsValidClient(client))
878 return;
879
880 int iPoints = IsPlayerVIP(client)?GetConVarInt(g_Cvar_PunktyMvpPlayerVip):GetConVarInt(g_Cvar_PunktyMvpPlayer);
881 GivePoints(client, iPoints);
882 CPrintToChat(client, "★ {lightred}%s{green}%i {yellow}punktów za {darkred}bycie graczem MVP", IsPlayerVIP(client)?"[Rangi -> Vip]{yellow} Jako {green}VIP {yellow}otrzymałeś ":"[Rangi]{yellow} Otrzymałeś ", iPoints);
883}
884
885public Action Event_RoundStart(Event event, char[] chName, bool bDontBroadcast)
886{
887 if (!g_Cvar_PluginEnabled.BoolValue)
888 {
889 return;
890 }
891
892 if (GetCurrentPlayers() < g_MinimalnaIloscGraczy)
893 {
894 CPrintToChatAll("{olive}=====================================");
895 CPrintToChatAll("★ {lightred}[Rangi]{yellow} Na serwerze jest {darkred}zbyt mało{yellow} graczy by system rang naliczał punkty, potrzeba minimum {lightred}%i{yellow}, graczy.", GetConVarInt(g_Cvar_MinimalnaIloscGraczy));
896 CPrintToChatAll("{olive}=====================================");
897 }
898}
899
900public Action Event_RoundEnd(Event event, char[] chName, bool bDontBroadcast)
901{
902 if (!g_Cvar_PluginEnabled.BoolValue)
903 {
904 return;
905 }
906
907 if (GetCurrentPlayers() < g_MinimalnaIloscGraczy)
908 return;
909
910 int winnerTeam = GetEventInt(event, "winner");
911
912 if (JestRozgrzewka() && !g_Cvar_PunktyRozgrzewka.BoolValue)
913
914 LoopClients(i)
915 {
916 if(GetClientTeam(i) == winnerTeam)
917 {
918 int iPoints = IsPlayerVIP(i)?GetConVarInt(g_Cvar_PunktyWygranaRundaVip):GetConVarInt(g_Cvar_PunktyWygranaRunda);
919 GivePoints(i, iPoints);
920 CPrintToChat(i, "★ {lightred}%s{green}%i {yellow}punkty za {darkred}Wygranie Rundy", IsPlayerVIP(i)?"[Rangi -> Vip]{yellow} Jako {green}VIP {yellow}Otrzymałeś ":"[Rangi]{yellow} Otrzymałeś ", iPoints);
921 DB_SaveInfo(i); // Zapis tylko i wyłącznie pod koniec rundy, po co zapychać serwer..
922 }
923 }
924}
925
926public Action Command_CoinMenu(int client, int args)
927{
928 if(!IsValidClient(client)) return;
929
930 Handle MenuHandle = CreateMenu(Command_CoinHandler);
931 SetMenuTitle(MenuHandle, "Wybierz odznake:\n- Aktualna: [ %s ]\n", nazwa_coina[iCoin[client]]);
932 if(iCoin[client] == 0)
933 {
934 char text[310];
935 Format(text, sizeof(text), "> %s <", nazwa_coina[0]);
936 AddMenuItem(MenuHandle, "0", text, ITEMDRAW_DISABLED);
937 }
938 else
939 AddMenuItem(MenuHandle, "0", nazwa_coina[0], ITEMDRAW_DEFAULT);
940 if(iCoin[client] == 1)
941 {
942 char text[310];
943 Format(text, sizeof(text), "> %s <", nazwa_coina[1]);
944 AddMenuItem(MenuHandle, "1", text, ITEMDRAW_DISABLED);
945 }
946 else
947 AddMenuItem(MenuHandle, "1", nazwa_coina[1], ITEMDRAW_DEFAULT);
948
949 AddMenuItem(MenuHandle, "2", "Major Pin");
950 AddMenuItem(MenuHandle, "3", "Operation Pin");
951 AddMenuItem(MenuHandle, "4", "Collectible Pin");
952 AddMenuItem(MenuHandle, "5", "Community Coin");
953
954 DisplayMenu(MenuHandle, client, 30);
955}
956public int Command_CoinHandler(Handle menu, MenuAction action, int client, int itemNum)
957{
958 if(action == MenuAction_Select)
959 {
960 char info[10];
961 GetMenuItem(menu, itemNum, info, sizeof(info));
962
963 if(StrEqual(info, "0"))
964 {
965 iCoin[client] = 0;
966 iCoin_Enable[client] = 0;
967 CPrintToChat(client, "★ {lightred}[Katujemy.eu -> Odznaki] {yellow}Wyłączyłeś odznake");
968 }
969 else if(StrEqual(info, "1"))
970 {
971 iCoin[client] = 1;
972 iCoin_Enable[client] = 1;
973 CPrintToChat(client, "★ {lightred}[Katujemy.eu -> Odznaki] {yellow}Ustawiłeś odznake: {darkred}%s", nazwa_coina[1]);
974 }
975 else if(StrEqual(info, "2"))
976 MajorPin(client);
977 else if(StrEqual(info, "3"))
978 OperationPin(client);
979 else if(StrEqual(info, "4"))
980 CollectiblenPin(client);
981 else if(StrEqual(info, "5"))
982 CommunityPin(client);
983 }
984 else if(action == MenuAction_End)
985 CloseHandle(menu);
986}
987
988public Action MajorPin(int client)
989{
990 if(!IsValidClient(client)) return;
991
992 Handle MenuHandle = CreateMenu(CoinHandler);
993 SetMenuTitle(MenuHandle, "Wybierz odznake:\n- Aktualna: [ %s ]\n", nazwa_coina[iCoin[client]]);
994 char numerek[6];
995 for(int i = 2; i <= 88; i++)
996 {
997 IntToString(i, numerek, sizeof(numerek));
998 if(i == iCoin[client])
999 {
1000 char text[310];
1001 Format(text, sizeof(text), "> %s <", nazwa_coina[i]);
1002 AddMenuItem(MenuHandle, numerek, text, ITEMDRAW_DISABLED);
1003 }
1004 else
1005 AddMenuItem(MenuHandle, numerek, nazwa_coina[i], ITEMDRAW_DEFAULT);
1006 }
1007 DisplayMenu(MenuHandle, client, 30);
1008}
1009public Action OperationPin(int client)
1010{
1011 if(!IsValidClient(client)) return;
1012
1013 Handle MenuHandle = CreateMenu(CoinHandler);
1014 SetMenuTitle(MenuHandle, "Wybierz odznake:\n- Aktualna: [ %s ]\n", nazwa_coina[iCoin[client]]);
1015 char numerek[6];
1016 for(int i = 89; i <= 113; i++)
1017 {
1018 IntToString(i, numerek, sizeof(numerek));
1019 if(i == iCoin[client])
1020 {
1021 char text[310];
1022 Format(text, sizeof(text), "> %s <", nazwa_coina[i]);
1023 AddMenuItem(MenuHandle, numerek, text, ITEMDRAW_DISABLED);
1024 }
1025 else
1026 AddMenuItem(MenuHandle, numerek, nazwa_coina[i], ITEMDRAW_DEFAULT);
1027 }
1028 DisplayMenu(MenuHandle, client, 30);
1029}
1030public Action CollectiblenPin(int client)
1031{
1032 if(!IsValidClient(client)) return;
1033
1034 Handle MenuHandle = CreateMenu(CoinHandler);
1035 SetMenuTitle(MenuHandle, "Wybierz odznake:\n- Aktualna: [ %s ]\n", nazwa_coina[iCoin[client]]);
1036 char numerek[6];
1037 for(int i = 114; i <= 179; i++)
1038 {
1039 IntToString(i, numerek, sizeof(numerek));
1040 if(i == iCoin[client])
1041 {
1042 char text[310];
1043 Format(text, sizeof(text), "> %s <", nazwa_coina[i]);
1044 AddMenuItem(MenuHandle, numerek, text, ITEMDRAW_DISABLED);
1045 }
1046 else
1047 AddMenuItem(MenuHandle, numerek, nazwa_coina[i], ITEMDRAW_DEFAULT);
1048 }
1049 DisplayMenu(MenuHandle, client, 30);
1050}
1051
1052public Action CommunityPin(int client)
1053{
1054 if(!IsValidClient(client)) return;
1055
1056 Handle MenuHandle = CreateMenu(CoinHandler);
1057 SetMenuTitle(MenuHandle, "Wybierz odznake:\n- Aktualna: [ %s ]\n", nazwa_coina[iCoin[client]]);
1058 char numerek[6];
1059 for(int i = 180; i <= 200; i++)
1060 {
1061 IntToString(i, numerek, sizeof(numerek));
1062 if(i == iCoin[client])
1063 {
1064 char text[310];
1065 Format(text, sizeof(text), "> %s <", nazwa_coina[i]);
1066 AddMenuItem(MenuHandle, numerek, text, ITEMDRAW_DISABLED);
1067 }
1068 else
1069 AddMenuItem(MenuHandle, numerek, nazwa_coina[i], ITEMDRAW_DEFAULT);
1070 }
1071 DisplayMenu(MenuHandle, client, 30);
1072}
1073
1074public int CoinHandler(Handle menu, MenuAction action, int client, int itemNum)
1075{
1076 if(action == MenuAction_Select)
1077 {
1078 char info[10];
1079 GetMenuItem(menu, itemNum, info, sizeof(info));
1080 iCoin[client] = StringToInt(info);
1081 iCoin_Enable[client] = 1;
1082
1083 DB_SaveInfo(client);
1084
1085 CPrintToChat(client, "★ {lightred}[Katujemy.eu -> Odznaki] {yellow}Ustawiłeś odznake: {darkred}%s", nazwa_coina[iCoin[client]]);
1086 }
1087 else if(action == MenuAction_End)
1088 CloseHandle(menu);
1089}
1090
1091/* << Cmds >>*/
1092public Action CMD_MenuGlowne(int client, int args)
1093{
1094 Menu menuglowne = new Menu(Menu_menuglowne);
1095
1096 if(g_iRank[client] == sizeof(g_iRankTable)-1)
1097 menuglowne.SetTitle("Witaj, [ %N ]\nPosiadasz aktualnie: [ %d ] punktów\nTwoja ranga to: [ %s ]\nTwoja odznaka to: [ %s ]", client, g_iPoints[client], g_sRanksNames[g_iRank[client]], nazwa_coina[iCoin[client]]);
1098 else
1099 menuglowne.SetTitle("Witaj, %N\nPosiadasz aktualnie: [ %d ] punktów\nTwoja ranga to: [ %s ]\nTwoja odznaka to: [ %s ]\nAwans na rangę [ %s ] jak zdobędziesz [ %d ] punktów", client, g_iPoints[client], g_sRanksNames[g_iRank[client]], nazwa_coina[iCoin[client]], g_sRanksNames[g_iRank[client]+1], g_iRankTable[g_iRank[client]+1]);
1100 menuglowne.AddItem("1", "", ITEMDRAW_SPACER);
1101 menuglowne.AddItem("option1", "» Menu Gracza");
1102 menuglowne.AddItem("option2", "» Pokaż top graczy na serwerze!");
1103
1104 if (GetAdminFlag(GetUserAdmin(client), Admin_Root)) //Jeżeli masz flagę "Z" to ta opcja w menu ci się wyświetli
1105 menuglowne.AddItem("option5", "» Panel Administratora");
1106
1107 menuglowne.ExitButton = true;
1108 menuglowne.Display(client, 0);
1109}
1110
1111public Action CMD_PanelRangi(int client, int args)
1112{
1113 Menu menu = new Menu(Rangi_MenuHandler);
1114 menu.SetTitle("[Rangi] Panel Administratora");
1115
1116 menu.AddItem("addpts", "Dodaj Punkty");
1117 menu.AddItem("rempts", "Zabierz Punkty");
1118 menu.AddItem("setrank", "Ustaw Range");
1119 menu.AddItem("removeall", "Zresetuj wszystkim graczom rangi/punkty");
1120 menu.AddItem("showpoints", "Pokaz Punkty Graczy Online");
1121
1122 menu.ExitButton = true;
1123 menu.Display(client, 60);
1124
1125 return Plugin_Handled;
1126}
1127
1128public Action CreateMenu_Glowne(int client)
1129{
1130 Menu menu = new Menu(Menu_Glowne);
1131 menu.SetTitle("Rangi -> Menu Gracza");
1132 menu.AddItem("option1", "» System Punktow");
1133 menu.AddItem("option2", "» Ile PKT trzeba na range?");
1134 menu.AddItem("option3", "» Zresetuj swoje punkty!");
1135 menu.AddItem("option4", "» Włącz/Wyłącz HUD na środku ekranu");
1136 menu.AddItem("option5", "» Wybierz odznake");
1137 menu.ExitButton = true;
1138 menu.Display(client, 0);
1139}
1140
1141public Action CreateMenu_Potwierdzenie(int client)
1142{
1143 Menu menu = new Menu(Menu_Potwierdzenie);
1144 menu.SetTitle("Rangi -> Czy jesteś pewien że chcesz zresetować swoje statystyki?");
1145 menu.AddItem("option1", "» Tak");
1146 menu.AddItem("option2", "» Nie");
1147 menu.ExitButton = true;
1148 menu.Display(client, 0);
1149}
1150
1151public Action CreateMenu_PokazPunkty(int client)
1152{
1153 Menu punkty = new Menu(Menu_Punkty);
1154 punkty.SetTitle("[Rangi -> Menu Punktów] Wybierz jedną z opcji");
1155 punkty.AddItem("option1", "» Zwykły gracz");
1156 punkty.AddItem("option2", "» Gracz VIP");
1157 punkty.AddItem("option3", "Powrót do menu");
1158 punkty.ExitButton = false;
1159 punkty.Display(client, 0);
1160}
1161
1162public Action CreateMenu_PokazMenuRang(int client)
1163{
1164 char sItem[64];
1165 Menu menurang = new Menu(Menu_MenuRang);
1166 menurang.SetTitle("[Rangi -> PKT na danÄ… range]\n");
1167 LoopRanks(i)
1168 {
1169 Format(sItem, sizeof(sItem), "%s - %d punktów\n", g_sRanksNames[i], g_iRankTable[i - 1]);
1170 menurang.AddItem("", sItem);
1171 }
1172 menurang.AddItem("option2", "Wroc do menu");
1173 menurang.ExitButton = false;
1174 menurang.Display(client, 0);
1175}
1176
1177public Action CreateMenu_Punkty(int client)
1178{
1179 Menu punktygracz = new Menu(Menu_PunktyInfo);
1180 punktygracz.SetTitle("[Rangi -> System Punktów Gracz]\n\nZwykłe zabójstwo - %i punkt\nZabójstwo w głowę - %i punkty\nPodłożenie bomby - %i punkty\nRozbrojenie bomby - %i punkty\nWygranie rundy - %i punkty", GetConVarInt(g_Cvar_PunktyKill), GetConVarInt(g_Cvar_PunktyHs), GetConVarInt(g_Cvar_PunktyBombPlanted), GetConVarInt(g_Cvar_PunktyBombDefused), GetConVarInt(g_Cvar_PunktyWygranaRunda));
1181 punktygracz.AddItem("option1", "Wroc");
1182 punktygracz.ExitButton = false;
1183 punktygracz.Display(client, 0);
1184}
1185
1186public Action CreateMenu_PunktyVip(int client)
1187{
1188 Menu punktyvip = new Menu(Menu_PunktyInfo);
1189 punktyvip.SetTitle("[Rangi -> System Punktów Vip]\nZwykłe zabójstwo - %i punkty\nZabójstwo w głowę - %i punktów\nPodłożenie bomby - %i punktów\nRozbrojenie bomby - %i punktów\nWygranie rundy - %i punkty", GetConVarInt(g_Cvar_PunktyKillVip), GetConVarInt(g_Cvar_PunktyHsVip), GetConVarInt(g_Cvar_PunktyBombPlantedVip), GetConVarInt(g_Cvar_PunktyBombDefusedVip), GetConVarInt(g_Cvar_PunktyWygranaRundaVip));
1190 punktyvip.AddItem("option1", "Wroc");
1191 punktyvip.ExitButton = false;
1192 punktyvip.Display(client, 0);
1193}
1194
1195public Action CreateMenu_AdminSelect(int client, int iSelect)
1196{
1197 Menu next = new Menu(SelectPlayer_MenuHandler);
1198 next.SetTitle("Rangi -> Wybor Gracza");
1199
1200 LoopClients(i)
1201 {
1202 char format[64];
1203 Format(format, sizeof format, "%d", i);
1204 char name[MAX_NAME_LENGTH + 1];
1205 GetClientName(i, name, sizeof name);
1206 next.AddItem(format, name);
1207 }
1208
1209 char sInfo[12];
1210 Format(sInfo, sizeof(sInfo), "%d", iSelect);
1211 next.AddItem("-SELECT-", sInfo, ITEMDRAW_IGNORE);
1212 next.ExitButton = true;
1213 next.Display(client, 60);
1214}
1215
1216public Action CreateMenu_AddRemovePoints(int admin, int client, int iSelect)
1217{
1218 Menu next = new Menu(PointAct_MenuHandler);
1219 char frm[128];
1220 char pname[MAX_NAME_LENGTH + 1];
1221 GetClientName(client, pname, sizeof pname);
1222 Format(frm, sizeof frm, "Rangi - %s", pname);
1223 next.SetTitle(frm);
1224
1225 next.AddItem("1", "1 Punkt");
1226 next.AddItem("5", "5 Punktow");
1227 next.AddItem("10", "10 Punktow");
1228 next.AddItem("20", "20 Punktow");
1229 next.AddItem("50", "50 Punktow");
1230 next.AddItem("100", "100 Punktow");
1231 next.AddItem("200", "200 Punktow");
1232 next.AddItem("500", "500 Punktow");
1233 next.AddItem("1000", "1000 Punktow");
1234 next.AddItem("2500", "2500 Punktow");
1235 next.AddItem("5000", "5000 Punktow");
1236
1237 char sInfo[12];
1238 Format(sInfo, sizeof(sInfo), "%d", iSelect);
1239 next.AddItem("-SELECT-", sInfo, ITEMDRAW_IGNORE);
1240 Format(sInfo, sizeof(sInfo), "%d", client);
1241 next.AddItem("-CLIENT-", sInfo, ITEMDRAW_IGNORE);
1242
1243 next.ExitButton = true;
1244 next.Display(admin, 60);
1245}
1246
1247public int Menu_menuglowne(Handle menuglowne, MenuAction action, int client, int itemNum)
1248{
1249 if (action == MenuAction_Select)
1250 {
1251 char info[32];
1252 GetMenuItem(menuglowne, itemNum, info, sizeof(info));
1253
1254 if (StrEqual(info, "option1"))
1255 CreateMenu_Glowne(client);
1256 else if (StrEqual(info, "option2"))
1257 PokazTopke(client, 0);
1258 else if (StrEqual(info, "option5"))
1259 CMD_PanelRangi(client, 0);
1260 }
1261 else if (action == MenuAction_End)
1262 CloseHandle(menuglowne);
1263}
1264
1265public int Menu_Glowne(Handle menu, MenuAction action, int client, int itemNum)
1266{
1267 if (action == MenuAction_Select)
1268 {
1269 char info[32];
1270 GetMenuItem(menu, itemNum, info, sizeof(info));
1271
1272 if (StrEqual(info, "option1"))
1273 CreateMenu_PokazPunkty(client);
1274 else if (StrEqual(info, "option2"))
1275 CreateMenu_PokazMenuRang(client);
1276 else if (StrEqual(info, "option3"))
1277 CreateMenu_Potwierdzenie(client);
1278 else if (StrEqual(info, "option4"))
1279 ClientCommand(client, "sm_hud");
1280 else if (StrEqual(info, "option5"))
1281 ClientCommand(client, "sm_coin");
1282 }
1283 else if (action == MenuAction_End)
1284 CloseHandle(menu);
1285}
1286
1287public int Menu_Potwierdzenie(Handle menu, MenuAction action, int client, int itemNum)
1288{
1289 if (action == MenuAction_Select)
1290 {
1291 char info[32];
1292 GetMenuItem(menu, itemNum, info, sizeof(info));
1293
1294 if (StrEqual(info, "option1"))
1295 {
1296 g_iPoints[client] = 0;
1297 CheckRank(client);
1298 CPrintToChat(client, "★ {lightred}[Rangi -> Reset] {yellow}Twoje punkty zostały {green}Pomyślnie {yellow}wyzerowane!");
1299 }
1300 else if (StrEqual(info, "option2"))
1301 CreateMenu_Glowne(client);
1302 }
1303 else if (action == MenuAction_End)
1304 CloseHandle(menu);
1305}
1306
1307public int Menu_Punkty(Handle punkty, MenuAction action, int client, int itemNum)
1308{
1309 if (action == MenuAction_Select)
1310 {
1311 char info[32];
1312 GetMenuItem(punkty, itemNum, info, sizeof(info));
1313
1314 if (StrEqual(info, "option1"))
1315 CreateMenu_Punkty(client);
1316 else if (StrEqual(info, "option2"))
1317 CreateMenu_PunktyVip(client);
1318 else if (StrEqual(info, "option3"))
1319 CreateMenu_Glowne(client);
1320 }
1321 else if (action == MenuAction_End)
1322 CloseHandle(punkty);
1323}
1324
1325public int Menu_PunktyInfo(Handle punktyvip, MenuAction action, int client, int itemNum)
1326{
1327 if (action == MenuAction_Select)
1328 {
1329 char info[32];
1330 GetMenuItem(punktyvip, itemNum, info, sizeof(info));
1331
1332 if (StrEqual(info, "option1"))
1333 CreateMenu_PokazPunkty(client);
1334 }
1335 else if (action == MenuAction_End)
1336 CloseHandle(punktyvip);
1337}
1338
1339public int Menu_MenuRang(Handle menurang, MenuAction action, int client, int itemNum)
1340{
1341 if (action == MenuAction_Select)
1342 {
1343 char info[32];
1344 GetMenuItem(menurang, itemNum, info, sizeof(info));
1345
1346 if (StrEqual(info, "option2"))
1347 CreateMenu_Glowne(client);
1348 }
1349 else if (action == MenuAction_End)
1350 CloseHandle(menurang);
1351}
1352
1353public int Rangi_MenuHandler(Menu menu, MenuAction action, int param1, int param2)
1354{
1355 if (action == MenuAction_Select)
1356 {
1357 char item[32];
1358 bool found = menu.GetItem(param2, item, sizeof(item));
1359 if (found)
1360 {
1361 if (StrEqual(item, "addpts"))
1362 {
1363 CreateMenu_AdminSelect(param1, 1);
1364 }
1365 else if (StrEqual(item, "rempts"))
1366 {
1367 CreateMenu_AdminSelect(param1, 2);
1368 }
1369 else if (StrEqual(item, "setrank"))
1370 {
1371 CreateMenu_AdminSelect(param1, 3);
1372 }
1373 else if (StrEqual(item, "removeall"))
1374 {
1375 Potwierdz_Reset(param1, 4);
1376 }
1377 else if (StrEqual(item, "showpoints"))
1378 {
1379 Menu next = new Menu(Empty_MenuHandler);
1380 next.SetTitle("Rangi -> Punkty");
1381
1382 LoopClients(i)
1383 {
1384 char format[128];
1385 char cid[16];
1386 IntToString(i, cid, sizeof cid);
1387 char name[MAX_NAME_LENGTH + 1];
1388 GetClientName(i, name, sizeof name);
1389 Format(format, sizeof format, "%s - %d punktow", name, g_iPoints[i]);
1390 next.AddItem(cid, format);
1391 }
1392
1393 next.ExitButton = true;
1394 next.Display(param1, 60);
1395 }
1396 }
1397 }
1398 else if (action == MenuAction_End)
1399 delete menu;
1400}
1401
1402public int PointAct_MenuHandler(Menu menu, MenuAction action, int param1, int param2)
1403{
1404 char sInfo[12], sDane[12];
1405 int iSelect, client;
1406 LoopItemCount(i)
1407 {
1408 menu.GetItem(i, sInfo, sizeof(sInfo), _, sDane, sizeof(sDane));
1409 if(StrEqual(sInfo, "-SELECT-"))
1410 iSelect = StringToInt(sDane);
1411
1412 if(StrEqual(sInfo, "-CLIENT-"))
1413 client = StringToInt(sDane);
1414 }
1415 if (action == MenuAction_Select)
1416 {
1417 char item[32];
1418 menu.GetItem(param2, item, sizeof(item));
1419 if (IsValidClient(client))
1420 {
1421 if (iSelect == 1)
1422 g_iPoints[client] += StringToInt(item);
1423 else if (iSelect == 2)
1424 g_iPoints[client] -= StringToInt(item);
1425
1426 CreateMenu_AddRemovePoints(param1, client, iSelect);
1427 CheckRank(client);
1428 }
1429 }
1430 else if (action == MenuAction_End)
1431 delete menu;
1432}
1433
1434public int SelectPlayer_MenuHandler(Menu menu, MenuAction action, int param1, int param2)
1435{
1436 char sInfo[12], sDane[12];
1437 int iSelect;
1438 LoopItemCount(i)
1439 {
1440 menu.GetItem(i, sInfo, sizeof(sInfo), _, sDane, sizeof(sDane));
1441 if(StrEqual(sInfo, "-SELECT-"))
1442 iSelect = StringToInt(sDane);
1443 }
1444 if (action == MenuAction_Select)
1445 {
1446 char item[32];
1447 bool found = menu.GetItem(param2, item, sizeof(item));
1448 if (found)
1449 {
1450 int client = StringToInt(item);
1451 if (IsValidClient(client))
1452 {
1453 if (iSelect != 3)
1454 CreateMenu_AddRemovePoints(param1, client, iSelect);
1455 else
1456 {
1457 Menu next = new Menu(SetRank_MenuHandler);
1458 char frm[128];
1459 char pname[MAX_NAME_LENGTH + 1];
1460 GetClientName(client, pname, sizeof pname);
1461 Format(frm, sizeof frm, "Rangi - %s", pname);
1462 next.SetTitle(frm);
1463
1464 char sNum[12];
1465 LoopRanks(i)
1466 {
1467 Format(sNum, sizeof(sNum), "%d", i);
1468 next.AddItem(sNum, g_sRanksNames[i]);
1469 }
1470 Format(sNum, sizeof(sNum), "%d", client);
1471 next.AddItem("-CLIENT-", sNum, ITEMDRAW_IGNORE);
1472 next.ExitButton = true;
1473 next.Display(param1, 60);
1474 }
1475 }
1476 }
1477 }
1478 else if (action == MenuAction_End)
1479 delete menu;
1480}
1481
1482public int Empty_MenuHandler(Menu menu, MenuAction action, int param1, int param2)
1483{
1484 if (action == MenuAction_End) delete menu;
1485}
1486
1487public int SetRank_MenuHandler(Menu menu, MenuAction action, int param1, int param2)
1488{
1489 char sInfo[32], sDane[32];
1490 int client;
1491 LoopItemCount(i)
1492 {
1493 menu.GetItem(i, sInfo, sizeof(sInfo), _, sDane, sizeof(sDane));
1494 if(StrEqual(sInfo, "-CLIENT-"))
1495 client = StringToInt(sDane);
1496 }
1497 if (action == MenuAction_Select)
1498 {
1499 char item[32];
1500 menu.GetItem(param2, item, sizeof(item));
1501 if (IsValidClient(client))
1502 {
1503 int iNewRank = StringToInt(item);
1504 CPrintToChat(client, "★ {lightred}[ADMIN]{yellow} Admin zmienił twoją rangę na {lightred}%s", g_sRanksNames[iNewRank]);
1505 CPrintToChat(param1, "★ {lightred}[ADMIN]{yellow} Zmieniłeś rangę graczowi {green}%N {yellow}na {lightred}%s", client, g_sRanksNames[iNewRank]);
1506 g_iPoints[client] = g_iRankTable[iNewRank - 1];
1507 CheckRank(client);
1508 }
1509 }
1510 else if (action == MenuAction_End)
1511 delete menu;
1512}
1513
1514public Action Hook_OnThinkPost(int iEnt)
1515{
1516 static int iCoinOffset = -1;
1517 if(iCoinOffset == -1)
1518 iCoinOffset = FindSendPropInfo("CCSPlayerResource", "m_nActiveCoinRank");
1519
1520 int tempCoin[65];
1521 GetEntDataArray(iEnt, iCoinOffset, tempCoin, 65);
1522 for(int i = 1; i <= MaxClients; i++)
1523 {
1524 if(!IsValidClient(i)) continue;
1525 if(iCoin_Enable[i])
1526 tempCoin[i] = id_coina[iCoin[i]];
1527 }
1528
1529 SetEntDataArray(iEnt, FindSendPropInfo("CCSPlayerResource", "m_iCompetitiveRanking"), g_iRank, MAXPLAYERS+1);
1530 SetEntDataArray(iEnt, iCoinOffset, tempCoin, 65, 4, true);
1531 Handle hBuffer = StartMessageAll("ServerRankRevealAll");
1532 if (hBuffer == null)
1533 PrintToServer("ServerRankRevealAll = INVALID_HANDLE");
1534 else
1535 EndMessage();
1536}
1537
1538public Action CMD_HUD(int client, int args)
1539{
1540 if(!IsValidClient(client))
1541 return Plugin_Handled;
1542
1543 g_bHUD[client] = !g_bHUD[client];
1544 PrintToChat(client, "HUD \x04%s\x01.", g_bHUD[client] ? "Wlaczony" : "Wylaczony");
1545
1546 return Plugin_Handled;
1547}
1548
1549public Action Timer_UpdateHUD(Handle Timer)
1550{
1551 LoopClients(i)
1552 {
1553 if(!g_bHUD[i])
1554 continue;
1555 UpdateHUD(i);
1556 }
1557 return Plugin_Continue;
1558}
1559
1560public void UpdateHUD(int client)
1561{
1562 char sHintText[512];
1563
1564 if (IsPlayerAlive(client))
1565 {
1566 Format(sHintText, 512, "<font face='Stratum2'>");
1567 Format(sHintText, 512, "%s<font color='#FFFFFF'>Ranga:</font> <font color='#C9AE28'>[ %s ]</font>\n", sHintText, g_sRanksNames[g_iRank[client]]);
1568 Format(sHintText, 512, "%s<font color='#FFFFFF'>Odznaka:</font> <font color='#C9AE28'>[ %s ]</font>\n", sHintText, nazwa_coina[iCoin[client]]);
1569 }
1570 else
1571 {
1572 int spect = GetEntProp(client, Prop_Send, "m_iObserverMode");
1573 if (spect == 4 || spect == 5)
1574 {
1575 int target = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
1576 if (target != -1 && IsValidClient(target))
1577 {
1578 Format(sHintText, 512, "<font size='16'> | <font color='#C9AE28'>Statystyki gracza</font> \n| Ranga: [ %s ] |\n | Punkty: [ %d ] |", g_sRanksNames[g_iRank[target]], g_iPoints[target]);
1579 }
1580 }
1581 }
1582 PrintHintText(client, sHintText);
1583}
1584
1585/* << Check for ranks>> */
1586void CheckRank(int client)
1587{
1588 bool bRankUp = false;
1589 bool bRankDown = false;
1590
1591 if(!IsClientConnected(client))
1592 return;
1593
1594 while(g_iPoints[client] >= g_iRankTable[g_iRank[client]] && g_iRank[client] < sizeof(g_iRankTable)-1) // Jedziemy z pętelką aby po dodaniu pkt mogło awansować np. 3 razy
1595 {
1596 g_iRank[client]++;
1597 bRankUp = true;
1598 }
1599
1600 if(g_iRank[client] > 0)
1601 {
1602 while(g_iPoints[client] < g_iRankTable[g_iRank[client]-1]) // to samo, z tym, że szukamy spadku
1603 {
1604 g_iRank[client]--;
1605 bRankDown = true;
1606 }
1607 }
1608
1609 if(bRankUp)
1610 {
1611 CPrintToChat(client, "★ {lightred}[Rangi -> Awans]{yellow} Gratulacje! właśnie awansowałeś na range: {green}%s", g_sRanksNames[g_iRank[client]]);
1612 EmitSoundToClient(client, "*/kat/rangi/awans.mp3");
1613 CPrintToChatAll("★ {lightred}[Rangi -> Awans]{yellow} Gracz {lightred}%N{yellow} właśnie awansował na rangę {green}%s!", client, g_sRanksNames[g_iRank[client]]);
1614
1615 char sBuffer[32];
1616 Format(sBuffer, sizeof(sBuffer), "kat_overlay/rank_%d", g_iRank[client]);
1617 ClientCommand(client, "r_screenoverlay \"%s\"", sBuffer);
1618 CreateTimer(2.5, Timer_DeleteOverlay, client);
1619 }
1620
1621 if(bRankDown)
1622 {
1623 CPrintToChat(client, "★ {lightred}[Rangi -> Spadek]{yellow} UPS! Właśnie spadłeś do rangi: {green}%s", g_sRanksNames[g_iRank[client]]);
1624 EmitSoundToClient(client, "*/kat/rangi/awans.mp3");
1625 CPrintToChatAll("★ {lightred}[Rangi -> Awans]{yellow} Gracz {lightred}%N{yellow} właśnie spadł do rangi {green}%s!", client, g_sRanksNames[g_iRank[client]]);
1626
1627 char sBuffer[32];
1628 Format(sBuffer, sizeof(sBuffer), "kat_overlay/rank_%d", g_iRank[client]);
1629 ClientCommand(client, "r_screenoverlay \"%s\"", sBuffer);
1630 CreateTimer(2.5, Timer_DeleteOverlay, client);
1631 }
1632}
1633
1634public Action Timer_DeleteOverlay(Handle timer, any client)
1635{
1636 if(IsValidClient(client))
1637 ClientCommand(client, "r_screenoverlay \"%s\"", "");
1638}
1639
1640/* << Stocks / Bolls >> */
1641stock int GetCurrentPlayers() {
1642 int count;
1643 LoopClients(i) {
1644 if (!IsFakeClient(i)) {
1645 count++;
1646 }
1647 }
1648 return count;
1649}
1650
1651public int Native_GetPointsAmount(Handle handler, int numParams)
1652{
1653 return g_iPoints[GetNativeCell(1)];
1654}
1655
1656public int Native_GetRank(Handle handler, int numParams)
1657{
1658 return g_iRank[GetNativeCell(1)];
1659}
1660
1661public int Native_GetCoin(Handle handler, int numParams)
1662{
1663 return iCoin[GetNativeCell(1)];
1664}
1665
1666stock void GivePoints(int client, int value)
1667{
1668 g_iPoints[client] += value;
1669 CheckRank(client);
1670}
1671
1672stock bool IsPlayerVIP(int client) //Jeżeli gracz jest VIPem
1673{
1674 if(!CheckCommandAccess(client, "sm_Vip", 0, true))
1675 return false;
1676 return true;
1677}
1678
1679stock bool IsValidClient(int client)
1680{
1681 if(!(1 <= client <= MaxClients) || !IsClientInGame(client) || IsFakeClient(client))
1682 return false;
1683 return true;
1684}
1685
1686stock bool JestRozgrzewka()
1687{
1688 return GameRules_GetProp("m_bWarmupPeriod") != 0;
1689}