Raised This Month: $ Target: $400
 0% 

MySQL Question


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
sumguy14
Senior Member
Join Date: Apr 2006
Old 08-23-2007 , 16:42   Re: MySQL Question
Reply With Quote #15

Ok, I think I figured it out:


Code:
GetPlayerRank(client)
{
  new rank=0,Handle:hResults;
  decl String:buffer[128];
  
  Format(buffer,sizeof(buffer),"SELECT COUNT(*) FROM RPGx WHERE level > %d",GetLevel(client));
  hResults=SQL_Query(hSQL,buffer);
  if(SQL_FetchRow(hResults))
    rank+=SQL_FetchInt(hResults,0);
  
  Format(buffer, sizeof(buffer), "SELECT COUNT(*) FROM RPGx WHERE level = %d AND xp > %d",GetLevel(client),GetXP(client));
  hResults=SQL_Query(hSQL,buffer);
  if(SQL_FetchRow(hResults))
    rank+=SQL_FetchInt(hResults,0);
  
  Format(buffer, sizeof(buffer), "SELECT COUNT(*) FROM RPGx WHERE level = %d AND xp = %d AND credits <= %d",GetLevel(client),GetXP(client),GetCredits(client));
  hResults=SQL_Query(hSQL,buffer);
  if(SQL_FetchRow(hResults))
    rank+=SQL_FetchInt(hResults,0);
  return rank+1;
}
The rank seems to be right. Hopefully this works consistently.
__________________
Don't think of them as bugs think of them as unexpected features
sumguy14 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode