Jump to content
  • 0

Top level ranker npc not showing ranks


Yuna

Question


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   5
  • Joined:  03/16/16
  • Last Seen:  

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! /kis
 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  81
  • Reputation:   14
  • Joined:  11/17/17
  • Last Seen:  

Hi,
just change 

query_sql( "SELECT `base_level` FROM `char` WHERE `base_level` = `99`",.@acclvl );

to

query_sql( "SELECT `base_level` FROM `char` WHERE `base_level` = 99",.@acclvl );

 

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