shourya90

Untitled

Aug 24th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.33 KB | None | 0 0
  1. UpdateTopKillsTextdraws()
  2. {  
  3.     new score_str[256], query[128],kills, str[256];
  4.     new finalname[256], finalkill[256];
  5.  
  6.     mysql_format(g_MySQLHandle, query, 128, "SELECT name, SUM(cyclekills) AS totalammount FROM `visits` GROUP BY name HAVING COUNT(name)>1 ORDER BY totalammount DESC LIMIT 5");
  7.     mysql_query(g_MySQLHandle, query, true);
  8.    
  9.     if(!cache_get_row_count()) 
  10.     {
  11.         finalname = "Name~n~-~n~-~n~-~n~-~n~-";
  12.         finalkill = "Kills~n~-~n~-~n~-~n~-~n~-~n~";
  13.     }      
  14.     else if(!!cache_get_row_count())
  15.     {
  16.         new j = cache_get_row_count();
  17.         for(new x = 0; x < j; x++)
  18.         {
  19.             cache_get_field_content(x, "name", query);
  20.             kills = cache_get_field_content_int(x, "totalammount");
  21.             format(str, sizeof str, "%s%s~n~", str, query);
  22.             format(score_str, sizeof score_str, "%s%d~n~", score_str, kills);
  23.         }  
  24.         format(finalname, 256, "Name~n~%s", str);
  25.         format(finalkill, 256, "Kills~n~%s", score_str);   
  26.     }
  27.        
  28.     for(new i, max_playerid = GetPlayerPoolSize(); i <= max_playerid; i ++)
  29.     {
  30.         if( IsPlayerConnected(i))
  31.         {
  32.             PlayerTextDrawSetString(i, g_TopKillsTextdraw[i][TOPKILLS_TD_POS], "Pos~n~01~n~02~n~03~n~04~n~05");
  33.             PlayerTextDrawSetString(i, g_TopKillsTextdraw[i][TOPKILLS_TD_NAME], finalname);
  34.             PlayerTextDrawSetString(i, g_TopKillsTextdraw[i][TOPKILLS_TD_KILLS], finalkill);
  35.             ShowTopKillsTextdraws(i);
  36.         }
  37.     }  
  38.     return 1;
  39. }
Add Comment
Please, Sign In to add comment