When example top 2 reaches top 1 his name still stays on top 2 when he goes and is added on top 1.
here the script:
prontera,146,161,5 script CheckRank 118,{
mes "Hello, this is an Npc Ranker";
mes "Would you like to know the MvP Ranking?";
next;
switch(select("Top 20:Leave")){
case 1:
mes "Top 1 is : [" +$n1$ +"], Kills : [" +$k1 +"] MVPS";
mes "Top 2 is : [" +$n2$ +"], Kills : [" +$k2 +"] MVPS";
mes "Top 3 is : [" +$n3$ +"], Kills : [" +$k3 +"] MVPS";
mes "Top 4 is : [" +$n4$ +"], Kills : [" +$k4 +"] MVPS";
mes "Top 5 is : [" +$n5$ +"], Kills : [" +$k5 +"] MVPS";
mes "Top 6 is : [" +$n6$ +"], Kills : [" +$k6 +"] MVPS";
mes "Top 7 is : [" +$n7$ +"], Kills : [" +$k7 +"] MVPS";
mes "Top 8 is : [" +$n8$ +"], Kills : [" +$k8 +"] MVPS";
mes "Top 9 is : [" +$n9$ +"], Kills : [" +$k9 +"] MVPS";
mes "Top 10 is : [" +$n10$ +"], Kills : [" +$k10 +"] MVPS";
close;
break;
case 2:
mes "Have a nice day";
mes "bye";
close;
end;
}// end switch
}// end npc
- script count -1,{
OnNPCKillEvent:
if(killedrid == 1002){
set @rankp, @rankp + 1;
dispbottom "You have obtained 1 Rank Point, now you have "+@rankp+" .";
callfunc ("mvpladder",@rankp,strcharinfo(0));
}
}
function script mvpladder {
set @puntos, getarg(0);
set @nombres$, getarg(1);
if (@puntos > $k1) {
// Si el nombre se repite, eso se verifica con strcharinfo
if (@nombres$ == strcharinfo(0)) {
set $k1, @puntos;
set $n1$, @nombres$;
} else {
// Guardo el top1 anterior
set @oldn1$, $n1$;
set @oldk1, $k1;
// Ahora el top 2 se vuelve top1
set $k1, $k2;
set $n1$, $n2$;
// Ahora el top1 que teníamos guardado se vuelve top2
set $k2, @oldk1;
set $n2$, @oldn1$;
}
} else if (@puntos > $k2) {
if (@nombres$ == strcharinfo(0)) {
set $k2, @puntos;
set $n2$, @nombres$;
} else {
// Guardo el top2 anterior
set @oldn2$, $n2$;
set @oldk2, $k2;
// El nuevo top2 toma el lugar del antiguo top2
set $k2, $k3;
set $n2$, $n3$;
// El antiguo top2 se convierte en el nuevo top3
set $k3, @oldk2;
set $n3$, @oldn2$;
}
}
Question
eloscar23
Hello, here is the issues.
When example top 2 reaches top 1 his name still stays on top 2 when he goes and is added on top 1.
here the script:
prontera,146,161,5 script CheckRank 118,{
mes "Hello, this is an Npc Ranker";
mes "Would you like to know the MvP Ranking?";
next;
switch(select("Top 20:Leave")){
case 1:
mes "Top 1 is : [" +$n1$ +"], Kills : [" +$k1 +"] MVPS";
mes "Top 2 is : [" +$n2$ +"], Kills : [" +$k2 +"] MVPS";
mes "Top 3 is : [" +$n3$ +"], Kills : [" +$k3 +"] MVPS";
mes "Top 4 is : [" +$n4$ +"], Kills : [" +$k4 +"] MVPS";
mes "Top 5 is : [" +$n5$ +"], Kills : [" +$k5 +"] MVPS";
mes "Top 6 is : [" +$n6$ +"], Kills : [" +$k6 +"] MVPS";
mes "Top 7 is : [" +$n7$ +"], Kills : [" +$k7 +"] MVPS";
mes "Top 8 is : [" +$n8$ +"], Kills : [" +$k8 +"] MVPS";
mes "Top 9 is : [" +$n9$ +"], Kills : [" +$k9 +"] MVPS";
mes "Top 10 is : [" +$n10$ +"], Kills : [" +$k10 +"] MVPS";
close;
break;
case 2:
mes "Have a nice day";
mes "bye";
close;
end;
}// end switch
}// end npc
- script count -1,{
OnNPCKillEvent:
if(killedrid == 1002){
set @rankp, @rankp + 1;
dispbottom "You have obtained 1 Rank Point, now you have "+@rankp+" .";
callfunc ("mvpladder",@rankp,strcharinfo(0));
}
}
function script mvpladder {
set @puntos, getarg(0);
set @nombres$, getarg(1);
if (@puntos > $k1) {
// Si el nombre se repite, eso se verifica con strcharinfo
if (@nombres$ == strcharinfo(0)) {
set $k1, @puntos;
set $n1$, @nombres$;
} else {
// Guardo el top1 anterior
set @oldn1$, $n1$;
set @oldk1, $k1;
// Ahora el top 2 se vuelve top1
set $k1, $k2;
set $n1$, $n2$;
// Ahora el top1 que teníamos guardado se vuelve top2
set $k2, @oldk1;
set $n2$, @oldn1$;
}
} else if (@puntos > $k2) {
if (@nombres$ == strcharinfo(0)) {
set $k2, @puntos;
set $n2$, @nombres$;
} else {
// Guardo el top2 anterior
set @oldn2$, $n2$;
set @oldk2, $k2;
// El nuevo top2 toma el lugar del antiguo top2
set $k2, $k3;
set $n2$, $n3$;
// El antiguo top2 se convierte en el nuevo top3
set $k3, @oldk2;
set $n3$, @oldn2$;
}
}
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.