Jump to content
  • 0

[Rank] MvP


Question

Posted
//= ---
//= MvP Rank Improved v1.0
//= ---
//= This Rank will count every MvP you kill,
//= to be more clear, will count every mob
//= defined inside the array ".mobid[0]",
//= so, if you add the poring ID will count in the rank
//= you can modify and ad miniBoss because this array
//= only have all MvPs, that's the idea, only MvPs...
//= ---
-	script	Rank MvP	-1,{
OnInit: // Script Configuration
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; // MvP Ids
set .a, 0; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
set $@top, 30; // Max. Top Rank (Hihgly recommended between 5~10, more maybe bug the server (limited variables)
end;

OnNPCKillEvent: // Script execution
for (set .@c, 0; .@c < getarraysize(.mobid); set .@c, .@c + 1)
	if (killedrid == .mobid[.@c])
		set .@s, 1; // If a MvP
if (!.@s) end;
if (.a) // If announce On
	announce "El usuario [" +strcharinfo(0) +"] ha matado un [" +getmonsterinfo(killedrid,0) +"] en el mapa [" +strcharinfo(3) +"]",bc_blue|bc_all;
set MvP, MvP + 1;
callfunc ("MvPRank",MvP,strcharinfo(0));
end;
} // End Script

//prontera,147,171,5	script	MvP Rank	405,{ // NPC that will show the ranking
mes "[^FF0000MvP ^0000FFRank ^00FF00Top ^FF0000" +$@top +"^000000]";
for (set .@c, 0; .@c < $@top; set .@c, .@c + 1)
	mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" +getd("$topmvp" +.@c +"$") +"^000000 with ^FF0000" +getd("$topmvp" +.@c) +"^000000 MvP killed.";
close;
} // End if

function	script	MvPRank	{
set @mvptotal, getarg(0);
set @nomb$, getarg(1);
for (set .@c, 0; .@c < $@top; set .@c, .@c + 1) {
	if (@mvptotal >= getd("$topmvp" +.@c)) {
		if (strcharinfo(0) == getd("$topmvp" +.@c +"$")) {
			setd "$topmvp" +.@c, @mvptotal;
			setd "$topmvp" +.@c +"$", @nomb$;
			return;
		} else {
			if (getd("$topmvp" +(.@c + 1) +"$") == "") {
				setd "$topmvp" +.@c, @mvptotal;
				setd "$topmvp" +.@c +"$", @nomb$;
				return;
			} else {
				setd "$topmvp" +(.@c + 1), getd("$topmvp" +.@c);
				setd "$topmvp" +(.@c + 1) +"$", getd("$topmvp$" +.@c);
				setd "$topmvp" +.@c, @mvptotal;
				setd "$topmvp" +.@c +"$", @nomb$;
				return;
			} // End if
		} // End if
	} // End if
} // End loop
return;
} // End function

 

I am having a problem here.
if the player has killed more than 200 mvp he will automatically reset to 0.
and repeat as before.
please help her thank you very much ..

20 answers to this question

Recommended Posts

  • 0
Posted

Hello @Capuche . I'm using your script as my MVP Ranker. But i found something weird. Whenever i killed an MVP, the points raised randomly instead of 1. What should i change to make 1 mvp = 1 point? Thank you.

 

So sorry for the spam question. I thought my connection was bad and my post didn't send. Turns out it goes up. So sorry.

  • 0
Posted
On 4/23/2014 at 12:46 AM, Capuche said:

you take this script from a previous request ; the guy wanted to reset the points when the player gets more than 200 points


prontera,162,152,4	script	MVP Ladder	619,{
	query_sql( "DELETE FROM `mvp_ranking` WHERE `name` NOT IN ( SELECT `name` FROM `char` )" );
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );
	mes "[^FF0000MvP ^0000FFRank ^996600Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	set .a, 1; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
	set .top, 10; // Max. Top Rank (Hihgly recommended between 5~10, more maybe bug the server (limited variables)
	waitingroom "MvP Rank",0;
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "Player [" +strcharinfo(0) +"] had killed MVP [" +getmonsterinfo(killedrid,0) +"] in [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = `points` + 1";
	end;
}

The NPC reads all mobs poring - MVP as MVP.. and announces all mobs you kill

kindly help me

 

  • 0
Posted (edited)
17 hours ago, pajodex said:

Fix the Reset function.. (i killed 1 MVP  then it shows on the rankings "[1] GM - blabla ~ 1 kills") then i used reset function.. it turned to "~ 0 kills"

and after i killed an MVP again.. instead of showing "~ 1 kills" it showed " ~ 2 kills " it continued the MVP kills after the reset

Edited by celeron0134
  • 0
Posted
43 minutes ago, celeron0134 said:

Fix the Reset function.. (i killed 1 MVP  then it shows on the rankings "[1] GM - blabla ~ 1 kills") then i used reset function.. it turned to "~ 0 kills"

and after i killed an MVP again.. instead of showing "~ 1 kills" it showed " ~ 2 kills " it continued the MVP kills after the reset

https://github.com/pajodex/ScriptCollections/blob/master/mvp_kill.txt

here thanks for report

Posted

I honestly don't really like how that script is written.

In the MvPRank function, you are trying to build up a script-based ranking without facing position swaps or referals.

If it is of just 1 variable, I'd just run a query_sql command to get the ranking positions, there should be an example of exactly what you need in the script_commands.txt file, under the query_sql command explanation.

About the variable being resetted, I honestly didn't find anything that actually resets it. Try to check if you have some other scripts that may use the same variable.

Posted

Load this table

CREATE TABLE IF NOT EXISTS `mvp_ranking` (
  `char_id` int(11) unsigned NOT NULL DEFAULT '0',
  `name` varchar(30) NOT NULL DEFAULT '',
  `points` int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (`char_id`)
) ENGINE=MyISAM;

 

and this script

prontera,147,171,5	script	MvP Rank	75,{
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points limit "+ .top, .@name$, .@points );
	mes "[^FF0000MvP ^0000FFRank ^00FF00Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	set .a, 1; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
	set .top, 30; // Max. Top Rank (Hihgly recommended between 5~10, more maybe bug the server (limited variables)
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "El usuario [" +strcharinfo(0) +"] ha matado un [" +getmonsterinfo(killedrid,0) +"] en el mapa [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = if ( `points` + 1 > 200, 0, `points` + 1 )";
	end;
}
  • Upvote 1
Posted

Sir Capuche, I used your MVP ladder script, there is some bugs here. The ranking shows that..

 

Top 1 Game Master with 1 MVP killed.

Top 2 Milk with 1 MVP killed.

Top 3 Nakku with 7 MVP Killed.

 

as it shows, the player who kill the most didn't get to Top 1, may I know how to fix this please? Thanks in advance.

 

bottom is the edited script shown

CREATE TABLE IF NOT EXISTS `mvp_ranking` (
`char_id` int(11) unsigned NOT NULL DEFAULT '0',
`name` varchar(30) NOT NULL DEFAULT '',
`points` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`char_id`)
) ENGINE=MyISAM;


/////////////////////////////////////////////////////////////////

prontera,162,152,4	script	MVP Ladder	619,{
set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points limit "+ .top, .@name$, .@points );
	mes "[^FF0000MvP ^0000FFRank ^996600Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	set .a, 1; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
	set .top, 10; // Max. Top Rank (Hihgly recommended between 5~10, more maybe bug the server (limited variables)
waitingroom "MvP Rank",0;
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "Player [" +strcharinfo(0) +"] had killed MVP [" +getmonsterinfo(killedrid,0) +"] in [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = if ( `points` + 1 > 200, 0, `points` + 1 )";
	end;
}
Posted

Add desc

prontera,162,152,4	script	MVP Ladder	619,{
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );
//etc..
Posted

Thx, it works !! you're the best xD


Patskie, when I delete character, the character gone, but the rank still shows the name, how to make it like when delete character, name gone from the ladder. Hmmm....

Posted
query_sql( "DELETE FROM `mvp_ranking` WHERE `name` NOT IN ( SELECT `name` FROM `char` )" );
query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );

well, another method is that you can store the MVP ranking point at the char table..so that it get removed when the character is deleted.

Posted (edited)

Sir Emistry, I need to remove something from my current script? Can you tell me where to insert from...hmmm I show you the full script below, post me an edited full script if possible yea.. Thanks much appreciate it.

prontera,162,152,4	script	MVP Ladder	619,{
set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );	mes "[^FF0000MvP ^0000FFRank ^996600Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	set .a, 1; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
	set .top, 10; // Max. Top Rank (Hihgly recommended between 5~10, more maybe bug the server (limited variables)
waitingroom "MvP Rank",0;
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "Player [" +strcharinfo(0) +"] had killed MVP [" +getmonsterinfo(killedrid,0) +"] in [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = if ( `points` + 1 > 200, 0, `points` + 1 )";
	end;
}

Guys, there is something wrong with this MVP Rank script, at first I saw a player with 67 MVP Killed, and then the next day I click the NPC, it shows 11 MVP Killed. HELP~~ Anybody know whats wrong about this please !! =(((


Bump~ Anyone would help please... ><

Edited by fallen0519
Posted

 

Guys, there is something wrong with this MVP Rank script, at first I saw a player with 67 MVP Killed, and then the next day I click the NPC, it shows 11 MVP Killed. HELP~~ Anybody know whats wrong about this please !! =(((

you take this script from a previous request ; the guy wanted to reset the points when the player gets more than 200 points

prontera,162,152,4	script	MVP Ladder	619,{
	query_sql( "DELETE FROM `mvp_ranking` WHERE `name` NOT IN ( SELECT `name` FROM `char` )" );
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );
	mes "[^FF0000MvP ^0000FFRank ^996600Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	set .a, 1; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
	set .top, 10; // Max. Top Rank (Hihgly recommended between 5~10, more maybe bug the server (limited variables)
	waitingroom "MvP Rank",0;
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "Player [" +strcharinfo(0) +"] had killed MVP [" +getmonsterinfo(killedrid,0) +"] in [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = `points` + 1";
	end;
}

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...