AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Another question with MySQL: Get rank based XP (https://forums.alliedmods.net/showthread.php?t=106000)

Marcoux 10-10-2009 14:51

Another question with MySQL: Get rank based XP
 
Well, let's suppose we have a table like this:

SteamID-----------XP

With around 5000 rows.

I want to get the rank of certain SteamID, I know how to do the "top", where with just a ORDER BY I can get it. But not get the rank number of someone.

The diference is that, with just an ORDER BY I can get who are the ten players who have the highest XP, but if I want to know the rank of certain player, I cant.

Keep in mind that I think to show this in a HUD, so It shouldn't burn the CPU. I don't ask for queriyng every second, but maybe every round.

vitorrd 10-10-2009 17:45

Re: Another question with MySQL: Get rank by XP
 
SELECT XP FROM your_table WHERE SteamID="His ID here";

10101010 10-10-2009 17:57

Re: Another question with MySQL: Get rank by XP
 
Quote:

Originally Posted by vitorrd (Post 957972)
SELECT XP FROM your_table WHERE SteamID="His ID here";

Retard?

vitorrd 10-10-2009 18:02

Re: Another question with MySQL: Get rank by XP
 
Quote:

Originally Posted by 10101010 (Post 957991)
Retard?

Excuse me, kid? He asked how to check for a Steam ID's rank.

Arkshine 10-10-2009 18:03

Re: Another question with MySQL: Get rank by XP
 
lol, it seems he doesn't know about SQL.

vitorrd 10-10-2009 18:07

Re: Another question with MySQL: Get rank by XP
 
Quote:

Originally Posted by Arkshine (Post 958000)
lol, it seems he doesn't know about SQL.

Who exactly are we talking about here? Haha.

Arkshine 10-10-2009 18:15

Re: Another question with MySQL: Get rank by XP
 
-_-"

Marcoux 10-10-2009 19:13

Re: Another question with MySQL: Get rank by XP
 
Quote:

Originally Posted by 10101010 (Post 957991)
Retard?

Indeed, he is.
Quote:

Originally Posted by vitorrd (Post 957972)
SELECT XP FROM your_table WHERE SteamID="His ID here";

Quote:

Originally Posted by vitorrd (Post 957997)
Excuse me, kid? He asked how to check for a Steam ID's rank.

Have you read the entire post? Of course I know how to select the XP from certain value. I want to know how to get the position it has certain value when you do an ORDER BY.

In simple words, retrieve the rank of something based on certain value.
Quote:

Originally Posted by Arkshine (Post 958000)
lol, it seems he doesn't know about SQL.

Who do you refer to?

Marcoux 10-10-2009 19:27

Re: Another question with MySQL: Get rank based XP
 
Sorry for doublepost, but it was needed.

I will explain a bit more what I want.

Lets suppose the table is like this

--ID---Score
65-5000
86-4000
106-10000
56-2000

As you can se, I have a normal table where I can get the score of someone in a really simple way.

Now, lets say player 65 connects, I want to tell you "You are second in the rank", whose rank would be based on the score of each player in the DB

vitorrd 10-10-2009 20:03

Re: Another question with MySQL: Get rank based XP
 
Quote:

I want to get the rank of certain SteamID, I know how to do the "top", where with just a ORDER BY I can get it. But not get the rank number of someone.
Excuse me if your brain is not capable of expressing what you want correctly. Suit yourself.


All times are GMT -4. The time now is 22:43.

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