Jump to content
  • 0
Hadeszeus

MVP Ladder Script Enhancement

Question

This MVP Ladder Script is createb by Euphy's. 

Source: http://rathena.org/board/topic/90971-euphys-mvp-ladder-bug-npc-hides/#entry237968

 

 

prontera,148,170,6 script MVP Ladder 891,{
mes "[MVP Ladder]";
mes "Hello!";
mes "What are you doing here?";
next;
switch(select("Check rankings.:My stats.:Nothing...")) {
case 1:
mes "[MVP Ladder]";
query_sql("SELECT char_id,CAST(`value` AS SIGNED) FROM `global_reg_value` WHERE `str` = 'MVP_Rank' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 20",.@cid,.@value);
for(set .@i,0; .@i query_sql("SELECT `name` FROM `char` WHERE char_id = "+.@cid[.@i]+";",.@j$);
set .@name$[.@i], .@j$;
}
if (!getarraysize(.@cid))
mes "The rankings are empty.";
else for(set .@i,0; .@i mes "["+(.@i+1)+"] "+.@name$[.@i]+" ~ "+.@value[.@i]+" kills";
close;
case 2:
mes "[MVP Ladder]";
mes "You have killed "+((MVP_Rank)?"^0055FF"+MVP_Rank:"no")+"^000000 MVP"+((MVP_Rank == 1)?".":"s.");
close;
case 3:
close;
}

OnNPCKillEvent:
if (getmonsterinfo(killedrid,22)) {
set MVP_Rank, MVP_Rank+1;
if (MVP_Rank == 1)
query_sql("INSERT INTO `global_reg_value` (`char_id`,`str`,`value`,`type`,`account_id`) VALUES ("+getcharid(0)+",'MVP_Rank','1',3,0)");
else
query_sql("UPDATE `global_reg_value` SET `value` = '"+MVP_Rank+"' WHERE char_id = "+getcharid(0)+" AND `str` ='MVP_Rank'");
dispbottom "~ You've killed "+MVP_Rank+" MVP"+((MVP_Rank == 1)?"":"s")+". ~";
specialeffect2 313;
}
end;
}

 

 

Can someone enhance this script.
The Idea is to maximize the used of it by giving rewards to TOP 10 Players. And the rewards will be given every month or maybe every week(much better if the setting is configurable.). The rewards amount will defend on ranking. Also limit the ranking display to 10.

After the reward was given, the ranking will be reset automatically.  

 

It's perfect if the previous month ranking are still view-able as menu. 

Edited by Hadeszeus

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

http://rathena.org/board/topic/91675-request-mvp-ladder-with-prizes/

 

it gives every month

It's perfect if the previous month ranking are still view-able as menu.

sry today I don't have enough time to edit ...

hope you know how to do ...

just copy them using 'insert into ... select' using archive type table

 

make a reply even you know or dunno how to do

Share this post


Link to post
Share on other sites
  • 0

 

http://rathena.org/board/topic/91675-request-mvp-ladder-with-prizes/

 

it gives every month

It's perfect if the previous month ranking are still view-able as menu.

sry today I don't have enough time to edit ...

hope you know how to do ...

just copy them using 'insert into ... select' using archive type table

 

make a reply even you know or dunno how to do

 

 

Wew thanks Annie!

 

I converted to your simple yet optimized script. I tried to QUERY but fail can you fix this?

 

prontera,134,183,3	script	MVP Ladder	891,{	mes "[MVP Ladder]";	mes "Hello!";	mes "What are you doing here?";	next;	switch(select("Check rankings.:My stats.:Nothing...")) {	case 1:		mes "[MVP Ladder]";		.@nb = query_sql( "select name, mvp_rank from `char` where mvp_rank > 0 order by mvp_rank desc limit 10", .@name$, .@count );			if ( !.@nb ) {				mes "no entry";				close;			}			for ( .@i = 0; .@i < .@nb; .@i++ )				mes ( .@i +1 )+". "+ .@name$[.@i] +" -> "+ .@count[.@i] +" points";	close;	case 2:		mes "[MVP Ladder]";		.@killed = query_sql("select mvp_rank from `char` where char_id = "+ getcharid(0));		mes "You have killed "+.@killed+" MVPs";		close;	case 3:		close;	}if ( $mvp_ladder_last_given == atoi( gettime(7) +""+ gettime(6) ) ) end;	goto L_give;OnClock0000:	if ( gettime(5) != 1 ) end;L_give:	.@nb = query_sql( "select char_id, name from `char` where mvp_rank > 0 order by mvp_rank desc limit 2", .@cid, .@name$ );	if ( !.@nb ) end;	setarray .@zeny, 1000000, 500000;	setarray .@reward, 501, 505;	for ( .@i = 0; .@i < .@nb; .@i++ )		query_sql "insert into mail ( send_name, dest_id, title, message, nameid, amount, identify, zeny, time ) values ( '"+ escape_sql( .@name$[.@i] ) +"', "+ .@cid[.@i] +", '[MVP RANK]', 'Congratulations for earning the "+ callfunc("F_GetNumSuffix", .@i +1 ) +" position in MVP rank. Here is your reward.', "+ .@reward[.@i] +", 1, 1, "+ .@zeny[.@i] +", unix_timestamp( now() ) )";	query_sql "update `char` set mvp_rank = 0"; // reset the ladder	$mvp_ladder_last_given = atoi( gettime(7) +""+ gettime(6) );	end;	OnNPCKillEvent:	if ( getmonsterinfo( killedrid, 22 ) )		query_sql "update `char` set mvp_rank = mvp_rank +1 where char_id = "+ getcharid(0);		.@killed = query_sql("select mvp_rank from `char` where char_id = "+ getcharid(0));	dispbottom "~ You've killed "+.@killed+" MVP. ~";	specialeffect2 313;	end;	}	

 

I'm having problem on this line 

Wherein I want to retain the menu option that display the current ranking of the player. (If his/she is not on the top)

case 2:		mes "[MVP Ladder]";		.@killed = query_sql("select mvp_rank from `char` where char_id = "+ getcharid(0));		mes "You have killed "+.@killed+" MVPs";		close;

 

and this

 

OnNPCKillEvent:	if ( getmonsterinfo( killedrid, 22 ) )		query_sql "update `char` set mvp_rank = mvp_rank +1 where char_id = "+ getcharid(0);		.@killed = query_sql("select mvp_rank from `char` where char_id = "+ getcharid(0));	dispbottom "~ You've killed "+.@killed+" MVP. ~";	specialeffect2 313;	end;	}	

I want to dispbottom the number of updated MVP kills of the user after update query for OnKillEvent.

Share this post


Link to post
Share on other sites
  • 0

.@killed = query_sql("select mvp_rank from `char` where char_id = "+ getcharid(0));
the .@killed will definitely return 1, since `char_id` column is a primary key

it will return the number of lines the SQL query retrieves

 

for example

prontera,156,185,6	script	kjhfksjf	100,{	.@nb = query_sql( "select account_id from login", .@aid );	for ( .@i = 0; .@i < .@nb; .@i++ )		dispbottom ( .@i+1 )+". "+ .@aid[.@i];	end;}
return

1. 1

2. 2000000

3. 2000001

4. 2000002

 

so it should be

query_sql "select mvp_rank from `char` where char_id = "+ getcharid(0), .@killed;

Share this post


Link to post
Share on other sites
  • 0

Now I'm learning a bit. Thank you so much :)

 

 

Annie, how can I add a quantity on the .@rewards?

 

e.g

 

setarray .@reward, 501, 501, 501, 501, 501;

 

setarray .@quantity, 10, 10, 10, 10, 10

 

 

how can i add it here

 

Here is your reward.', "+ .@reward[.@i] +", 1, 1, "+ .@zeny[.@i] +",;

Share this post


Link to post
Share on other sites
  • 0

:wub: ...

 

Thank you is not enough. I really appreciate your help...

Now I'm trying to push my self to learn so I can help others and the community. SOON...

 

 

-----------------------------------------------------------------------------------------------------------

 

BTW, I can't create  the table.. I tried to ask google but the solution is different.. sorry..

 

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( `date`, pos ) ) engine innodb' at line 7
 
I'm using MSQL Workbench/WAMP
Edited by Hadeszeus

Share this post


Link to post
Share on other sites
  • 0

ROFL !

points int(11) unsigned not nullprimary key ( `date`, pos )
after not null, missing a , <-- comma symbol

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.