· 10 years ago · Sep 23, 2016, 05:28 PM
1#pragma semicolon 1
2#include <sourcemod>
3#include <sdktools>
4
5#define IDAYS 26
6
7
8#define VERSION "2.1"
9
10new JugadoEspectador[MAXPLAYERS+1] = 0;
11new JugadoT[MAXPLAYERS+1] = 0;
12new JugadoCT[MAXPLAYERS+1] = 0;
13
14bool comprobado[MAXPLAYERS + 1];
15
16new String:g_sCmdLogPath[256];
17char sql_buffer[3096];
18
19bool ismysql;
20
21// DB handle
22new Handle:db = INVALID_HANDLE;
23
24int Hours;
25int Minutes;
26int Seconds;
27
28public Plugin:myinfo =
29{
30 name = "SM Most Active",
31 author = "Franc1sco Steam: franug",
32 description = "A rank based in time played",
33 version = VERSION,
34 url = "http://steamcommunity.com/id/franug"
35};
36
37public OnPluginStart()
38{
39 CreateConVar("sm_mostactive_version", VERSION, "version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
40 RegConsoleCmd("sm_time", DOMenu);
41
42 for(new i=0;;i++)
43 {
44 BuildPath(Path_SM, g_sCmdLogPath, sizeof(g_sCmdLogPath), "logs/mostactive_%d.log", i);
45 if ( !FileExists(g_sCmdLogPath) )
46 break;
47 }
48
49 SQL_TConnect(OnSqlConnect, "mostactive");
50}
51
52public OnSqlConnect(Handle:owner, Handle:hndl, const String:error[], any:data)
53{
54 if (hndl == INVALID_HANDLE)
55 {
56 LogError("Database failure: %s", error);
57
58 SetFailState("Databases dont work");
59 }
60 else
61 {
62 db = hndl;
63
64 SQL_GetDriverIdent(SQL_ReadDriver(db), sql_buffer, sizeof(sql_buffer));
65 ismysql = StrEqual(sql_buffer,"mysql", false) ? true : false;
66
67 if (ismysql)
68 {
69 Format(sql_buffer, sizeof(sql_buffer), "CREATE TABLE IF NOT EXISTS `mostactive` (`playername` varchar(128) NOT NULL, `steamid` varchar(32) PRIMARY KEY NOT NULL,`last_accountuse` int(64) NOT NULL, `timeCT` INT( 16 ), `timeTT` INT( 16 ),`timeSPE` INT( 16 ), `total` INT( 16 ))");
70
71 SQL_TQuery(db, tbasicoC, sql_buffer);
72 LogToFileEx(g_sCmdLogPath, "Query %s", sql_buffer);
73
74 }
75 else
76 {
77 Format(sql_buffer, sizeof(sql_buffer), "CREATE TABLE IF NOT EXISTS mostactive (playername varchar(128) NOT NULL, steamid varchar(32) PRIMARY KEY NOT NULL,last_accountuse int(64) NOT NULL, timeCT INTEGER, timeTT INTEGER, timeSPE INTEGER, total INTEGER)");
78
79 SQL_TQuery(db, tbasicoC, sql_buffer);
80 LogToFileEx(g_sCmdLogPath, "Query %s", sql_buffer);
81 }
82
83 PruneDatabase();
84 }
85}
86
87public tbasicoC(Handle:owner, Handle:hndl, const String:error[], any:data)
88{
89 if (hndl == INVALID_HANDLE)
90 {
91 LogError("Query failure: %s", error);
92 return;
93 }
94
95 for(new client = 1; client <= MaxClients; client++)
96 {
97 if(IsClientInGame(client))
98 {
99 OnClientPostAdminCheck(client);
100 }
101 }
102}
103
104public tbasico(Handle:owner, Handle:hndl, const String:error[], any:data)
105{
106 if (hndl == INVALID_HANDLE)
107 {
108 LogError("Query failure: %s", error);
109 }
110}
111
112Nuevo(client)
113{
114 decl String:query[255], String:steamid[32];
115 GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid) );
116 new userid = GetClientUserId(client);
117
118 new String:Name[MAX_NAME_LENGTH+1];
119 new String:SafeName[(sizeof(Name)*2)+1];
120 if (!GetClientName(client, Name, sizeof(Name)))
121 Format(SafeName, sizeof(SafeName), "<noname>");
122 else
123 {
124 TrimString(Name);
125 SQL_EscapeString(db, Name, SafeName, sizeof(SafeName));
126 }
127
128 Format(query, sizeof(query), "INSERT INTO mostactive(playername, steamid, last_accountuse, timeCT, timeTT, timeSPE, total) VALUES('%s', '%s', '%d', '0', '0', '0', '0');", SafeName, steamid, GetTime());
129 SQL_TQuery(db, tbasico, query, userid);
130 LogToFileEx(g_sCmdLogPath, "Query %s", query);
131 JugadoCT[client] = 0;
132 JugadoT[client] = 0;
133 JugadoEspectador[client] = 0;
134
135 comprobado[client] = true;
136
137}
138
139CheckSteamID(client)
140{
141 decl String:query[255], String:steamid[32];
142 GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid) );
143
144 Format(query, sizeof(query), "SELECT timeCT, timeTT, timeSPE FROM mostactive WHERE steamid = '%s'", steamid);
145 SQL_TQuery(db, T_CheckSteamID, query, GetClientUserId(client));
146 LogToFileEx(g_sCmdLogPath, "Query %s", query);
147}
148
149public T_CheckSteamID(Handle:owner, Handle:hndl, const String:error[], any:data)
150{
151 new client;
152
153 /* Make sure the client didn't disconnect while the thread was running */
154 if ((client = GetClientOfUserId(data)) == 0)
155 {
156 return;
157 }
158
159 if (hndl == INVALID_HANDLE)
160 {
161 LogError("Query failure: %s", error);
162 return;
163 }
164 if (!SQL_GetRowCount(hndl) || !SQL_FetchRow(hndl))
165 {
166 Nuevo(client);
167 return;
168 }
169
170 JugadoCT[client] = SQL_FetchInt(hndl, 0);
171 JugadoT[client] = SQL_FetchInt(hndl, 1);
172 JugadoEspectador[client] = SQL_FetchInt(hndl, 2);
173 comprobado[client] = true;
174}
175
176SaveCookies(client)
177{
178 decl String:steamid[32];
179 GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid) );
180 new String:Name[MAX_NAME_LENGTH+1];
181 new String:SafeName[(sizeof(Name)*2)+1];
182 if (!GetClientName(client, Name, sizeof(Name)))
183 Format(SafeName, sizeof(SafeName), "<noname>");
184 else
185 {
186 TrimString(Name);
187 SQL_EscapeString(db, Name, SafeName, sizeof(SafeName));
188 }
189
190 decl String:buffer[3096];
191 Format(buffer, sizeof(buffer), "UPDATE mostactive SET last_accountuse = %d, playername = '%s',timeCT = '%i',timeTT = '%i', timeSPE = '%i',total = '%i' WHERE steamid = '%s';",GetTime(), SafeName, JugadoCT[client],JugadoT[client],JugadoEspectador[client],JugadoCT[client]+JugadoT[client]+JugadoEspectador[client], steamid);
192 SQL_TQuery(db, tbasico, buffer);
193 LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
194 comprobado[client] = false;
195}
196
197public OnPluginEnd()
198{
199 for(new client = 1; client <= MaxClients; client++)
200 {
201 if(IsClientInGame(client))
202 {
203 OnClientDisconnect(client);
204 }
205 }
206}
207
208public OnClientDisconnect(client)
209{
210 if(!IsFakeClient(client) && comprobado[client]) SaveCookies(client);
211}
212
213public OnClientPostAdminCheck(client)
214{
215 if(!IsFakeClient(client)) CheckSteamID(client);
216}
217
218public PruneDatabase()
219{
220 if (db == INVALID_HANDLE)
221 {
222 LogToFileEx(g_sCmdLogPath, "Prune Database: No connection");
223 return;
224 }
225
226 new maxlastaccuse;
227 maxlastaccuse = GetTime() - (IDAYS * 86400);
228
229 decl String:buffer[1024];
230
231 if (ismysql)
232 Format(buffer, sizeof(buffer), "DELETE FROM `mostactive` WHERE `last_accountuse`<'%d' AND `last_accountuse`>'0';", maxlastaccuse);
233 else
234 Format(buffer, sizeof(buffer), "DELETE FROM mostactive WHERE last_accountuse<'%d' AND last_accountuse>'0';", maxlastaccuse);
235
236 LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
237 SQL_TQuery(db, tbasicoP, buffer);
238}
239
240public tbasicoP(Handle:owner, Handle:hndl, const String:error[], any:data)
241{
242 if (hndl == INVALID_HANDLE)
243 {
244 LogToFileEx(g_sCmdLogPath, "Query failure: %s", error);
245 }
246 //LogMessage("Prune Database successful");
247}
248
249public OnMapStart()
250{
251 CreateTimer(1.0, Temporizador, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
252}
253
254public Action:Temporizador(Handle:timer)
255{
256 for(new i = 1; i <= MaxClients; i++)
257 {
258 if(IsClientInGame(i))
259 {
260 new team = GetClientTeam(i);
261
262 if(team == 2)
263 {
264 ++JugadoT[i];
265
266 }
267 else if(team == 3)
268 {
269 ++JugadoCT[i];
270 }
271 else
272 {
273 ++JugadoEspectador[i];
274 }
275 }
276 }
277}
278
279
280public showTOP(client){
281
282 if (db != INVALID_HANDLE)
283 {
284 decl String:buffer[200];
285 Format(buffer, sizeof(buffer), "SELECT playername, total FROM mostactive ORDER BY total DESC LIMIT 999");
286 SQL_TQuery(db, SQLTopShow, buffer, client);
287 } else {
288 PrintToChat(client, " \x03СиÑтема временно не доÑтупна");
289 }
290}
291
292public SQLTopShow(Handle:owner, Handle:hndl, const String:error[], any:client){
293
294 if(hndl == INVALID_HANDLE)
295 {
296 LogError(error);
297 PrintToServer("Last Connect SQL Error: %s", error);
298 return;
299 }
300
301 new Handle:menu2 = CreateMenu(DIDMenuHandler2);
302 SetMenuTitle(menu2, "Топ игроков");
303
304
305 new orden = 0;
306 decl String:numero[64];
307 decl String:name[64];
308 decl String:texto[128];
309
310 if (SQL_HasResultSet(hndl))
311 {
312 while (SQL_FetchRow(hndl))
313 {
314 orden++;
315 Format(numero,64, "option%i", orden);
316 SQL_FetchString(hndl, 0, name, sizeof(name));
317 Hours = 0;
318 Minutes = 0;
319 Seconds = 0;
320 mostrartiempo2(SQL_FetchInt(hndl, 1));
321
322
323
324 Format(texto,128, "n%i %s - %d ч. %d м. %d Ñ.", orden,name,Hours, Minutes, Seconds);
325
326 AddMenuItem(menu2, numero, texto);
327
328
329 }
330 }
331
332 if(orden < 1)
333 {
334 AddMenuItem(menu2, "empty", "Топ пуÑтой!");
335 }
336
337 SetMenuExitButton(menu2, true);
338 SetMenuExitBackButton(menu2, true);
339 DisplayMenu(menu2, client, MENU_TIME_FOREVER);
340
341}
342
343public showTOP2(client){
344
345 if (db != INVALID_HANDLE)
346 {
347 decl String:buffer[200];
348 Format(buffer, sizeof(buffer), "SELECT playername, timeSPE FROM mostactive ORDER BY timeSPE DESC LIMIT 999");
349 SQL_TQuery(db, SQLTopShow2, buffer, client);
350 } else {
351 PrintToChat(client, " \x03СиÑтема временно не доÑтупна");
352 }
353}
354
355public SQLTopShow2(Handle:owner, Handle:hndl, const String:error[], any:client){
356
357 if(hndl == INVALID_HANDLE)
358 {
359 LogError(error);
360 PrintToServer("Last Connect SQL Error: %s", error);
361 return;
362 }
363
364 new Handle:menu2 = CreateMenu(DIDMenuHandler2);
365 SetMenuTitle(menu2, "Топ Ñпектаторов");
366
367
368 new orden = 0;
369 decl String:numero[64];
370 decl String:name[64];
371 decl String:texto[128];
372
373 if (SQL_HasResultSet(hndl))
374 {
375 while (SQL_FetchRow(hndl))
376 {
377 orden++;
378 Format(numero,64, "option%i", orden);
379 SQL_FetchString(hndl, 0, name, sizeof(name));
380 Hours = 0;
381 Minutes = 0;
382 Seconds = 0;
383 mostrartiempo2(SQL_FetchInt(hndl, 1));
384
385
386
387 Format(texto,128, "n%i %s - %d ч. %d м. %d Ñ.", orden,name,Hours, Minutes, Seconds);
388
389 AddMenuItem(menu2, numero, texto);
390
391
392 }
393 }
394
395 if(orden < 1)
396 {
397 AddMenuItem(menu2, "empty", "Топ пуÑтой!");
398 }
399
400 SetMenuExitButton(menu2, true);
401 SetMenuExitBackButton(menu2, true);
402 DisplayMenu(menu2, client, MENU_TIME_FOREVER);
403
404}
405
406public showTOP3(client){
407
408 if (db != INVALID_HANDLE)
409 {
410 decl String:buffer[200];
411 Format(buffer, sizeof(buffer), "SELECT playername, timeTT FROM mostactive ORDER BY timeTT DESC LIMIT 999");
412 SQL_TQuery(db, SQLTopShow3, buffer, client);
413 } else {
414 PrintToChat(client, " \x03СиÑтема временно не доÑтупна");
415 }
416}
417
418public SQLTopShow3(Handle:owner, Handle:hndl, const String:error[], any:client){
419
420 if(hndl == INVALID_HANDLE)
421 {
422 LogError(error);
423 PrintToServer("Last Connect SQL Error: %s", error);
424 return;
425 }
426
427 new Handle:menu2 = CreateMenu(DIDMenuHandler2);
428 SetMenuTitle(menu2, "Топ терроры");
429
430
431 new orden = 0;
432 decl String:numero[64];
433 decl String:name[64];
434 decl String:texto[128];
435
436 if (SQL_HasResultSet(hndl))
437 {
438 while (SQL_FetchRow(hndl))
439 {
440 orden++;
441 Format(numero,64, "option%i", orden);
442 SQL_FetchString(hndl, 0, name, sizeof(name));
443 Hours = 0;
444 Minutes = 0;
445 Seconds = 0;
446 mostrartiempo2(SQL_FetchInt(hndl, 1));
447
448
449 Format(texto,128, "n%i %s - %d ч. %d м. %d Ñ.", orden,name,Hours, Minutes, Seconds);
450
451 AddMenuItem(menu2, numero, texto);
452
453
454 }
455 }
456
457 if(orden < 1)
458 {
459 AddMenuItem(menu2, "empty", "Топ пуÑтой!");
460 }
461
462 SetMenuExitButton(menu2, true);
463 SetMenuExitBackButton(menu2, true);
464 DisplayMenu(menu2, client, MENU_TIME_FOREVER);
465
466}
467
468public showTOP4(client){
469
470 if (db != INVALID_HANDLE)
471 {
472 decl String:buffer[200];
473 Format(buffer, sizeof(buffer), "SELECT playername, timeCT FROM mostactive ORDER BY timeCT DESC LIMIT 999");
474 SQL_TQuery(db, SQLTopShow4, buffer, client);
475 } else {
476 PrintToChat(client, " \x03СиÑтема временно не доÑтупна");
477 }
478}
479
480public SQLTopShow4(Handle:owner, Handle:hndl, const String:error[], any:client){
481
482 if(hndl == INVALID_HANDLE)
483 {
484 LogError(error);
485 PrintToServer("Last Connect SQL Error: %s", error);
486 return;
487 }
488
489 new Handle:menu2 = CreateMenu(DIDMenuHandler2);
490 SetMenuTitle(menu2, "Топ контр-террориÑтов");
491
492
493 new orden = 0;
494 decl String:numero[64];
495 decl String:name[64];
496 decl String:texto[128];
497
498 if (SQL_HasResultSet(hndl))
499 {
500 while (SQL_FetchRow(hndl))
501 {
502 orden++;
503 Format(numero,64, "option%i", orden);
504 SQL_FetchString(hndl, 0, name, sizeof(name));
505 Hours = 0;
506 Minutes = 0;
507 Seconds = 0;
508 mostrartiempo2(SQL_FetchInt(hndl, 1));
509
510
511
512 Format(texto,128, "n%i %s - %d ч. %d м. %d Ñ.", orden,name,Hours, Minutes, Seconds);
513
514 AddMenuItem(menu2, numero, texto);
515
516
517 }
518 }
519
520 if(orden < 1)
521 {
522 AddMenuItem(menu2, "empty", "Топ пуÑтой!");
523 }
524
525 SetMenuExitButton(menu2, true);
526 SetMenuExitBackButton(menu2, true);
527 DisplayMenu(menu2, client, MENU_TIME_FOREVER);
528
529}
530
531stock mostrartiempo(Time, char[] frase, sizef)
532{
533 Hours = 0;
534 Minutes = 0;
535 Seconds = Time;
536
537 while(Seconds > 3600)
538 {
539 Hours++;
540 Seconds -= 3600;
541 }
542 while(Seconds > 60)
543 {
544 Minutes++;
545 Seconds -= 60;
546 }
547
548
549 if(Hours >= 1)
550 {
551 Format(frase, sizef, "%d чаÑов %d минут %d Ñекунд", Hours, Minutes, Seconds );
552 }
553 else if(Minutes >= 1)
554 {
555 Format(frase, sizef, "%d минут %d Ñекунд", Minutes, Seconds );
556 }
557 else
558 {
559 Format(frase, sizef, "%d Ñекунд", Seconds );
560 }
561}
562
563stock mostrartiempo2(Time)
564{
565 Hours = 0;
566 Minutes = 0;
567 Seconds = Time;
568
569 while(Seconds > 3600)
570 {
571 Hours++;
572 Seconds -= 3600;
573 }
574 while(Seconds > 60)
575 {
576 Minutes++;
577 Seconds -= 60;
578 }
579}
580
581public DIDMenuHandler2(Handle:menu, MenuAction:action, client, itemNum)
582{
583 if (action == MenuAction_Cancel)
584 {
585 if(itemNum==MenuCancel_ExitBack)
586 {
587 DOMenu(client,0);
588 }
589 //PrintToServer("Client %d's menu was cancelled. Reason: %d", client, itemNum);
590 }
591
592 else if (action == MenuAction_End)
593 {
594 CloseHandle(menu);
595 }
596}
597
598public Action:DOMenu(clientId,args)
599{
600 //PrintToChat(clientId, "numero de arg %i", args);
601 if(args > 0)
602 {
603 char steamid[64];
604 GetCmdArgString(steamid, sizeof(steamid));
605 //PrintToChat(clientId, "tengo %s", steamid);
606
607 decl String:buffer[200];
608 Format(buffer, sizeof(buffer), "SELECT timeCT, timeTT, timeSPE, total, playername FROM mostactive WHERE steamid = '%s'", steamid);
609 SQL_TQuery(db, SQLMostrarJugador, buffer, GetClientUserId(clientId));
610 //LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
611 }
612 else {
613 new Handle:menu = CreateMenu(DIDMenuHandler);
614 SetMenuTitle(menu, "Most Active");
615 AddMenuItem(menu, "option1", "ПоÑмотреть наиграное времÑ");
616 AddMenuItem(menu, "option2", "ПоÑмотреть Ð²Ñ€ÐµÐ¼Ñ Ð¢ÐžÐŸ игроков");
617 AddMenuItem(menu, "option3", "ПоÑмотреть ТОП Ñпектаторов");
618 AddMenuItem(menu, "option4", "ПоÑмотреть ТОП терроров");
619 AddMenuItem(menu, "option5", "ПоÑмотреть ТОП контр-терроров");
620 SetMenuExitButton(menu, true);
621 DisplayMenu(menu, clientId, MENU_TIME_FOREVER);
622
623 }
624 return Plugin_Handled;
625}
626
627public SQLMostrarJugador(Handle:owner, Handle:hndl, const String:error[], any:data)
628{
629 new client;
630
631 /* Make sure the client didn't disconnect while the thread was running */
632 if ((client = GetClientOfUserId(data)) == 0)
633 {
634 return;
635 }
636
637 if (hndl == INVALID_HANDLE)
638 {
639 LogError("Query failure: %s", error);
640 return;
641 }
642 if (!SQL_GetRowCount(hndl) || !SQL_FetchRow(hndl))
643 {
644 PrintToChat(client, " \x03steamid not found in the database");
645 return;
646 }
647 char name[124];
648 SQL_FetchString(hndl, 4, name, 124);
649
650 new Handle:menu = CreateMenu(DIDMenuHandler_time);
651 SetMenuTitle(menu, "Ð’Ñ€ÐµÐ¼Ñ Ð¸Ð³Ñ€Ð¾ÐºÐ° %s", name);
652
653 char frase[124];
654
655 mostrartiempo(SQL_FetchInt(hndl, 2), frase, sizeof(frase));
656 Format(frase, 124, "Спектаторы: %s", frase);
657 AddMenuItem(menu, "", frase, ITEMDRAW_DISABLED);
658
659
660 mostrartiempo(SQL_FetchInt(hndl, 1), frase, sizeof(frase));
661 Format(frase, 124, "ТеррориÑты: %s", frase);
662 AddMenuItem(menu, "", frase, ITEMDRAW_DISABLED);
663
664
665 mostrartiempo(SQL_FetchInt(hndl, 0), frase, sizeof(frase));
666 Format(frase, 124, "Контр-террориÑты: %s", frase);
667 AddMenuItem(menu, "", frase, ITEMDRAW_DISABLED);
668
669 mostrartiempo(SQL_FetchInt(hndl, 3), frase, sizeof(frase));
670 Format(frase, 124, "Общее времÑ: %s", frase);
671 AddMenuItem(menu, "", frase, ITEMDRAW_DISABLED);
672
673 SetMenuExitButton(menu, true);
674 SetMenuExitBackButton(menu, true);
675 DisplayMenu(menu, client, MENU_TIME_FOREVER);
676
677}
678
679
680public DIDMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
681{
682 if ( action == MenuAction_Select )
683 {
684 new String:info[32];
685
686 GetMenuItem(menu, itemNum, info, sizeof(info));
687
688 if ( strcmp(info,"option1") == 0 )
689 {
690 new Handle:menu2 = CreateMenu(DIDMenuHandler_time);
691 SetMenuTitle(menu2, "Ð’Ñ€ÐµÐ¼Ñ Ð¸Ð³Ñ€Ð¾ÐºÐ° %N", client);
692
693 char frase[124];
694
695 mostrartiempo(JugadoEspectador[client], frase, sizeof(frase));
696 Format(frase, 124, "Спектатор: %s", frase);
697 AddMenuItem(menu2, "", frase, ITEMDRAW_DISABLED);
698
699 mostrartiempo(JugadoT[client], frase, sizeof(frase));
700 Format(frase, 124, "ТеррориÑÑ‚: %s", frase);
701 AddMenuItem(menu2, "", frase, ITEMDRAW_DISABLED);
702
703
704
705 mostrartiempo(JugadoCT[client], frase, sizeof(frase));
706 Format(frase, 124, "Контр-террориÑÑ‚: %s", frase);
707 AddMenuItem(menu2, "", frase, ITEMDRAW_DISABLED);
708
709
710 new totalt = (JugadoT[client] + JugadoCT[client] + JugadoEspectador[client]);
711 mostrartiempo(totalt, frase, sizeof(frase));
712 Format(frase, 124, "Общее времÑ: %s", frase);
713 AddMenuItem(menu2, "", frase, ITEMDRAW_DISABLED);
714 SetMenuExitButton(menu2, true);
715 SetMenuExitBackButton(menu2, true);
716 DisplayMenu(menu2, client, MENU_TIME_FOREVER);
717
718 //DOMenu(client, 0);
719 //DID(client);
720 }
721
722 else if ( strcmp(info,"option2") == 0 )
723 {
724 showTOP(client);
725 //DID(client);
726
727 }
728 else if ( strcmp(info,"option3") == 0 )
729 {
730 showTOP2(client);
731 //DID(client);
732
733 }
734 else if ( strcmp(info,"option4") == 0 )
735 {
736 showTOP3(client);
737 //DID(client);
738
739 }
740 else if ( strcmp(info,"option5") == 0 )
741 {
742 showTOP4(client);
743 //DID(client);
744
745 }
746 }
747 if (action == MenuAction_Cancel)
748 {
749 if(itemNum==MenuCancel_ExitBack)
750 {
751 DOMenu(client,0);
752 }
753 //PrintToServer("Client %d's menu was cancelled. Reason: %d", client, itemNum);
754 }
755 else if (action == MenuAction_End)
756 {
757 CloseHandle(menu);
758 }
759}
760
761public DIDMenuHandler_time(Handle:menu, MenuAction:action, client, itemNum)
762{
763 if (action == MenuAction_Cancel)
764 {
765 if(itemNum==MenuCancel_ExitBack)
766 {
767 DOMenu(client,0);
768 }
769 //PrintToServer("Client %d's menu was cancelled. Reason: %d", client, itemNum);
770 }
771
772 else if (action == MenuAction_End)
773 {
774 CloseHandle(menu);
775 }
776}