Jump to content
  • 0

SQL Query to show a Player Rank Position


Strand

Question


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Hello community,

I've been trying to create or research a sql query to return a Player's Top Position Number through a command @LRank.

I could have them listed by positions but I really do not know how to return the exact TOP # for the player when using the command even if he is not within the Top 10 Ranking.

I was wondering if you could assist me by finding out the correct script to do it.

Below is my script so far which is properly working at the moment:

 

OnRank:
	dispbottom " ";
	dispbottom "=============== Ranking ===============", 0xffe066;
	soundeffect "hp.wav", 0; // this will play the soundeffect
	dispbottom "                                 ", 0xFA4040;
	dispbottom "                                      Top 10 List", 0xFA4040;
	dispbottom "                                 ", 0xFA4040;
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
	dispbottom "[ " +(.@c + 1) +" ]      :       " + .@name$[.@c] +"      :      [ " + .@points[.@c] +" ]   Pts", 0xffffff;
	dispbottom "                                 ", 0xFA4040;
                                 
     *********** THIS IS THE PART THAT I'M STRUGGLING WITH ***********
      
	dispbottom "============== My Rank ==============", 0xffe066;
	query_sql "SELECT `char_id` , `points` FROM `mvp_ranking` ORDER BY `points` DESC",.@char_id,.@rank;
	dispbottom "My Top is: " + .@rank+ ".", 0x6666ff;
	dispbottom "==========================================", 0xffe066;
	end;		

I hope you can give me a hand on this.

Thank you.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

dispbottom "============== My Rank ==============", 0xffe066;
query_sql( "SELECT `points`, 1 + (SELECT COUNT(1) FROM `mvp_ranking` t1 WHERE t1.`points` > t2.`points`) FROM `mvp_ranking` t2 WHERE `char_id` = "+ getcharid(0), .@points, .@rank);
dispbottom "My Rank is: " + .@rank+ ".", 0x6666ff;
dispbottom "My Points is: " + .@points+ ".", 0x6666ff;
dispbottom "==========================================", 0xffe066;

try this

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

What about to return the count of line above the player point ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Thank you very much Emistry. It totally worked.

I'm sorry for the infraction. Will not happen again.

 

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Hello guys,

I kept on trying to get the desired result but no success so far...

So sad...

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Hello @Capuche,

Well, I already tried it but it is shown in another command. What I want to do now is to show anyone's Rank Position even if he is not on the Top 10.

Do you think you can help me out?

Thank you for taking your time to respond.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...