SHARE
TWEET

MysqlQueryPersonnalStat for COD4 beta

naskot Aug 21st, 2018 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MysqlQueryPersonnalStat()
  2. {
  3.     if( isDefined( game[ "mysql" ] ) ) {
  4.             colorskill=0;
  5.             colorratio=0;
  6.             colorrank=0;
  7.             skill = 0;
  8.             ratio = 0;
  9.             clientid = 1;
  10.             rankllllll = 0;
  11.             sqlquery = "SELECT C.id,round(S.ratio, 2),round(S.skill) FROM " + level.dvar[ "db_clients" ] + " AS C," + level.dvar[ "db_xlrplayerstats" ] + " AS S WHERE C.id = S.client_id  AND C.guid = " + self getGuid() + " ";
  12.             mysql_query( game[ "mysql" ], sqlquery );
  13.    
  14.             arr = mysql_fetch_row( game[ "mysql" ] );
  15.             keys = getArrayKeys(arr);
  16.             for(j = 0; j < keys.size; j++)
  17.             {
  18.               skill = arr[keys[0]];
  19.               ratio = arr[keys[1]];
  20.               clientid = arr[keys[2]];
  21.               colorratio = int( arr[keys[1]] );    
  22.  
  23.               if ( int( arr[keys[0]] ) >= 1600 ) {colorskill=6;}
  24.               else if ( int( arr[keys[0]] ) >= 1475 ) {colorskill=2;}
  25.               else if ( int( arr[keys[0]] ) >= 1100 ) {colorskill=3;}
  26.               else {colorskill=1;}
  27.              
  28.               if ( colorratio >= 1 ) {colorratio=2;} else {colorratio=1;}
  29.             }
  30.  
  31.             query = "SELECT COUNT(S.skill) AS rank FROM " + level.dvar[ "db_xlrplayerstats" ] + " AS S WHERE S.skill >= " + skill + " ORDER BY S.skill DESC";
  32.             mysql_query( game[ "mysql" ], query );
  33.             rankllllll = mysql_fetch_row( game[ "mysql" ] );
  34.               if     ( int(rankllllll["rank"])   == 1 ) {colorrank=6;}
  35.               else if ( int(rankllllll["rank"])  == 2 ) {colorrank=5;}
  36.               else if ( int(rankllllll["rank"])  == 3 ) {colorrank=2;}
  37.               else if ( int(rankllllll["rank"]) <= 25 ) {colorrank=3;}
  38.               else {colorrank=1;}
  39.            
  40.             return "^3| ^7Ranked ^" + colorrank + "#" + int(rankllllll["rank"]) + " ^3| ^7Ratio[K/D] ^" + colorratio + ratio + " ^3| ^7Skill ^" + colorskill + skill + " ^3|";
  41.     }
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top