Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RegConsoleCmd( "sm_rr", Command_ResentRecords );
- RegConsoleCmd( "sm_resentrecords", Command_ResentRecords );
- RegConsoleCmd( "sm_rrb", Command_ResentRecords_Bonus );
- RegConsoleCmd( "sm_rrc", Command_ResentRecords_Course );
- public Action Command_ResentRecords( int client, int args )
- {
- if ( !client ) return Plugin_Handled;
- Menu mMenu = new Menu(Recent_records_handler);
- mMenu.SetTitle("<Recent Records :: Selection>\n ");
- mMenu.AddItem("", "Recent Map Records");
- mMenu.AddItem("", "Recent Map Top 10s");
- mMenu.AddItem("", "Recent Course Records");
- mMenu.AddItem("", "Recent Course Top 10s");
- mMenu.AddItem("", "Recent Bonus Records");
- mMenu.AddItem("", "Recent Bonus Top 10s\n \n ");
- mMenu.Display(client, MENU_TIME_FOREVER);
- return Plugin_Handled;
- }
- public int Recent_records_handler( Menu mMenu, MenuAction action, int client, int item )
- {
- if ( action == MenuAction_End ) { delete mMenu; return 0; }
- if ( action != MenuAction_Select ) return 0;
- char query[200];
- if (item == 0)
- {
- FormatEx(query, sizeof(query), "SELECT recordid, map, mode, date, (select name from plydata where uid = maprecs.uid) FROM maprecs where rank = 1 and run = 0 order by date desc limit 100");
- g_hDatabase.Query(RecentRecords_Map_Wr_Callback, query, GetClientUserId( client ));
- }
- if (item == 1)
- {
- FormatEx(query, sizeof(query), "SELECT recordid, map, mode, date, rank, (select name from plydata where uid = maprecs.uid) FROM maprecs where rank > 1 and rank <= 10 and run = 0 order by date desc limit 100");
- g_hDatabase.Query(RecentRecords_Map_Tt_Callback, query, GetClientUserId( client ));
- }
- if (item == 2)
- {
- FormatEx(query, sizeof(query), "SELECT recordid, map, mode, date, run, (select name from plydata where uid = maprecs.uid) FROM maprecs where rank = 1 and run >= %i and run <= %i order by date desc limit 100", RUN_COURSE1, RUN_COURSE10);
- g_hDatabase.Query(RecentRecords_Course_Wr_Callback, query, GetClientUserId( client ));
- }
- if (item == 3)
- {
- FormatEx(query, sizeof(query), "SELECT recordid, map, mode, date, rank, run, (select name from plydata where uid = maprecs.uid) FROM maprecs where rank > 1 and rank <= 10 and run >= %i and run <= %i order by date desc limit 100", RUN_COURSE1, RUN_COURSE10);
- g_hDatabase.Query(RecentRecords_Course_Tt_Callback, query, GetClientUserId( client ));
- }
- if (item == 4)
- {
- FormatEx(query, sizeof(query), "SELECT recordid, map, mode, date, run, (select name from plydata where uid = maprecs.uid) FROM maprecs where rank = 1 and run >= %i and run <= %i order by date desc limit 100", RUN_BONUS1, RUN_BONUS10);
- g_hDatabase.Query(RecentRecords_Bonus_Wr_Callback, query, GetClientUserId( client ));
- }
- if (item == 5)
- {
- FormatEx(query, sizeof(query), "SELECT recordid, map, mode, date, rank, run, (select name from plydata where uid = maprecs.uid) FROM maprecs where rank > 1 and rank <= 10 and run >= %i and run <= %i order by date desc limit 100", RUN_BONUS1, RUN_BONUS10);
- g_hDatabase.Query(RecentRecords_Bonus_Tt_Callback, query, GetClientUserId( client ));
- }
- return 0;
- }
- public void RecentRecords_Map_Wr_Callback( Database hOwner, DBResultSet hQuery, const char[] szError, int client )
- {
- if ( !(client = GetClientOfUserId( client )) ) return;
- if ( hQuery == null )
- {
- DB_LogError( "Couldn't retrieve player data!" );
- return;
- }
- if ( hQuery.RowCount )
- {
- Menu mMenu = new Menu(RecentRecords_Runs_Handler);
- mMenu.SetTitle("<Recent Jump Map Records>\n ");
- char recordid[6];
- int mode;
- char map[60], date[40], name[25], buffer[100];
- while (hQuery.FetchRow())
- {
- IntToString( hQuery.FetchInt(0), recordid, sizeof(recordid));
- hQuery.FetchString( 1, map, sizeof( map ) );
- mode = hQuery.FetchInt(2);
- hQuery.FetchString( 3, date, sizeof( date ) );
- hQuery.FetchString( 4, name, sizeof( name ) );
- ReplaceString(map, sizeof(map), "jump_", "");
- ReplaceString(map, sizeof(map), "sj_", "");
- ReplaceString(map, sizeof(map), "rj_", "");
- FormatTimeDuration(date, sizeof(date), GetTime() + (55755 + 1850) - DateTimeToTimestamp(date));
- FormatEx(buffer, sizeof(buffer), "(%s) <%s> - %s - %s", g_szModeName[NAME_SHORT][mode][0], map, name, date);
- mMenu.AddItem(recordid, buffer);
- }
- mMenu.ExitBackButton = true;
- mMenu.Display(client, MENU_TIME_FOREVER);
- }
- delete hQuery;
- }
- public void RecentRecords_Map_Tt_Callback( Database hOwner, DBResultSet hQuery, const char[] szError, int client )
- {
- if ( !(client = GetClientOfUserId( client )) ) return;
- if ( hQuery == null )
- {
- DB_LogError( "Couldn't retrieve player data!" );
- return;
- }
- if ( hQuery.RowCount )
- {
- Menu mMenu = new Menu(RecentRecords_Runs_Handler);
- mMenu.SetTitle("<Recent Jump Map Top 10s>\n ");
- char recordid[6];
- int mode, rank;
- char map[60], date[40], name[25], buffer[100];
- while (hQuery.FetchRow())
- {
- IntToString( hQuery.FetchInt(0), recordid, sizeof(recordid));
- hQuery.FetchString( 1, map, sizeof( map ) );
- mode = hQuery.FetchInt(2);
- hQuery.FetchString( 3, date, sizeof( date ) );
- rank = hQuery.FetchInt(4);
- hQuery.FetchString( 5, name, sizeof( name ) );
- ReplaceString(map, sizeof(map), "jump_", "");
- ReplaceString(map, sizeof(map), "sj_", "");
- ReplaceString(map, sizeof(map), "rj_", "");
- FormatTimeDuration(date, sizeof(date), GetTime() + (55755 + 1850) - DateTimeToTimestamp(date));
- FormatEx(buffer, sizeof(buffer), "(%s) <%s> (#%i) - %s - %s", g_szModeName[NAME_SHORT][mode][0], map, rank, name, date);
- mMenu.AddItem(recordid, buffer);
- }
- mMenu.ExitBackButton = true;
- mMenu.Display(client, MENU_TIME_FOREVER);
- }
- delete hQuery;
- }
- public void RecentRecords_Course_Wr_Callback( Database hOwner, DBResultSet hQuery, const char[] szError, int client )
- {
- if ( !(client = GetClientOfUserId( client )) ) return;
- if ( hQuery == null )
- {
- DB_LogError( "Couldn't retrieve player data!" );
- return;
- }
- if ( hQuery.RowCount )
- {
- Menu mMenu = new Menu(RecentRecords_Runs_Handler);
- mMenu.SetTitle("<Recent Jump Course Records>\n ");
- char recordid[6];
- int mode, run;
- char map[60], date[40], name[25], buffer[100];
- while (hQuery.FetchRow())
- {
- IntToString( hQuery.FetchInt(0), recordid, sizeof(recordid));
- hQuery.FetchString( 1, map, sizeof( map ) );
- mode = hQuery.FetchInt(2);
- hQuery.FetchString( 3, date, sizeof( date ) );
- run = hQuery.FetchInt(4);
- hQuery.FetchString( 5, name, sizeof( name ) );
- ReplaceString(map, sizeof(map), "jump_", "");
- ReplaceString(map, sizeof(map), "sj_", "");
- ReplaceString(map, sizeof(map), "rj_", "");
- FormatTimeDuration(date, sizeof(date), GetTime() + (55755 + 1850) - DateTimeToTimestamp(date));
- FormatEx(buffer, sizeof(buffer), "(%s) <%s [%s]> - %s - %s", g_szModeName[NAME_SHORT][mode][0], map, g_szRunName[NAME_SHORT][run], name, date);
- mMenu.AddItem(recordid, buffer);
- }
- mMenu.ExitBackButton = true;
- mMenu.Display(client, MENU_TIME_FOREVER);
- }
- delete hQuery;
- }
- public void RecentRecords_Course_Tt_Callback( Database hOwner, DBResultSet hQuery, const char[] szError, int client )
- {
- if ( !(client = GetClientOfUserId( client )) ) return;
- if ( hQuery == null )
- {
- DB_LogError( "Couldn't retrieve player data!" );
- return;
- }
- if ( hQuery.RowCount )
- {
- Menu mMenu = new Menu(RecentRecords_Runs_Handler);
- mMenu.SetTitle("<Recent Jump Course Top 10s>\n ");
- char recordid[6];
- int mode, rank, run;
- char map[60], date[40], name[25], buffer[100];
- while (hQuery.FetchRow())
- {
- IntToString( hQuery.FetchInt(0), recordid, sizeof(recordid));
- hQuery.FetchString( 1, map, sizeof( map ) );
- mode = hQuery.FetchInt(2);
- hQuery.FetchString( 3, date, sizeof( date ) );
- rank = hQuery.FetchInt(4);
- run = hQuery.FetchInt(5);
- hQuery.FetchString( 6, name, sizeof( name ) );
- ReplaceString(map, sizeof(map), "jump_", "");
- ReplaceString(map, sizeof(map), "sj_", "");
- ReplaceString(map, sizeof(map), "rj_", "");
- FormatTimeDuration(date, sizeof(date), GetTime() + (55755 + 1850) - DateTimeToTimestamp(date));
- FormatEx(buffer, sizeof(buffer), "(%s) <%s [%s]> (#%i) - %s - %s", g_szModeName[NAME_SHORT][mode][0], map, g_szRunName[NAME_SHORT][run], rank, name, date);
- mMenu.AddItem(recordid, buffer);
- }
- mMenu.ExitBackButton = true;
- mMenu.Display(client, MENU_TIME_FOREVER);
- }
- delete hQuery;
- }
- public void RecentRecords_Bonus_Wr_Callback( Database hOwner, DBResultSet hQuery, const char[] szError, int client )
- {
- if ( !(client = GetClientOfUserId( client )) ) return;
- if ( hQuery == null )
- {
- DB_LogError( "Couldn't retrieve player data!" );
- return;
- }
- if ( hQuery.RowCount )
- {
- Menu mMenu = new Menu(RecentRecords_Runs_Handler);
- mMenu.SetTitle("<Recent Jump Bonus Records>\n ");
- char recordid[6];
- int mode, rank, run;
- char map[60], date[40], name[25], buffer[100];
- while (hQuery.FetchRow())
- {
- IntToString( hQuery.FetchInt(0), recordid, sizeof(recordid));
- hQuery.FetchString( 1, map, sizeof( map ) );
- mode = hQuery.FetchInt(2);
- hQuery.FetchString( 3, date, sizeof( date ) );
- run = hQuery.FetchInt(4);
- hQuery.FetchString( 5, name, sizeof( name ) );
- ReplaceString(map, sizeof(map), "jump_", "");
- ReplaceString(map, sizeof(map), "sj_", "");
- ReplaceString(map, sizeof(map), "rj_", "");
- FormatTimeDuration(date, sizeof(date), GetTime() + (55755 + 1850) - DateTimeToTimestamp(date));
- FormatEx(buffer, sizeof(buffer), "(%s) <%s [%s]> - %s - %s", g_szModeName[NAME_SHORT][mode][0], map, g_szRunName[NAME_SHORT][run], name, date);
- mMenu.AddItem(recordid, buffer);
- }
- mMenu.ExitBackButton = true;
- mMenu.Display(client, MENU_TIME_FOREVER);
- }
- delete hQuery;
- }
- public void RecentRecords_Bonus_Tt_Callback( Database hOwner, DBResultSet hQuery, const char[] szError, int client )
- {
- if ( !(client = GetClientOfUserId( client )) ) return;
- if ( hQuery == null )
- {
- DB_LogError( "Couldn't retrieve player data!" );
- return;
- }
- if ( hQuery.RowCount )
- {
- Menu mMenu = new Menu(RecentRecords_Runs_Handler);
- mMenu.SetTitle("<Recent Jump Bonus Top 10s>\n ");
- char recordid[6];
- int mode, rank, run;
- char map[60], date[40], name[25], buffer[100];
- while (hQuery.FetchRow())
- {
- IntToString( hQuery.FetchInt(0), recordid, sizeof(recordid));
- hQuery.FetchString( 1, map, sizeof( map ) );
- mode = hQuery.FetchInt(2);
- hQuery.FetchString( 3, date, sizeof( date ) );
- rank = hQuery.FetchInt(4);
- run = hQuery.FetchInt(5);
- hQuery.FetchString( 6, name, sizeof( name ) );
- ReplaceString(map, sizeof(map), "jump_", "");
- ReplaceString(map, sizeof(map), "sj_", "");
- ReplaceString(map, sizeof(map), "rj_", "");
- FormatTimeDuration(date, sizeof(date), GetTime() + (55755 + 1850) - DateTimeToTimestamp(date));
- FormatEx(buffer, sizeof(buffer), "(%s) <%s [%s]> (#%i) - %s - %s", g_szModeName[NAME_SHORT][mode][0], map, g_szRunName[NAME_SHORT][run], rank, name, date);
- mMenu.AddItem(recordid, buffer);
- }
- mMenu.ExitBackButton = true;
- mMenu.Display(client, MENU_TIME_FOREVER);
- }
- delete hQuery;
- }
- public int RecentRecords_Runs_Handler( Menu mMenu, MenuAction action, int client, int item )
- {
- if ( action == MenuAction_End ) { delete mMenu; return 0; }
- if ( action == MenuAction_Cancel )
- {
- if (item == MenuCancel_ExitBack)
- {
- ClientCommand(client, "sm_rr");
- }
- return 0;
- }
- if ( action != MenuAction_Select ) return 0;
- char szRecordid[6];
- int recordid;
- GetMenuItem( mMenu, item, szRecordid, sizeof( szRecordid ) );
- StringToIntEx(szRecordid, recordid);
- DB_RecordInfo(client, 0, recordid);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement