· 5 years ago · Mar 21, 2020, 04:44 PM
1#include <sourcemod>
2#include <sdktools>
3#include <sdkhooks>
4#include <cstrike>
5#include <clientprefs>
6#include <csgocolors>
7#include <camer>
8
9#define PL_VERSION "1.0"
10#define PREFIX "★ [{darkred}Rangi{NORMAL}] "
11#define TAG "★ [{darkred}Rangi{NORMAL}] "
12
13#pragma semicolon 1
14#pragma newdecls required
15
16Handle hud_task[MAXPLAYERS + 1];
17Handle poka[MAXPLAYERS + 1];
18
19Database Baza = null;
20
21int Punkty[MAXPLAYERS+1];
22int Ranga[MAXPLAYERS+1], m_iCompetitiveRanking;
23
24ConVar cvPunkty[23];
25ConVar ust[13];
26ConVar typ;
27
28bool Hided[MAXPLAYERS + 1];
29
30Handle handleCookie = null;
31
32bool Moze[MAXPLAYERS + 1] = false;
33
34KeyValues g_hConfig;
35
36int silver1, silver2, silver3, silver4, silver5, silver6, gold1, gold2, gold3, gold4, mg1, mg2, mge, dmg, le, lem, sup, glob, timber, ember, wildfire, howling;
37int kill, killhs, dead, podl, rozb, win, samobojstwo;
38int kill_vip, killhs_vip, dead_vip, podl_vip, rozb_vip, win_vip;
39int Rundy;
40
41public Plugin myinfo =
42{
43 name = "System Rang",
44 author = "Camer",
45 description = "",
46 version = PL_VERSION,
47 url = ""
48};
49
50public void OnPluginStart()
51{
52 DbConnect();
53
54 LoadCVARS();
55
56 LoadTranslations("common.phrases");
57
58 HookEvent("player_death", Event_PlayerDeath);
59 HookEvent("player_spawn", Event_PlayerSpawn);
60 HookEvent("round_end", Event_RoundEnd);
61 HookEvent("bomb_planted", Event_BombPlanted);
62 HookEvent("bomb_defused", Event_BombDefused);
63
64 RegConsoleCmd("sm_ranga", CMD_Menu);
65 RegConsoleCmd("sm_mm", CMD_Menu);
66 RegConsoleCmd("sm_lvl", CMD_Menu);
67 RegConsoleCmd("sm_rangi", CMD_Menu);
68 RegConsoleCmd("sm_punkty", CMD_Menu);
69 RegConsoleCmd("sm_punktyvip", CMD_Menu);
70
71 RegServerCmd("sm_fixcoll", fixcoll);
72
73 RegConsoleCmd("sm_hidepanel", hide);
74
75 RegAdminCmd("sm_deleteranks", DeleteRanks, ADMFLAG_ROOT);
76
77 handleCookie = RegClientCookie("cookie_hidepanel", "desc", CookieAccess_Protected);
78
79 m_iCompetitiveRanking = FindSendPropInfo("CCSPlayerResource", "m_iCompetitiveRanking");
80
81 for (int i = 0; i <= MaxClients; i++)
82 if(IsValidClient(i))
83 Wczytaj(i);
84
85 AutoExecConfig(true);
86}
87
88public Action fixcoll(int args)
89{
90 char query[256];
91 Format(query, sizeof(query), "ALTER TABLE `rangi_nowe` CHANGE `nick` `nick` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_polish_ci NOT NULL;");
92
93 Baza.Query(SQLT_Error, query);
94}
95
96public void OnClientCookiesCached(int client)
97{
98 Hided[client] = false;
99 char info[64];
100 GetClientCookie(client, handleCookie, info, sizeof(info));
101 if(StrEqual(info, "") || StrEqual(info, NULL_STRING))
102 {
103 return;
104 }
105 Hided[client] = StringToInt(info);
106}
107
108public Action hide(int client, int args)
109{
110 if (!IsValidClient(client))return;
111 if(!Hided[client])
112 {
113 SetClientCookie(client, handleCookie, "1");
114 Hided[client] = true;
115 CPrintToChat(client, "%sWyłączam wyświetlanie rangi w msayu! Użyj ponownie komendy aby włączyć funkcję.", TAG);
116 }
117 else
118 {
119 SetClientCookie(client, handleCookie, "0");
120 Hided[client] = false;
121 CPrintToChat(client, "%sWłączam wyświetlanie rangi w msayu! Użyj ponownie komendy aby wyłączyć funkcję.", TAG);
122 }
123}
124
125public Action DeleteRanks(int client, int args)
126{
127 char query[128];
128 Format(query, sizeof(query), "TRUNCATE rangi_nowe");
129 LogAction(client, -1, "Resetuje rangi");
130 Baza.Query(DeleteRanksSQL, query);
131}
132
133public void DeleteRanksSQL(Database db, DBResultSet results, const char[] error, any data)
134{
135 if(results == null)
136 {
137 LogError(error);
138 return;
139 }
140 for (int i = 0; i <= MaxClients; i++)
141 {
142 if(IsValidClient(i))
143 {
144 OnClientPostAdminCheck(i);
145 }
146 }
147}
148
149public void LoadCVARS()
150{
151 typ = CreateConVar("sm_typsystemu", "0");
152 cvPunkty[0] = CreateConVar("sm_pkt_silver1", "100");
153 cvPunkty[1] = CreateConVar("sm_pkt_silver2", "200");
154 cvPunkty[2] = CreateConVar("sm_pkt_silver3", "400");
155 cvPunkty[3] = CreateConVar("sm_pkt_silver4", "600");
156 cvPunkty[4] = CreateConVar("sm_pkt_silver5", "900");
157 cvPunkty[5] = CreateConVar("sm_pkt_silver6", "1300");
158 cvPunkty[6] = CreateConVar("sm_pkt_gold1", "1800");
159 cvPunkty[7] = CreateConVar("sm_pkt_gold2", "2400");
160 cvPunkty[8] = CreateConVar("sm_pkt_gold3", "3100");
161 cvPunkty[9] = CreateConVar("sm_pkt_gold4", "3900");
162 cvPunkty[10] = CreateConVar("sm_pkt_mg1", "4800");
163 cvPunkty[11] = CreateConVar("sm_pkt_mg2", "6000");
164 cvPunkty[12] = CreateConVar("sm_pkt_mge", "7200");
165 cvPunkty[13] = CreateConVar("sm_pkt_dmg", "8500");
166 cvPunkty[14] = CreateConVar("sm_pkt_le", "11000");
167 cvPunkty[15] = CreateConVar("sm_pkt_lem", "14000");
168 cvPunkty[16] = CreateConVar("sm_pkt_sup", "20000");
169 cvPunkty[17] = CreateConVar("sm_pkt_glob", "30000");
170
171 cvPunkty[18] = CreateConVar("sm_pkt_timber", "40000");
172 cvPunkty[19] = CreateConVar("sm_pkt_ember", "50000");
173 cvPunkty[20] = CreateConVar("sm_pkt_wildfire", "65000");
174 cvPunkty[21] = CreateConVar("sm_pkt_howling", "80000");
175
176
177 silver1 = cvPunkty[0].IntValue;
178 silver2 = cvPunkty[1].IntValue;
179 silver3 = cvPunkty[2].IntValue;
180 silver4 = cvPunkty[3].IntValue;
181 silver5 = cvPunkty[4].IntValue;
182 silver6 = cvPunkty[5].IntValue;
183
184 gold1 = cvPunkty[6].IntValue;
185 gold2 = cvPunkty[7].IntValue;
186 gold3 = cvPunkty[8].IntValue;
187 gold4 = cvPunkty[9].IntValue;
188
189 mg1 = cvPunkty[10].IntValue;
190 mg2 = cvPunkty[11].IntValue;
191 mge = cvPunkty[12].IntValue;
192
193 dmg = cvPunkty[13].IntValue;
194 le = cvPunkty[14].IntValue;
195 lem = cvPunkty[15].IntValue;
196 sup = cvPunkty[16].IntValue;
197 glob = cvPunkty[17].IntValue;
198
199 timber = cvPunkty[18].IntValue;
200 ember = cvPunkty[19].IntValue;
201 wildfire = cvPunkty[20].IntValue;
202 howling = cvPunkty[21].IntValue;
203
204 ust[0] = CreateConVar("sm_pkt_zabicie", "15");
205 ust[1] = CreateConVar("sm_pkt_zabicie_glowa", "20");
206 ust[2] = CreateConVar("sm_pkt_smierc", "5");
207 ust[3] = CreateConVar("sm_pkt_podlozenie_bomby", "25");
208 ust[4] = CreateConVar("sm_pkt_rozbrojenie_bomby", "25");
209 ust[5] = CreateConVar("sm_pkt_wygrana_runda", "10");
210
211 ust[6] = CreateConVar("sm_pkt_zabicie_vip", "18");
212 ust[7] = CreateConVar("sm_pkt_zabicie_glowa_vip", "23");
213 ust[8] = CreateConVar("sm_pkt_smierc_vip", "5");
214 ust[9] = CreateConVar("sm_pkt_podlozenie_bomby_vip", "5");
215 ust[10] = CreateConVar("sm_pkt_rozbrojenie_bomby_vip", "5");
216 ust[11] = CreateConVar("sm_pkt_wygrana_runda_vip", "18");
217 ust[12] = CreateConVar("sm_pkt_samobojstwo", "15");
218
219 kill = ust[0].IntValue;
220 killhs = ust[1].IntValue;
221 dead = ust[2].IntValue;
222 podl = ust[3].IntValue;
223 rozb = ust[4].IntValue;
224 win = ust[5].IntValue;
225
226 kill_vip = ust[6].IntValue;
227 killhs_vip = ust[7].IntValue;
228 dead_vip = ust[8].IntValue;
229 podl_vip = ust[9].IntValue;
230 rozb_vip = ust[10].IntValue;
231 win_vip = ust[11].IntValue;
232 samobojstwo = ust[12].IntValue;
233}
234
235public void OnMapStart()
236{
237 CleanOldAcc();
238 SDKHook(FindEntityByClassname(-1, "cs_player_manager"), SDKHook_ThinkPost, OnThinkPost);
239
240 if (g_hConfig)
241 {
242 delete g_hConfig;
243 }
244
245 char szPath[256];
246 g_hConfig = new KeyValues("Config");
247 BuildPath(Path_SM, szPath, sizeof(szPath), "data/vip/modules/fake_ranks.ini");
248
249 if(g_hConfig.ImportFromFile(szPath))
250 {
251 g_hConfig.Rewind();
252 if (g_hConfig.GotoFirstSubKey())
253 {
254 char szBuffer[256];
255 do {
256 if (g_hConfig.GotoFirstSubKey(false))
257 {
258 do {
259 FormatEx(szBuffer, sizeof(szBuffer), "materials/panorama/images/icons/skillgroups/skillgroup%i.svg", g_hConfig.GetNum(NULL_STRING));
260 if(FileExists(szBuffer))
261 {
262 AddFileToDownloadsTable(szBuffer);
263 }
264 } while (g_hConfig.GotoNextKey(false));
265 g_hConfig.GoBack();
266 }
267 } while (g_hConfig.GotoNextKey());
268 }
269 }
270
271 PrecacheSound("*/levels_ranks/levelup.mp3", true);
272 AddFileToDownloadsTable("sound/levels_ranks/levelup.mp3");
273 PrecacheSound("*/levels_ranks/leveldown.mp3", true);
274 AddFileToDownloadsTable("sound/levels_ranks/leveldown.mp3");
275
276 PrecacheDecalAnyDownload("lvl_overlays/lvl_down");
277 PrecacheDecalAnyDownload("lvl_overlays/lvl_up");
278
279 CreateTimer(300.0, ZapiszDane, _, TIMER_REPEAT);
280
281 Rundy = 0;
282}
283
284public void CleanOldAcc()
285{
286 char query[512];
287 Format(query, sizeof(query), "DELETE FROM `rangi_nowe` WHERE `steamid` IN (SELECT `steamid` FROM (SELECT * FROM rangi_nowe AS t3) AS t2 WHERE UNIX_TIMESTAMP(NOW()) > UNIX_TIMESTAMP(t2.`czas`)+2592000)");
288 Baza.Query(DeletePlayers, query);
289}
290
291public void DeletePlayers(Database db, DBResultSet results, const char[] error, any data)
292{
293 if(results == null)
294 {
295 LogError(error);
296 return 0;
297 }
298}
299
300public void EmptyCallback(Database db, DBResultSet results, const char[] error, any data)
301{
302 if(results == null)
303 {
304 LogError(error);
305 }
306}
307
308public void OnMapEnd()
309{
310 char sQuery[512], sSaveName[MAX_NAME_LENGTH * 2 + 1];
311 Transaction hQuery = new Transaction();
312
313 for(int iClient = 1; iClient <= MaxClients; iClient++)
314 {
315 if(Moze[iClient] && IsClientInGame(iClient))
316 {
317 char SteamID[64];
318 GetClientAuthId(iClient, AuthId_SteamID64, SteamID, sizeof(SteamID));
319 char gName[MAX_NAME_LENGTH];
320 GetClientName(iClient, gName, sizeof(gName));
321 Baza.Escape(gName, sSaveName, sizeof(sSaveName));
322 Format(sQuery, sizeof(sQuery), "INSERT INTO `rangi_nowe` (`steamid`, `nick`, `punkty`, `czas`, `ranga_id`) VALUES ('%s', '%s', %i, NOW(), %i) ON DUPLICATE KEY UPDATE `nick` = '%s', `punkty` = %i, `ranga_id`=%i", SteamID, sSaveName, Punkty[iClient], Ranga[iClient], sSaveName, Punkty[iClient], Ranga[iClient]);
323 hQuery.AddQuery(sQuery);
324 }
325 }
326
327 Baza.Execute(hQuery, _, Transaction_ErrorCallback, _, DBPrio_High);
328
329}
330
331public void Transaction_ErrorCallback(Database db, any data, int numQueries, const char[] sError, int failIndex, any[] queryData)
332{
333 LogError("Save EndRound - EndMap - error while working with data (%s)", sError);
334 return;
335}
336
337public void OnThinkPost(int iEnt)
338{
339 for (int i = 1; i <= MaxClients; ++i)
340 {
341 if(IsClientInGame(i) && !IsFakeClient(i))
342 {
343 SetEntData(iEnt, m_iCompetitiveRanking + i * 4, Ranga[i]);
344 }
345 }
346}
347
348public void OnPlayerRunCmdPost(int iClient, int iButtons)
349{
350 static int iOldButtons[MAXPLAYERS+1];
351
352 if(iButtons & IN_SCORE && !(iOldButtons[iClient] & IN_SCORE))
353 {
354 StartMessageOne("ServerRankRevealAll", iClient, USERMSG_BLOCKHOOKS);
355 EndMessage();
356 }
357
358 iOldButtons[iClient] = iButtons;
359}
360
361
362stock char GetRankName(int client, char[] buff, int strlen)
363{
364 switch(Ranga[client])
365 {
366 case 0:
367 Format(buff, strlen, "Unranked");
368 case 1:
369 Format(buff, strlen, "Silver I");
370 case 2:
371 Format(buff, strlen, "Silver II");
372 case 3:
373 Format(buff, strlen, "Silver III");
374 case 4:
375 Format(buff, strlen, "Silver IV");
376 case 5:
377 Format(buff, strlen, "Silver V");
378 case 6:
379 Format(buff, strlen, "Silver VI");
380 case 7:
381 Format(buff, strlen, "Gold I");
382 case 8:
383 Format(buff, strlen, "Gold II");
384 case 9:
385 Format(buff, strlen, "Gold III");
386 case 10:
387 Format(buff, strlen, "Gold IV");
388 case 11:
389 Format(buff, strlen, "MG1");
390 case 12:
391 Format(buff, strlen, "MG2");
392 case 13:
393 Format(buff, strlen, "MGE");
394 case 14:
395 Format(buff, strlen, "DMG");
396 case 15:
397 Format(buff, strlen, "LE");
398 case 16:
399 Format(buff, strlen, "LEM");
400 case 17:
401 Format(buff, strlen, "Supreme Master Class");
402 case 18:
403 Format(buff, strlen, "Global Elite");
404
405 case 82:
406 Format(buff, strlen, "Timber Wolf");
407 case 83:
408 Format(buff, strlen, "Ember Wolf");
409 case 84:
410 Format(buff, strlen, "Wildfire Wolf");
411 case 85:
412 Format(buff, strlen, "The Howling Alpha");
413 }
414}
415
416public void ZaladujRange(int iClient)
417{
418 if(Punkty[iClient] < silver1)
419 {
420 Ranga[iClient] = 0;
421 }
422
423 else if(Punkty[iClient] >= silver1 && Punkty[iClient] < silver2)
424 {
425 Ranga[iClient] = 1;
426 }
427
428 else if(Punkty[iClient] >= silver2 && Punkty[iClient] < silver3)
429 {
430 Ranga[iClient] = 2;
431 }
432
433 else if(Punkty[iClient] >= silver3 && Punkty[iClient] < silver4)
434 {
435 Ranga[iClient] = 3;
436 }
437
438 else if(Punkty[iClient] >= silver4 && Punkty[iClient] < silver5)
439 {
440 Ranga[iClient] = 4;
441 }
442
443 else if(Punkty[iClient] >= silver5 && Punkty[iClient] < silver6)
444 {
445 Ranga[iClient] = 5;
446 }
447
448 else if(Punkty[iClient] >= silver6 && Punkty[iClient] < gold1)
449 {
450 Ranga[iClient] = 6;
451 }
452
453 else if(Punkty[iClient] >= gold1 && Punkty[iClient] < gold2)
454 {
455 Ranga[iClient] = 7;
456 }
457
458 else if(Punkty[iClient] >= gold2 && Punkty[iClient] < gold3)
459 {
460 Ranga[iClient] = 8;
461 }
462
463 else if(Punkty[iClient] >= gold3 && Punkty[iClient] < gold4)
464 {
465 Ranga[iClient] = 9;
466 }
467
468 else if(Punkty[iClient] >= gold4 && Punkty[iClient] < mg1)
469 {
470 Ranga[iClient] = 10;
471 }
472
473 else if(Punkty[iClient] >= mg1 && Punkty[iClient] < mg2)
474 {
475 Ranga[iClient] = 11;
476 }
477
478 else if(Punkty[iClient] >= mg2 && Punkty[iClient] < mge)
479 {
480 Ranga[iClient] = 12;
481 }
482
483 else if(Punkty[iClient] >= mge && Punkty[iClient] < dmg)
484 {
485 Ranga[iClient] = 13;
486 }
487
488 else if(Punkty[iClient] >= dmg && Punkty[iClient] < le)
489 {
490 Ranga[iClient] = 14;
491 }
492
493 else if(Punkty[iClient] >= le && Punkty[iClient] < lem)
494 {
495 Ranga[iClient] = 15;
496 }
497
498 else if(Punkty[iClient] >= lem && Punkty[iClient] < sup)
499 {
500 Ranga[iClient] = 16;
501 }
502
503 else if(Punkty[iClient] >= sup && Punkty[iClient] < glob)
504 {
505 Ranga[iClient] = 17;
506 }
507
508 else if(Punkty[iClient] >= glob && Punkty[iClient] < timber)
509 {
510 Ranga[iClient] = 18;
511 }
512 else if(Punkty[iClient] >= timber && Punkty[iClient] < ember)
513 {
514 Ranga[iClient] = 82;
515 }
516 else if(Punkty[iClient] >= ember && Punkty[iClient] < wildfire)
517 {
518 Ranga[iClient] = 83;
519 }
520 else if(Punkty[iClient] >= wildfire && Punkty[iClient] < howling)
521 {
522 Ranga[iClient] = 84;
523 }
524 else if(Punkty[iClient] >= howling)
525 {
526 Ranga[iClient] = 85;
527 }
528}
529
530public void OnClientPostAdminCheck(int client)
531{
532 Wczytaj(client);
533}
534
535public void OnClientDisconnect(int client)
536{
537 if(IsClientInGame(client) && Moze[client])
538 {
539 Zapisz(client);
540 Moze[client] = false;
541 Ranga[client] = 0;
542 Punkty[client] = 0;
543 }
544 UsunZadania(client);
545}
546
547
548public void Wczytaj(int client)
549{
550 if(client == 0 || !client)
551 {
552 return;
553 }
554 if(!Baza)
555 {
556 return;
557 }
558 Ranga[client] = 0;
559 Punkty[client] = 0;
560 Moze[client] = false;
561 if (IsFakeClient(client))return;
562
563 char sql[512], SteamID[64];
564 if(GetClientAuthId(client, AuthId_SteamID64, SteamID, sizeof(SteamID)))
565 {
566 Format(sql, sizeof(sql), "SELECT * FROM rangi_nowe WHERE steamid='%s'", SteamID);
567 Baza.Query(WstawGracza, sql, GetClientUserId(client), DBPrio_High);
568 }
569}
570
571public void Zapisz(int client)
572{
573 if(client == 0 || !client || !IsValidClient(client))
574 {
575 return;
576 }
577 if(!Baza)
578 {
579 return;
580 }
581 if(!Moze[client])
582 {
583 CPrintToChat(client, "%sTwoje statystyki nie zostały poprawnie załadowane, spróbuj wejść ponownie na serwer!", TAG);
584 return;
585 }
586
587 char zapytanie[64];
588 Format(zapytanie, sizeof(zapytanie), "show tables;");
589 Baza.Query(SQLT_Zapisz, zapytanie, GetClientUserId(client));
590
591 if(!Moze[client])
592 {
593 CPrintToChat(client, "%sTwoje statystyki nie zostały poprawnie załadowane, spróbuj wejść ponownie na serwer!", TAG);
594 return;
595 }
596 char query[512], SteamID[64];
597 if(GetClientAuthId(client, AuthId_SteamID64, SteamID, sizeof(SteamID)))
598 {
599 char gB_PlayerName[MAX_NAME_LENGTH];
600 GetClientName(client, gB_PlayerName, MAX_NAME_LENGTH);
601
602 //escaping name , dynamic array;
603 int iLength = ((strlen(gB_PlayerName) * 2) + 1);
604 char[] gB_EscapedName = new char[iLength];
605 Baza.Escape(gB_PlayerName, gB_EscapedName, iLength);
606
607 Format(query, sizeof(query), "INSERT INTO `rangi_nowe` (`steamid`, `nick`, `punkty`, `czas`, `ranga_id`) VALUES ('%s', '%s', %i, NOW(), %i) ON DUPLICATE KEY UPDATE `nick` = '%s', `punkty` = %i, `czas` = NOW(), `ranga_id`=%i", SteamID, gB_EscapedName, Punkty[client], Ranga[client], gB_EscapedName, Punkty[client], Ranga[client]);
608 Baza.Query(SQLT_Zapisz, query, GetClientUserId(client));
609 }
610}
611
612public Action ZapiszDane(Handle timer)
613{
614 char sQuery[512], sSaveName[MAX_NAME_LENGTH * 2 + 1];
615 Transaction hQuery = new Transaction();
616
617 for(int iClient = 1; iClient <= MaxClients; iClient++)
618 {
619 if(Moze[iClient] && IsClientInGame(iClient))
620 {
621 char SteamID[64];
622 GetClientAuthId(iClient, AuthId_SteamID64, SteamID, sizeof(SteamID));
623 char gName[MAX_NAME_LENGTH];
624 GetClientName(iClient, gName, sizeof(gName));
625 Baza.Escape(gName, sSaveName, sizeof(sSaveName));
626 Format(sQuery, sizeof(sQuery), "INSERT INTO `rangi_nowe` (`steamid`, `nick`, `punkty`, `czas`, `ranga_id`) VALUES ('%s', '%s', %i, NOW(), %i) ON DUPLICATE KEY UPDATE `nick` = '%s', `punkty` = %i, `czas` = NOW(), `ranga_id`=%i", SteamID, sSaveName, Punkty[iClient], Ranga[iClient], sSaveName, Punkty[iClient], Ranga[iClient]);
627 hQuery.AddQuery(sQuery);
628 }
629 }
630
631 Baza.Execute(hQuery, _, Transaction_ErrorCallback, _, DBPrio_High);
632}
633
634public void WstawGracza(Database db, DBResultSet results, const char[] error, any data)
635{
636 int client = GetClientOfUserId(data);
637 if (results == null)
638 {
639 LogError(error);
640 Moze[client] = false;
641 return;
642 }
643
644 if(results.HasResults && results.FetchRow())
645 {
646 int field;
647 if(SQL_FieldNameToNum(results, "punkty", field))
648 {
649 Punkty[client] = SQL_FetchInt(results, field);
650 ZaladujRange(client);
651 Moze[client] = true;
652 }
653 }
654 else
655 {
656 char query[256];
657 char auth[64];
658 char clientname[MAX_NAME_LENGTH];
659
660 if (client == 0)return;
661
662 if(GetClientAuthId(client, AuthId_SteamID64, auth, sizeof(auth)))
663 {
664 GetClientName(client, clientname, sizeof(clientname));
665 char[] nowy = new char[(strlen(clientname)) * 2 + 1];
666 Baza.Escape(clientname, nowy, strlen(clientname) * 2 + 1);
667
668 Format(query, sizeof(query), "INSERT INTO `rangi_nowe` (`steamid`, `nick`, `punkty`, `czas`, `ranga_id`) VALUES ('%s', '%s', 0, NOW(), 0)", auth, nowy);
669
670 Baza.Query(SQLT_Error, query);
671 Moze[client] = true;
672 }
673 }
674}
675
676public void SQLT_Error(Database db, DBResultSet results, const char[] error, any data)
677{
678 if (results == null)
679 {
680 LogError("blad: %s", error);
681 }
682}
683
684public void SQLT_NoError(Database db, DBResultSet results, const char[] error, any data)
685{
686
687}
688
689public void SQLT_Zapisz(Database db, DBResultSet results, const char[] error, any data)
690{
691 int client = GetClientOfUserId(data);
692 if (results == null)
693 {
694 Moze[client] = false;
695 LogError("blad: %s", error);
696 }
697}
698
699public Action Event_PlayerDeath(Event hEvent, const char[] chName, bool bDontBroadcast)
700{
701 if (GameRules_GetProp("m_bWarmupPeriod") == 1)
702 return;
703
704 bool headshot = hEvent.GetBool("headshot");
705 int attacker = GetClientOfUserId(hEvent.GetInt("attacker"));
706 int iClient = GetClientOfUserId(hEvent.GetInt("userid"));
707 int assister = GetClientOfUserId(hEvent.GetInt("assister"));
708
709 poka[iClient] = CreateTimer(1.0, pokazposmierci, iClient, TIMER_REPEAT);
710
711 if(attacker == iClient || attacker == 0)
712 {
713 if(Punkty[iClient] - samobojstwo > 0)
714 CPrintToChat(iClient, "%sTracisz {GRAY}%i punktów{NORMAL} za samobójstwo!", TAG, samobojstwo);
715
716 (Punkty[iClient] - samobojstwo < 0) ? (Punkty[iClient] = 0) : (Punkty[iClient] -= samobojstwo);
717 Awans(iClient);
718 return;
719 }
720
721 if(!IsValidClient(iClient) || GetClientTeam(attacker) == GetClientTeam(iClient))
722 return;
723
724 //IncKills(attacker);
725 //IncDeads(iClient);
726
727 if(assister)
728 {
729 Punkty[assister] += 5;
730 CPrintToChat(assister, "%sZdobywasz {GRAY}5 punktów{NORMAL} za asystę przy zabójstwie gracza gracza %N!", TAG, iClient);
731 }
732
733 if (IsVIP(attacker))
734 {
735 if (headshot)
736 {
737 Punkty[attacker] += killhs_vip;
738 CPrintToChat(attacker, "%sZdobywasz {GRAY}%i punktów{NORMAL} za zabójstwo gracza %N poprzez headshota!", TAG, killhs_vip, iClient);
739 }
740 else
741 {
742 Punkty[attacker] += kill_vip;
743 CPrintToChat(attacker, "%sZdobywasz {GRAY}%i punktów{NORMAL} za zabójstwo gracza %N!", TAG, kill_vip, iClient);
744 }
745 }
746 else
747 {
748 if (headshot)
749 {
750 Punkty[attacker] += killhs;
751 CPrintToChat(attacker, "%sZdobywasz {GRAY}%i punktów{NORMAL} za zabójstwo gracza %N poprzez headshota!", TAG, killhs, iClient);
752 }
753 else
754 {
755 Punkty[attacker] += kill;
756 CPrintToChat(attacker, "%sZdobywasz {GRAY}%i punktów{NORMAL} za zabójstwo gracza %N!", TAG, kill, iClient);
757 }
758
759 }
760 Awans(attacker);
761
762 if(IsVIP(iClient))
763 {
764 if(Punkty[iClient] - dead_vip > 0)
765 {
766 CPrintToChat(iClient, "%sTracisz {GRAY}%i punktów{NORMAL} za śmierć!", TAG, dead_vip);
767 }
768 (Punkty[iClient] - dead_vip < 0) ? (Punkty[iClient] = 0) : (Punkty[iClient] -= dead_vip);
769 Awans(iClient);
770 }
771 else
772 {
773 if(Punkty[iClient] - dead > 0)
774 {
775 CPrintToChat(iClient, "%sTracisz {GRAY}%i punktów{NORMAL} za śmierć!", TAG, dead);
776 }
777 (Punkty[iClient] - dead < 0) ? (Punkty[iClient] = 0) : (Punkty[iClient] -= dead);
778 Awans(iClient);
779 }
780}
781
782public Action PokazInformacje(Handle timer, any client)
783{
784 if(!IsValidClient(client))
785 return;
786
787 if(IsPlayerAlive(client) && !Hided[client])
788 {
789 char nazwa[64];
790 GetRankName(client, nazwa, sizeof(nazwa));
791 PrintHintText(client, "<font color='#3366cc'>Max-Play.pl > !hidepanel aby wyłączyć</font>\nRanga: <font color='#ff9933'>%s</font>\nPunktów: <font color='#ff9933'>%i</font>", nazwa, Punkty[client]);
792 //tutaj hint
793 }
794}
795
796public Action pokazposmierci(Handle timer, any client)
797{
798 if(IsValidClient(client))
799 {
800 if(!IsPlayerAlive(client) && !Hided[client])
801 {
802 int spect = GetEntProp(client, Prop_Send, "m_iObserverMode");
803 if(spect == 4 || spect == 5)
804 {
805 int target = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
806 if(target != -1 && IsValidClient(target))
807 {
808 char nazwa[64];
809 GetRankName(target, nazwa, sizeof(nazwa));
810 PrintHintText(client, "<font size='15'><font color='#3366cc'>Max-Play.pl > !hidepanel aby wyłączyć</font>\nGracz: <font color='#ff9933'>%N</font>\nRanga: <font color='#ff9933'>%s</font>\nPunktów: <font color='#ff9933'>%i</font></font>", target, nazwa, Punkty[target]);
811 }
812 }
813 }
814 else
815 {
816 if(poka[client] != null)
817 {
818 KillTimer(poka[client]);
819 poka[client] = null;
820 }
821 }
822 }
823}
824
825public void DbConnect()
826{
827 char gB_Error[255];
828 if (SQL_CheckConfig("levels_ranks"))
829 {
830 Baza = SQL_Connect("levels_ranks", true, gB_Error, 255);
831
832 if (Baza == null)
833 {
834 SetFailState("[SS] Error on start. Reason: %s", gB_Error);
835 }
836 }
837 else
838 {
839 SetFailState("[SS] Cant find `levels_ranks` on database.cfg");
840 }
841
842 Baza.SetCharset("utf8mb4");
843
844 char zapytanie[1024];
845 char zapytanie2[256];
846 char zapytanie3[256];
847 Format(zapytanie, sizeof(zapytanie), "CREATE TABLE IF NOT EXISTS `rangi_nowe` (`steamid` VARCHAR(17) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , `nick` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , `punkty` INT NOT NULL , PRIMARY KEY (`steamid`)) ENGINE = MyISAM;");
848 Format(zapytanie2, sizeof(zapytanie2), "ALTER TABLE `rangi_nowe` ADD `czas` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `punkty`");
849 Format(zapytanie3, sizeof(zapytanie3), "ALTER TABLE `rangi_nowe` ADD `ranga_id` INT NULL DEFAULT 0 AFTER `czas`");
850
851
852 Baza.Query(SQLT_Error, zapytanie);
853 Baza.Query(SQLT_NoError, zapytanie2);
854 Baza.Query(SQLT_NoError, zapytanie3);
855}
856
857public Action Event_BombPlanted(Event hEvent, const char[] chName, bool bDontBroadcast)
858{
859 int iClient = GetClientOfUserId(hEvent.GetInt("userid"));
860
861 if (!IsValidClient(iClient))
862 return;
863
864 if (IsVIP(iClient))
865 {
866 Punkty[iClient] += podl_vip;
867 CPrintToChat(iClient, "%sDostajesz {GRAY}%i punktów{NORMAL} za zaplantowanie bomby!", TAG, podl_vip);
868 Awans(iClient);
869 }
870 else
871 {
872 Punkty[iClient] += podl;
873 CPrintToChat(iClient, "%sDostajesz {GRAY}%i punktów{NORMAL} za zaplantowanie bomby!", TAG, podl);
874 Awans(iClient);
875 }
876}
877
878public Action Event_BombDefused(Event hEvent, const char[] chName, bool bDontBroadcast)
879{
880 int iClient = GetClientOfUserId(hEvent.GetInt("userid"));
881
882 if (!IsValidClient(iClient))
883 return;
884
885 if (IsVIP(iClient))
886 {
887 Punkty[iClient] += rozb_vip;
888 CPrintToChat(iClient, "%sDostajesz {GRAY}%i punktów{NORMAL} za rozbrojenie bomby!", TAG, rozb_vip);
889 Awans(iClient);
890 }
891 else
892 {
893 Punkty[iClient] += rozb;
894 CPrintToChat(iClient, "%sDostajesz {GRAY}%i punktów{NORMAL} za rozbrojenie bomby!", TAG, rozb);
895 Awans(iClient);
896 }
897}
898
899public Action UsunZadania(int client)
900{
901 if(hud_task[client] != null)
902 {
903 KillTimer(hud_task[client]);
904 hud_task[client] = null;
905 }
906}
907
908public Action Event_PlayerSpawn(Event hEvent, char[] chName, bool bDontBroadcast)
909{
910 int client = GetClientOfUserId(hEvent.GetInt("userid"));
911 if (!IsValidClient(client))return;
912 if(hud_task[client] == null)
913 hud_task[client] = CreateTimer(1.0, PokazInformacje, client, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
914}
915
916public Action Event_RoundEnd(Event hEvent, char[] chName, bool bDontBroadcast)
917{
918 char str[10];
919 typ.GetString(str, sizeof(str));
920 int wyb = StringToInt(str);
921 if(wyb == 1)
922 {
923 for (int i = 0; i <= MaxClients; i++)
924 {
925 if(IsValidClient(i))
926 {
927 if(IsPlayerAlive(i))
928 {
929 char clan[128];
930 CS_GetClientClanTag(i, clan, sizeof(clan));
931 if(StrEqual(clan, "Arena 1") || StrContains(clan, "Arena 1 |") != -1)
932 {
933 if(IsVIP(i))
934 {
935 CPrintToChat(i, "%sDostajesz {GRAY}%i punktów{NORMAL} za wygranie rundy na 1 arenie!", TAG, win_vip);
936 Punkty[i] += win_vip;
937 Awans(i);
938 }
939 else
940 {
941 CPrintToChat(i, "%sDostajesz {GRAY}%i punktów{NORMAL} za wygranie rundy na 1 arenie!", TAG, win);
942 Punkty[i] += win;
943 Awans(i);
944 }
945 }
946 }
947 }
948 }
949 }
950 else if(wyb == 0)
951 {
952 Rundy++;
953 if(Rundy < 3)
954 return;
955
956 int winnerTeam = GetEventInt(hEvent, "winner");
957
958 if(win <= 0)
959 return;
960
961 for (int iClient = 0; iClient <= MaxClients; iClient++)
962 {
963 if (!IsValidClient(iClient))
964 continue;
965
966 if(GetClientTeam(iClient) == winnerTeam)
967 {
968 if(IsVIP(iClient))
969 {
970 Punkty[iClient] += win_vip;
971 CPrintToChat(iClient, "%sDostajesz {GRAY}%i punktów{NORMAL} za wygranie rundy!", TAG, win_vip);
972 Awans(iClient);
973 }
974 else
975 {
976 Punkty[iClient] += win;
977 CPrintToChat(iClient, "%sDostajesz {GRAY}%i punktów{NORMAL} za wygranie rundy!", TAG, win);
978 Awans(iClient);
979 }
980 }
981 }
982 }
983}
984
985public void Awans(int iClient)
986{
987 int client = iClient;
988 if(Punkty[iClient] >= howling)
989 {
990 if(Ranga[iClient] < 85)
991 {
992 Ranga[iClient] = 85;
993 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {RED}Wildfire Wolf", TAG);
994 CPrintToChat(iClient, "%sTo obecnie najwyższa ranga!", TAG);
995 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
996 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
997 }
998 }
999 else if(Punkty[iClient] >= wildfire)
1000 {
1001 if(Ranga[iClient] == 85)
1002 {
1003 Ranga[iClient] = 84;
1004 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {PINK}Wildfire Wolf", TAG);
1005 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1006 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1007 }
1008 else if(Ranga[iClient] < 84)
1009 {
1010 Ranga[iClient] = 84;
1011 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {RED}Wildfire Wolf", TAG);
1012 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1013 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1014 }
1015 }
1016 else if(Punkty[iClient] >= ember)
1017 {
1018 if(Ranga[iClient] == 84)
1019 {
1020 Ranga[iClient] = 83;
1021 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {PINK}Ember Wolf", TAG);
1022 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1023 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1024 }
1025 else if(Ranga[iClient] < 83)
1026 {
1027 Ranga[iClient] = 83;
1028 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {RED}Ember Wolf", TAG);
1029 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1030 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1031 }
1032 }
1033 else if(Punkty[iClient] >= timber)
1034 {
1035 if(Ranga[iClient] == 83)
1036 {
1037 Ranga[iClient] = 82;
1038 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {PINK}Timber Wolf", TAG);
1039 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1040 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1041 }
1042 else if(Ranga[iClient] < 82)
1043 {
1044 Ranga[iClient] = 82;
1045 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {RED}Timber Wolf", TAG);
1046 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1047 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1048 }
1049 }
1050 else if(Punkty[iClient] >= glob)
1051 {
1052 if(Ranga[iClient] == 82)
1053 {
1054 Ranga[iClient] = 18;
1055 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {PINK}The Global Elite", TAG);
1056 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1057 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1058 }
1059 else if(Ranga[iClient] < 18)
1060 {
1061 Ranga[iClient] = 18;
1062 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {RED}The Global Elite", TAG);
1063 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1064 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1065 }
1066 }
1067 else if(Punkty[iClient] >= sup)
1068 {
1069 if(Ranga[iClient] == 18)
1070 {
1071 Ranga[iClient] = 17;
1072 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {PINK}Supreme Master First Class", TAG);
1073 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1074 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1075 }
1076 else if(Ranga[iClient] < 17)
1077 {
1078 Ranga[iClient] = 17;
1079 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {PINK}Supreme Master First Class", TAG);
1080 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1081 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1082 }
1083 }
1084
1085 else if(Punkty[iClient] >= lem)
1086 {
1087 if(Ranga[iClient] == 17)
1088 {
1089 Ranga[iClient] = 16;
1090 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {PINK}Legendary Eagle Master", TAG);
1091 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1092 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1093 }
1094 else if(Ranga[iClient] < 16)
1095 {
1096 Ranga[iClient] = 16;
1097 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {PINK}Legendary Eagle Master", TAG);
1098 EmitSoundToClient(iClient, "*h2k/rangi/awans.mp3");
1099 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1100 }
1101 }
1102
1103 else if(Punkty[iClient] >= le)
1104 {
1105 if(Ranga[iClient] == 16)
1106 {
1107 Ranga[iClient] = 15;
1108 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {PINK}Legendary Eagle", TAG);
1109 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1110 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1111 }
1112 else if(Ranga[iClient] < 15)
1113 {
1114 Ranga[iClient] = 15;
1115 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {PINK}Legendary Eagle", TAG);
1116 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1117 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1118 }
1119 }
1120
1121 else if(Punkty[iClient] >= dmg)
1122 {
1123 if(Ranga[iClient] == 15)
1124 {
1125 Ranga[iClient] = 14;
1126 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {PINK}DISTINGUISHED MASTER GUARDIAN", TAG);
1127 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1128 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1129 }
1130 else if(Ranga[iClient] < 14)
1131 {
1132 Ranga[iClient] = 14;
1133 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {PINK}DISTINGUISHED MASTER GUARDIAN", TAG);
1134 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1135 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1136 }
1137 }
1138
1139 else if(Punkty[iClient] >= mge)
1140 {
1141 if(Ranga[iClient] == 14)
1142 {
1143 Ranga[iClient] = 13;
1144 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GREEN}Master Guardian Elite", TAG);
1145 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1146 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1147 }
1148 else if(Ranga[iClient] < 13)
1149 {
1150 Ranga[iClient] = 13;
1151 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GREEN}Master Guardian Elite", TAG);
1152 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1153 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1154 }
1155 }
1156
1157 else if(Punkty[iClient] >= mg2)
1158 {
1159 if(Ranga[iClient] == 13)
1160 {
1161 Ranga[iClient] = 12;
1162 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GREEN}Master Guardian 2", TAG);
1163 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1164 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1165 }
1166 else if(Ranga[iClient] < 12)
1167 {
1168 Ranga[iClient] = 12;
1169 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GREEN}Master Guardian 2", TAG);
1170 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1171 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1172 }
1173 }
1174
1175 else if(Punkty[iClient] >= mg1)
1176 {
1177 if(Ranga[iClient] == 12)
1178 {
1179 Ranga[iClient] = 11;
1180 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GREEN}Master Guardian 1", TAG);
1181 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1182 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1183 }
1184 else if(Ranga[iClient] < 11)
1185 {
1186 Ranga[iClient] = 11;
1187 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GREEN}Master Guardian 1", TAG);
1188 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1189 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1190 }
1191 }
1192
1193 else if(Punkty[iClient] >= gold4)
1194 {
1195 if(Ranga[iClient] == 11)
1196 {
1197 Ranga[iClient] = 10;
1198 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {YELLOW}Gold Nova Master", TAG);
1199 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1200 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1201 }
1202 else if(Ranga[iClient] < 10)
1203 {
1204 Ranga[iClient] = 10;
1205 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {YELLOW}Gold Nova Master", TAG);
1206 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1207 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1208 }
1209 }
1210
1211 else if(Punkty[iClient] >= gold3)
1212 {
1213 if(Ranga[iClient] == 10)
1214 {
1215 Ranga[iClient] = 9;
1216 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {YELLOW}Gold Nova 3", TAG);
1217 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1218 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1219 }
1220 else if(Ranga[iClient] < 9)
1221 {
1222 Ranga[iClient] = 9;
1223 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {YELLOW}Gold Nova 3", TAG);
1224 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1225 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1226 }
1227 }
1228
1229 else if(Punkty[iClient] >= gold2)
1230 {
1231 if(Ranga[iClient] == 9)
1232 {
1233 Ranga[iClient] = 8;
1234 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {YELLOW}Gold Nova 2", TAG);
1235 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1236 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1237 }
1238 else if(Ranga[iClient] < 8)
1239 {
1240 Ranga[iClient] = 8;
1241 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {YELLOW}Gold Nova 2", TAG);
1242 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1243 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1244 }
1245 }
1246
1247 else if(Punkty[iClient] >= gold1)
1248 {
1249 if(Ranga[iClient] == 8)
1250 {
1251 Ranga[iClient] = 7;
1252 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {YELLOW}Gold Nova 1", TAG);
1253 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1254 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1255 }
1256 else if(Ranga[iClient] < 7)
1257 {
1258 Ranga[iClient] = 7;
1259 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {YELLOW}Gold Nova 1", TAG);
1260 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1261 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1262 }
1263 }
1264
1265 else if(Punkty[iClient] >= silver6)
1266 {
1267 if(Ranga[iClient] == 7)
1268 {
1269 Ranga[iClient] = 6;
1270 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GRAY}Silver Elite Master", TAG);
1271 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1272 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1273 }
1274 else if(Ranga[iClient] < 6)
1275 {
1276 Ranga[iClient] = 6;
1277 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GRAY}Silver Elite Master", TAG);
1278 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1279 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1280 }
1281 }
1282
1283 else if(Punkty[iClient] >= silver5)
1284 {
1285 if(Ranga[iClient] == 6)
1286 {
1287 Ranga[iClient] = 5;
1288 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GRAY}Silver Elite", TAG);
1289 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1290 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1291 }
1292 else if(Ranga[iClient] < 5)
1293 {
1294 Ranga[iClient] = 5;
1295 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GRAY}Silver Elite", TAG);
1296 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1297 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1298 }
1299 }
1300
1301 else if(Punkty[iClient] >= silver4)
1302 {
1303 if(Ranga[iClient] == 5)
1304 {
1305 Ranga[iClient] = 4;
1306 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GRAY}Silver 4", TAG);
1307 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1308 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1309 }
1310 else if(Ranga[iClient] < 4)
1311 {
1312 Ranga[iClient] = 4;
1313 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GRAY}Silver 4", TAG);
1314 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1315 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1316 }
1317 }
1318
1319 else if(Punkty[iClient] >= silver3)
1320 {
1321 if(Ranga[iClient] == 4)
1322 {
1323 Ranga[iClient] = 3;
1324 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GRAY}Silver 3", TAG);
1325 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1326 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1327 }
1328 else if(Ranga[iClient] < 3)
1329 {
1330 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1331 Ranga[iClient] = 3;
1332 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GRAY}Silver 3", TAG);
1333 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1334 }
1335 }
1336
1337 else if(Punkty[iClient] >= silver2)
1338 {
1339 if(Ranga[iClient] == 3)
1340 {
1341 Ranga[iClient] = 2;
1342 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GRAY}Silver 2", TAG);
1343 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1344 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1345 }
1346 else if(Ranga[iClient] < 2)
1347 {
1348 Ranga[iClient] = 2;
1349 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GRAY}Silver 2", TAG);
1350 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1351 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1352 }
1353 }
1354
1355 else if(Punkty[iClient] >= silver1)
1356 {
1357 if(Ranga[iClient] == 2)
1358 {
1359 Ranga[iClient] = 1;
1360 CPrintToChat(iClient, "%sNiestety! Spadasz do rangi: {GRAY}Silver 1", TAG);
1361 ShowOverlay(client, "lvl_overlays/lvl_down", 3.0);
1362 EmitSoundToClient(iClient, "*/levels_ranks/leveldown.mp3");
1363 }
1364 else if(Ranga[iClient] < 1)
1365 {
1366 Ranga[iClient] = 1;
1367 CPrintToChat(iClient, "%sGratulacje! właśnie awansowałeś na rangę: {GRAY}Silver I", TAG);
1368 ShowOverlay(client, "lvl_overlays/lvl_up", 3.0);
1369 EmitSoundToClient(iClient, "*/levels_ranks/levelup.mp3");
1370 }
1371 }
1372}
1373
1374public Action KCredits(int iClient, int args)
1375{
1376 if(Punkty[iClient] < silver1)
1377 {
1378 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1379 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Unranked", TAG);
1380 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1381 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, silver1);
1382 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1383 }
1384
1385 else if(Punkty[iClient] >= silver1 && Punkty[iClient] < silver2)
1386 {
1387 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1388 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Silver I", TAG);
1389 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1390 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, silver2);
1391 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1392 }
1393
1394 else if(Punkty[iClient] >= silver2 && Punkty[iClient] < silver3)
1395 {
1396 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1397 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Silver II", TAG);
1398 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1399 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, silver3);
1400 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1401 }
1402
1403 else if(Punkty[iClient] >= silver3 && Punkty[iClient] < silver4)
1404 {
1405 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1406 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Silver III", TAG);
1407 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1408 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, silver4);
1409 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1410 }
1411
1412 else if(Punkty[iClient] >= silver4 && Punkty[iClient] < silver5)
1413 {
1414 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1415 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Silver IV", TAG);
1416 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1417 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, silver5);
1418 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1419 }
1420
1421 else if(Punkty[iClient] >= silver5 && Punkty[iClient] < silver6)
1422 {
1423 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1424 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Silver V", TAG);
1425 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1426 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, silver6);
1427 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1428 }
1429
1430 else if(Punkty[iClient] >= silver6 && Punkty[iClient] < gold1)
1431 {
1432 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1433 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Silver VI", TAG);
1434 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1435 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, gold1);
1436 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1437 }
1438
1439 else if(Punkty[iClient] >= gold1 && Punkty[iClient] < gold2)
1440 {
1441 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1442 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Gold I", TAG);
1443 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1444 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, gold2);
1445 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1446 }
1447
1448 else if(Punkty[iClient] >= gold2 && Punkty[iClient] < gold3)
1449 {
1450 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1451 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Gold II", TAG);
1452 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1453 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, gold3);
1454 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1455 }
1456
1457 else if(Punkty[iClient] >= gold3 && Punkty[iClient] < gold4)
1458 {
1459 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1460 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Gold III", TAG);
1461 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1462 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, gold4);
1463 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1464 }
1465
1466 else if(Punkty[iClient] >= gold4 && Punkty[iClient] < mg1)
1467 {
1468 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1469 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Gold IV", TAG);
1470 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1471 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, mg1);
1472 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1473 }
1474
1475 else if(Punkty[iClient] >= mg1 && Punkty[iClient] < mg2)
1476 {
1477 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1478 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}MG I", TAG);
1479 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1480 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, mg2);
1481 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1482 }
1483
1484 else if(Punkty[iClient] >= mg2 && Punkty[iClient] < mge)
1485 {
1486 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1487 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}MG II", TAG);
1488 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1489 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, mge);
1490 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1491 }
1492
1493 else if(Punkty[iClient] >= mge && Punkty[iClient] < dmg)
1494 {
1495 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1496 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}MGE", TAG);
1497 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1498 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, dmg);
1499 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1500 }
1501
1502 else if(Punkty[iClient] >= dmg && Punkty[iClient] < le)
1503 {
1504 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1505 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}DMG", TAG);
1506 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1507 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, le);
1508 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1509 }
1510
1511 else if(Punkty[iClient] >= le && Punkty[iClient] < lem)
1512 {
1513 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1514 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}LE", TAG);
1515 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1516 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, lem);
1517 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1518 }
1519
1520 else if(Punkty[iClient] >= lem && Punkty[iClient] < sup)
1521 {
1522 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1523 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}LEM", TAG);
1524 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1525 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktach", TAG, sup);
1526 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1527 }
1528
1529 else if(Punkty[iClient] >= sup && Punkty[iClient] < glob)
1530 {
1531 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1532 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}SUPREME", TAG);
1533 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1534 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, glob);
1535 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1536 }
1537 else if(Punkty[iClient] >= glob && Punkty[iClient] < timber)
1538 {
1539 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1540 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Global Elite", TAG);
1541 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1542 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, timber);
1543 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1544 }
1545 else if(Punkty[iClient] >= timber && Punkty[iClient] < ember)
1546 {
1547 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1548 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Timber Wolf", TAG);
1549 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1550 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, ember);
1551 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1552 }
1553 else if(Punkty[iClient] >= ember && Punkty[iClient] < wildfire)
1554 {
1555 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1556 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Ember Wolf", TAG);
1557 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1558 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, wildfire);
1559 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1560 }
1561 else if(Punkty[iClient] >= wildfire && Punkty[iClient] < howling)
1562 {
1563 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1564 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}Wildfire Wolf", TAG);
1565 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1566 CPrintToChat(iClient, "%sNastępna ranga przy {green}%i punktów", TAG, howling);
1567 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1568 }
1569 else if(Punkty[iClient] >= howling)
1570 {
1571 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1572 CPrintToChat(iClient, "%sTwoja obecna ranga to: {green}The Howling Alpha", TAG);
1573 CPrintToChat(iClient, "%sLiczba punktów: %i", TAG, Punkty[iClient]);
1574 CPrintToChat(iClient, "%sTo najwyższa ranga. {green}Gratulacje!", TAG);
1575 CPrintToChat(iClient, "{lightgreen}--------------------------------------------------------");
1576 }
1577
1578 return 0;
1579}
1580
1581public Action CMD_Menu(int iClient, int iArgs)
1582{
1583 Menu menu = new Menu(Rangi_MenuHandler);
1584 char buff[128];
1585 Format(buff, sizeof(buff), "Posiadasz %i punktów", Punkty[iClient]);
1586 menu.SetTitle("System Rang - Menu");
1587 menu.AddItem("0", buff, ITEMDRAW_DISABLED);
1588 menu.AddItem("1", "System zdobywania Punktów");
1589 menu.AddItem("2", "System zdobywania Punktów (VIP)");
1590 menu.AddItem("3", "Ile PKT trzeba na rangę?");
1591 menu.AddItem("4", "Statystyki(TOP 10)");
1592 menu.Display(iClient, MENU_TIME_FOREVER);
1593}
1594
1595public int Rangi_MenuHandler(Menu menu, MenuAction action, int param1, int param2)
1596{
1597 if (action == MenuAction_Select)
1598 {
1599 char item[32];
1600 menu.GetItem(param2, item, sizeof(item));
1601 int wyb = StringToInt(item);
1602 switch(wyb)
1603 {
1604 case 1:
1605 PokazSystem(param1);
1606 case 2:
1607 PokazSystemVIP(param1);
1608 case 3:
1609 IlePKT(param1);
1610 case 4:
1611 Staty(param1);
1612 }
1613 }
1614}
1615
1616public void IlePKT(int client)
1617{
1618 KCredits(client, 0);
1619 Menu menu = new Menu(menuHNDL);
1620 char buff[128];
1621 Format(buff, sizeof(buff), "Posiadasz %i punktów", Punkty[client]);
1622
1623 char buff0[64], buff1[64], buff2[64], buff3[64],
1624 buff4[64], buff5[64], buff6[64], buff7[64], buff8[64],
1625 buff9[64], buff10[64], buff11[64], buff12[64],
1626 buff13[64], buff14[64], buff15[64], buff16[64], buff17[64],
1627 buff18[64], buff19[64], buff20[64], buff21[64];
1628 Format(buff0, sizeof(buff0), "Silver 1 - %i punktów", silver1);
1629 Format(buff1, sizeof(buff1), "Silver 2 - %i punktów", silver2);
1630 Format(buff2, sizeof(buff2), "Silver 3 - %i punktów", silver3);
1631 Format(buff3, sizeof(buff3), "Silver 4 - %i punktów", silver4);
1632 Format(buff4, sizeof(buff4), "Silver 5 - %i punktów", silver5);
1633 Format(buff5, sizeof(buff5), "Silver 6 - %i punktów", silver6);
1634 Format(buff6, sizeof(buff6), "Gold 1 - %i punktów", gold1);
1635 Format(buff7, sizeof(buff7), "Gold 2 - %i punktów", gold2);
1636 Format(buff8, sizeof(buff8), "Gold 3 - %i punktów", gold3);
1637 Format(buff9, sizeof(buff9), "Gold 4 - %i punktów", gold4);
1638 Format(buff10, sizeof(buff10), "MG1 - %i punktów", mg1);
1639 Format(buff11, sizeof(buff11), "MG2 - %i punktów", mg2);
1640 Format(buff12, sizeof(buff12), "MGE - %i punktów", mge);
1641 Format(buff13, sizeof(buff13), "DMG - %i punktów", dmg);
1642 Format(buff14, sizeof(buff14), "LE - %i punktów", le);
1643 Format(buff15, sizeof(buff15), "LEM - %i punktów", lem);
1644 Format(buff16, sizeof(buff16), "Suprime - %i punktów", sup);
1645 Format(buff17, sizeof(buff17), "Global Elite - %i punktów", glob);
1646
1647 Format(buff18, sizeof(buff18), "Timber Wolf - %i punktów", timber);
1648 Format(buff19, sizeof(buff19), "Ember Wolf - %i punktów", ember);
1649 Format(buff20, sizeof(buff20), "Wildfire Wolf - %i punktów", wildfire);
1650 Format(buff21, sizeof(buff21), "The Howling Alpha - %i punktów", howling);
1651
1652 char title[128];
1653 Format(title, sizeof(title), "Rangi");
1654 menu.SetTitle(title);
1655 menu.AddItem(buff, buff);
1656 menu.AddItem(buff0, buff0);
1657 menu.AddItem(buff1, buff1);
1658 menu.AddItem(buff2, buff2);
1659 menu.AddItem(buff3, buff3);
1660 menu.AddItem(buff4, buff4);
1661 menu.AddItem(buff5, buff5);
1662 menu.AddItem(buff6, buff6);
1663 menu.AddItem(buff7, buff7);
1664 menu.AddItem(buff8, buff8);
1665 menu.AddItem(buff9, buff9);
1666 menu.AddItem(buff10, buff10);
1667 menu.AddItem(buff11, buff11);
1668 menu.AddItem(buff12, buff12);
1669 menu.AddItem(buff13, buff13);
1670 menu.AddItem(buff14, buff14);
1671 menu.AddItem(buff15, buff15);
1672 menu.AddItem(buff16, buff16);
1673 menu.AddItem(buff17, buff17);
1674
1675 menu.AddItem(buff18, buff18);
1676 menu.AddItem(buff19, buff19);
1677 menu.AddItem(buff20, buff20);
1678 menu.AddItem(buff21, buff21);
1679
1680 menu.Display(client, MENU_TIME_FOREVER);
1681}
1682
1683public int menuHNDL(Menu menu, MenuAction action, int param1, int param2)
1684{
1685}
1686
1687public void Staty(int client)
1688{
1689 char query[512];
1690 Format(query, sizeof(query), "SELECT * FROM rangi_nowe ORDER BY punkty DESC LIMIT 0,10");
1691 Baza.Query(Zwroc, query, GetClientUserId(client));
1692}
1693
1694public void Zwroc(Database db, DBResultSet results, const char[] error, any data)
1695{
1696 if(results == null)
1697 {
1698 LogError(error);
1699 return;
1700 }
1701 int client = GetClientOfUserId(data);
1702 if (!IsValidClient(client))return;
1703
1704 char name[64];
1705 char buffer[128];
1706 int punkty;
1707
1708 name[0] = '\0';
1709 int i = 0;
1710 int y = 1;
1711 Panel panel = CreatePanel();
1712 panel.SetTitle("TOP 10");
1713 panel.DrawItem(" ", ITEMDRAW_RAWLINE);
1714 while(SQL_FetchRow(results))
1715 {
1716 SQL_FetchString(results, 1, name, sizeof(name));
1717
1718 punkty = SQL_FetchInt(results, 2);
1719 switch(y)
1720 {
1721 case 1: Format(buffer, sizeof(buffer), "%ist - %s : %i punktów", y, name, punkty);
1722 case 2: Format(buffer, sizeof(buffer), "%ind - %s : %i punktów", y, name, punkty);
1723 case 3: Format(buffer, sizeof(buffer), "%ird - %s : %i punktów", y, name, punkty);
1724 default: Format(buffer, sizeof(buffer), "%ith - %s : %i punktów", y, name, punkty);
1725 }
1726
1727 panel.DrawItem(buffer, ITEMDRAW_RAWLINE);
1728 i++;
1729 y++;
1730 }
1731
1732 DrawPanelItem(panel, "Zamknij");
1733 panel.Send(client, PanelHandlerNothing, 180);
1734 delete panel;
1735}
1736
1737public int PanelHandlerNothing(Handle menu, MenuAction action, int param1, int param2) {}
1738
1739public void PokazSystem(int client)
1740{
1741 KCredits(client, 0);
1742 Panel xd = CreatePanel();
1743
1744 char buff[128], buff1[128], buff2[128], buff3[128], buff4[128], buff5[128];
1745 Format(buff, sizeof(buff), "Zabójstwo +%i punktów", kill);
1746 Format(buff1, sizeof(buff1), "Zabójstwo przez headshota +%i punktów", killhs);
1747 Format(buff2, sizeof(buff2), "Śmierć -%i punktów", dead);
1748 Format(buff3, sizeof(buff3), "Podłożenie bomby +%i punktów", podl);
1749 Format(buff4, sizeof(buff4), "Rozbrojenie bomby +%i punktów", rozb);
1750 Format(buff5, sizeof(buff5), "Wygranie rundy +%i punktów", win);
1751
1752 char title[128];
1753 Format(title, sizeof(title), "Przelicznik punktów");
1754 xd.SetTitle(title);
1755 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1756 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1757 xd.DrawItem(buff, ITEMDRAW_RAWLINE);
1758 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1759 xd.DrawItem(buff1, ITEMDRAW_RAWLINE);
1760 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1761 xd.DrawItem(buff2, ITEMDRAW_RAWLINE);
1762 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1763 xd.DrawItem(buff3, ITEMDRAW_RAWLINE);
1764 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1765 xd.DrawItem(buff4, ITEMDRAW_RAWLINE);
1766 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1767 xd.DrawItem(buff5, ITEMDRAW_RAWLINE);
1768 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1769 xd.DrawItem("Exit");
1770
1771 xd.Send(client, Menu30, 180);
1772}
1773
1774public void PokazSystemVIP(int client)
1775{
1776 KCredits(client, 0);
1777 Panel xd = CreatePanel();
1778
1779 char buff[128], buff1[128], buff2[128], buff3[128], buff4[128], buff5[128];
1780 Format(buff, sizeof(buff), "Zabójstwo +%i punktów", kill_vip);
1781 Format(buff1, sizeof(buff1), "Zabójstwo przez headshota +%i punktów", killhs_vip);
1782 Format(buff2, sizeof(buff2), "Śmierć -%i punktów", dead_vip);
1783 Format(buff3, sizeof(buff3), "Podłożenie bomby +%i punktów", podl_vip);
1784 Format(buff4, sizeof(buff4), "Rozbrojenie bomby +%i punktów", rozb_vip);
1785 Format(buff5, sizeof(buff5), "Wygranie rundy +%i punktów", win_vip);
1786
1787 char title[128];
1788 Format(title, sizeof(title), "Przelicznik punktów dla VIPa");
1789 xd.SetTitle(title);
1790 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1791 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1792 xd.DrawItem(buff, ITEMDRAW_RAWLINE);
1793 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1794 xd.DrawItem(buff1, ITEMDRAW_RAWLINE);
1795 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1796 xd.DrawItem(buff2, ITEMDRAW_RAWLINE);
1797 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1798 xd.DrawItem(buff3, ITEMDRAW_RAWLINE);
1799 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1800 xd.DrawItem(buff4, ITEMDRAW_RAWLINE);
1801 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1802 xd.DrawItem(buff5, ITEMDRAW_RAWLINE);
1803 xd.DrawItem(" ", ITEMDRAW_RAWLINE);
1804 xd.DrawItem("Exit");
1805
1806 xd.Send(client, Menu30, 180);
1807}
1808
1809public int Menu30(Handle menu, MenuAction action, int param1, int param2)
1810{
1811}
1812
1813stock void PrecacheDecalAnyDownload(char[] sOverlay)
1814{
1815 char sBuffer[256];
1816 Format(sBuffer, sizeof(sBuffer), "%s.vmt", sOverlay);
1817 PrecacheDecal(sBuffer, true);
1818 Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sOverlay);
1819 AddFileToDownloadsTable(sBuffer);
1820
1821 Format(sBuffer, sizeof(sBuffer), "%s.vtf", sOverlay);
1822 PrecacheDecal(sBuffer, true);
1823 Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sOverlay);
1824 AddFileToDownloadsTable(sBuffer);
1825}
1826
1827// Show overlay to a client with lifetime | 0.0 = no auto remove
1828stock void ShowOverlay(int client, char[] path, float lifetime)
1829{
1830 if (!IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client))
1831 return;
1832
1833 ClientCommand(client, "r_screenoverlay \"%s.vtf\"", path);
1834
1835 if (lifetime != 0.0)
1836 CreateTimer(lifetime, DeleteOverlay, GetClientUserId(client));
1837}
1838
1839// Remove overlay from a client - Timer!
1840stock Action DeleteOverlay(Handle timer, any userid)
1841{
1842 int client = GetClientOfUserId(userid);
1843 if (client <= 0 || !IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client))
1844 return;
1845
1846 ClientCommand(client, "r_screenoverlay \"\"");
1847}