Jump to content
  • 0

About MVP Rankings


rhizokeel

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  07/09/14
  • Last Seen:  

My MVP Rankings Only show Top 1 Name.. and the 2nd-10th place doesn't show their names even though it has kills.

For example:

 

Top 1 Rhizokeel with 50 MVP killed.

Top 2  with 33 MVP killed.

Top 3  with 20 MVP killed.

Top 4  with 5 MVP killed.

Top 5  with 1 MVP killed.

and so on

 

Here is my code...

 

-	script	Rank MvP	-1,{

OnInit:


setarray .mobid[0],1511,1647,1785,1630,1399,1039,1874,2068,1272,1719,1046,1389,1112,1115,1957,1418,1871,1252,1768,1086,1688,1646,1373,1147,1059,1150,1956,2022,1087,1190,1038,1157,1159,1502,1623,1650,1583,1708,1312,1751,1685,1648,1917,1658;
set .a, 1; // [ 1 - Enable global announcement on MvP kill ] [ 0 - Disable global announcement ]
set $@top, 10; // Number of top rankings that will be shown.
end;

OnNPCKillEvent:
if (getgmlevel() > 10) end;

for (set .@c, 0; .@c < getarraysize(.mobid); set .@c, .@c + 1) { if (killedrid == .mobid[.@c]) set .@s, 1; } // Check MvP
if (!.@s) end;
if (.a) announce "The user [" +strcharinfo(0) +"] has killed [" +getmonsterinfo(killedrid,0) +"] in map [" +strcharinfo(3) +"]",bc_blue|bc_all;

query_sql "SELECT char_id FROM mvp_ranking WHERE char_id = "+getcharid(0),@char_id;

if (@char_id == getcharid(0)) {
	query_sql "SELECT mvp_count FROM mvp_ranking WHERE char_id = "+getcharid(0),@mvptotal;
	set @mvptotal, @mvptotal +1;
	query_sql "UPDATE mvp_ranking SET mvp_count = '"+@mvptotal+"' WHERE char_id = "+getcharid(0);
	} else {
	set @mvptotal, 1;
	query_sql "INSERT INTO mvp_ranking (id,char_id,mvp_count) VALUES ('','"+getcharid(0)+"','"+@mvptotal+"')";
	}
	end;
}

prontera,104,97,6	script	MvP Ranking	586,{

OnInit:

waitingroom "MVP Ranking",0;



set .@menu$, "- Check TOP 10 MVP ranking:- Check my stats";
if (getgmlevel() >= 80) { set .@menu$, .@menu$ + ":- ^FF0000Reset All Rankings^000000"; }

mes "[Top " +$@top +" MvP Rank]";
mes "Please select an option.";
next;
switch(select(.@menu$)) {
case 1:
	query_sql "SELECT mvp_count FROM mvp_ranking ORDER BY mvp_count desc LIMIT "+$@top,@count[0];
	query_sql "SELECT char_id FROM mvp_ranking ORDER BY mvp_count desc LIMIT "+$@top,@char_id[0];
	query_sql "SELECT `name` from `char` WHERE `char_id` = '"+@char_id[.@c]+"'",.@names$[0];

	mes "[Top " +$@top +" MvP Rank]";
	for (set .@c, 0; .@c < $@top; set .@c, .@c + 1){
		mes "";
		mes "Top ^FF0000" +(.@c + 1)+"^000000 ^0000FF"+.@names$[.@c]+"^000000 with ^FF0000"+@count[.@c]+"^000000 MVP killed.";
	}
	close;
case 2:
	query_sql "SELECT `mvp_count` FROM `mvp_ranking` WHERE `char_id` = "+getcharid(0),@amount;
	if (@amount) {
		mes "[Top " +$@top +" MvP Rank]";
		mes "You have killed ^FF0000"+@amount+"^000000 MVP"+( ( .@amount == 1)? "." : "s." );
	}
	close;
case 3:
	mes "[Top " +$@top +" MvP Rank]";
	mes "This will delete all existing rankings.";
	mes "Do you want to proceed?";
	next;
	if (select("No:Yes") == 1) end;
	query_sql "DELETE FROM `mvp_ranking`";
	mes "[Top " +$@top +" MvP Rank]";
	mes "All rankings have been reset.";
	close;
	}
	end;
}

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  07/09/14
  • Last Seen:  

Bump!

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...