Hey ya'll!
I am using this Top Level Ranking script found here:
My edited script:
- script MaxLvLAn -1,{
end;
OnPCBaseLvUpEvent:
if($numMaxLevel == 10)
disablenpc "MaxLvLAn";
else if (BaseLevel==.MaxLvl) {
// Check if the player for some reason, reached to Maximum level again
if(Rew > 0) end;
// Keep the player name on array
setarray $Rank$[$numMaxLevel], strcharinfo(0);
announce strcharinfo(0)+", you are the "+.places$[$numMaxLevel]+" person to reach the level "+.MaxLvl+", you will receive a reward",0;
//give prize
set @Rnd_Item, rand(0,(getarraysize(.Global_Array_Item)-1));
getitem .Global_Array_Item[@Rnd_Item],1;
// set this variable, to don't take rewards again
set Rew, 1;
// Keep the last array index
set $numMaxLevel,$numMaxLevel+1;
if($numMaxLevel == 9) // Should be 9 now because the array index start in 0 (Thanks to ToastOfDoom)
disablenpc "MaxLvLAn";
}
end;
OnInit:
// Set here the maximum level of your server
set .MaxLvl, 99;
// Array with the item id rewards
setarray .Global_Array_Item[0],504,505;
//array lookup for place names
setarray .places$[0], "First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth";
if(!$numMaxLevel) set $numMaxLevel, 0;
}
prontera,159,178,6 script MaxLvLRank 718,{
mes "[Santa]";
mes "Hello, would you like to see the Top Level Ranking?";
next;
if(select("See the Top Level Ranking:No, Thanks.")==1) {
mes "[Santa]";
mes "This rank shows the first 10 people who reached the";
mes "Maximum Level.";
next;
mes "[Santa]";
query_sql( "SELECT `base_level` FROM `char` WHERE `base_level` = `99`",.@acclvl );
if (.@acclvl <.MaxLvl) {
mes "No one reached the maximum level yet";
close;
}
for(set @i, 0; @i < getarraysize( $Rank$ ); set @i, @i + 1) mes @i+"º"+$Rank$[@i]+".";
} else {
mes "Ok, see ya.";
}
close;
}
So I got 2 issues. First, the ranks don't show up. map server shows up this SQL error (which I don't know how to fix)
[SQL]: DB error - Unknown column '99' in 'where clause'
[Debug]: at script.cpp:16683 - SELECT `base_level` FROM `char` WHERE `base_level` = `99`
[Debug]: Source (NPC): MaxLvLRank at prontera (159,178)
2nd, I would like each price to be different for each rank. could someone show me how it's done? Thanks!