Jump to content
  • 0
rqueen

MVP Ranker map exclusion

Question

Hi, how can I script this ranker npc I'm using so it won't record MVP kills in certains maps? (MVP rooms; i.e pvp_n_1-2)

 

Here's the part in the script:

 

OnNPCKillEvent:
	if([email protected] && (getgmlevel() < [email protected])) {
		set [email protected],killedrid;
		if([email protected] && ([email protected] <= (.db - 1000))) {
			if(getmonsterinfo([email protected],21) & 0x0020) {
				if(getmonsterinfo([email protected],22))
					callfunc "CPRankChar",[email protected] - 1,1,0; // MVP.
				else	callfunc "CPRankChar",[email protected] - 1,0,1; // Boss.
			}
		}
	}
	end;

 

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

for ( set [email protected],0; [email protected] < getarraysize(.restrictedMap$); set [email protected], [email protected] + 1 )
        if(strcharinfo(3) == .restrictedMaps$[[email protected]])
            end;

Change INTO

for ( set [email protected],0; [email protected] < getarraysize(.restrictedMaps$); set [email protected], [email protected] + 1 )
        if(strcharinfo(3) == .restrictedMaps$[[email protected]])
            end;

The problem was you were missing an ' S ' which made the loop useless. Though this shouldn't REALLY matter since, it would set the loop to 0 and end, making [email protected] = 0.

Edited by GmOcean
  • Upvote 1
Link to comment
Share on other sites

Add a restriction list as NPC-array in a OnInit event label:

 

OnInit:
    setarray .restrictedMaps$[0],"prontera","your_map",[...];

 

Add a check at the very beginning of your script after the NPCKillEvent label call:

 

OnNPCKillEvent:
 
    for( [email protected]=0; [email protected]<getarraysize(.restrictedMap$); [email protected]++ )
        if(strcharinfo(3) == .restrictedMaps$[[email protected]])
            end;
 
    if([email protected] && (getgmlevel() < [email protected])) {
    //[...]
Edited by Ryokem
  • Upvote 1
Link to comment
Share on other sites

Add a restriction list as NPC-array in a OnInit event label:

 

OnInit:
    setarray .restrictedMaps$[0],"prontera","your_map",[...];

 

Add a check at the very beginning of your script after the NPCKillEvent label call:

 

OnNPCKillEvent:
 
    for( [email protected]=0; [email protected]<getarraysize(.restrictedMap$); [email protected]++ )
        if(strcharinfo(3) == .restrictedMaps$[[email protected]])
            end;
 
    if([email protected] && (getgmlevel() < [email protected])) {
    //[...]

 

Hi! Thanks for you help. I'm getting this error:

 

    parse_line: expect command, missing function name or calling undeclared function

   210 :        end;*/

   211 :

   212 : // MVP Ranking:

   213 : OnNPCKillEvent:

   214 :

*  215 :     for( '.'@i=0; [email protected]<getarraysize(.restrictedMap$); [email protected]++ )

   216 :         if(strcharinfo(3) == .restrictedMaps$[[email protected]])

   217 :             end

   218 :

 

Link to comment
Share on other sites

Change : 

for( [email protected]=0; [email protected]<getarraysize(.restrictedMap$); [email protected]++ )

to :

for ( set [email protected],0; [email protected] < getarraysize(.restrictedMap$); set [email protected], [email protected] + 1 )
  • Upvote 1
Link to comment
Share on other sites

 

Change : 

for( [email protected]=0; [email protected]<getarraysize(.restrictedMap$); [email protected]++ )

to :

for ( set [email protected],0; [email protected] < getarraysize(.restrictedMap$); set [email protected], [email protected] + 1 )

Thanks. The errors are gone, but it still counts the MVP kills.

 

If it helps, here's the whole revised script:

//
// [========================================================]
// [===========            Ranker SQL            ===========]
// [========================================================]
// [ Version 17.1                                           ]
// [========================================================]
// [ Original script by: Ivion                              ]
// [========================================================]
// [ Description:                                           ]
// [--------------------------------------------------------]
// [                                                        ]
// [ - Level Ranking.                                       ]
// [ - PK Ranking.                                          ]
// [ - MvP Ranking.                                         ]
// [ - Emperium Ranking.                                    ]
// [ - [Guild] Level Ranking.                               ]
// [ - [Guild] WoE Ranking.                                 ]
// [ - Reward system for TOP 1 characters.                  ]
// [ - GMs Control Panel whispering to NPC:ranker .         ]
// [ - Auto-Purge of inactive guilds and players.           ]
// [========================================================]
// [ 5 last updates:                                        ]
// [--------------------------------------------------------]
// [                                                        ]
// [ v13: [Ivion]                                           ]
// [ - All your characters in the same account will be      ]
// [   displayed in a blue color.                           ]
// [                                                        ]
// [ v14: [Ivion]                                           ]
// [ - Added a PK delay so that players won't get PK points ]
// [   when killing the same player multiple times.         ]
// [ - Added new [Guild] Level Ranking.                     ]
// [                                                        ]
// [ v15: [Ivion]                                           ]
// [ - Changed the way SC_PKDELAY gets activated so that you]
// [   can use it by other scripts without instaling the    ]
// [   Ranker.                                              ]
// [                                                        ]
// [ v16: [Ivion]                                           ]
// [ - First SQL version. Should fix the lag that the TXT   ]
// [   version used to cause in the SQL servers.            ]
// [ - Bugfix: Players who has been playing during 7 days   ]
// [   without login off won't be purged from the rankings. ]
// [ - Bugfix: The Emperium and the [Guild] WoE rankings    ]
// [   didn't work in the WoE 1 castles.                    ]
// [ - Added a reward system for TOP 1 characters.          ]
// [ - New settings to configure the colors when displaying ]
// [   the rankings.                                        ]
// [ - Online and offline players will be displayed in a    ]
// [   different color.                                     ]
// [ - When a guild reaches a new position in a guild based ]
// [   ranking, the script will announce it to all the      ]
// [   connected guild members.                             ]
// [                                                        ]
// [ v16.1: [Ivion]                                         ]
// [ - BugFix: CPCount didn't count positions over  128.    ]
// [                                                        ]
// [ v17: [Ivion]                                           ]
// [ - Updated the MAX_MOB_DB value to 4000.                ]
// [                                                        ]
// [ v17.1: [Ivion]                                         ]
// [ - Bugfix: Search by class.                             ]
// [========================================================]
// [ http://www.eathena.ws/board/index.php?showtopic=193726 ]
// [========================================================]

-	script	ranker	-1,{

OnInit:

// [========================================================]
// [ Configuration:                                         ]
// [--------------------------------------------------------]

	set [email protected]$,"Ranker";	// NPC name.

	// Ranking Activation: (boolean)
	set [email protected],1;		// Level Ranking.
	set [email protected],1;		// PK Ranking.
	set [email protected],1;		// MvP Ranking.
	set [email protected],1;		// Emperium Ranking.
	set [email protected],1;		// [Guild] Level Ranking.
	set [email protected],1;		// [Guild] WoE Ranking.

	set .pk,10;		// Level range to get points in the PK Ranking. (Range | 0 = off)
	set [email protected],14;		// Inactivity time to be considered an inactive player: (Days | 0 = off)
	set [email protected],100;		// Number of entries that will be shown by the npc.

	set [email protected],80;		// Gm level required to avoid the Ranking.
	set .gm1,50;		// Gm level required to use the Control Panel whispering to NPC:ranker .

	// Colors:
	set [email protected]$[0],"ff2200";	// Your character/guild.
	set [email protected]$[1],"993333";	// Account characters.
	set [email protected]$[2],"66bbaa";	// Online Guild members.
	set [email protected]$[3],"449988";	// Offline Guild members.
	set [email protected]$[4],"888888";	// Online characters/guilds.
	set [email protected]$[5],"777777";	// Offline characters.

	// Ranking rewards:
	// Each Sunday, TOP 1 characters in each ranking will receive some item rewards. (Amount | 0 = off)
	set [email protected],7539;		// Reward item id.
	set [email protected],0;		// Level Ranking.
	set [email protected],5;		// PK Ranking.
	set [email protected],5;		// MvP Ranking.
	set [email protected],5;		// Emperium Ranking.

	set .db,4000;		// MAX_MOB_DB value in ./src/map/mob.h .
	
	setarray .restrictedMaps$[0],"pvp_n_1-2";

// [--------------------------------------------------------]
// [ End of configuration.                                  ]
// [========================================================]

	setBattleFlag "pk_level_range",.pk;

	// Create database tables:
	query_sql "CREATE TABLE IF NOT EXISTS `ranker_char` (`char_id` int(11) unsigned NOT NULL default '0', `offline` tinyint unsigned NOT NULL default '0')";
	query_sql "CREATE TABLE IF NOT EXISTS `ranker_guild` (`guild_id` int(11) unsigned)";

	// Add Rankings:
	if([email protected]) callfunc "CPAddRanking","a","Level Ranking","Base","base_level","Job","job_level",1,[email protected];
	if([email protected]) callfunc "CPAddRanking","b","PK Ranking","Kills","kills","Deaths","deaths",1,[email protected];
	else callfunc "CPDropRanking","kills","deaths",1;
	if([email protected]) callfunc "CPAddRanking","c","MvP Ranking","MVPs","mvps","Bosses","bosses",1,[email protected];
	else callfunc "CPDropRanking","mvps","bosses",1;
	if([email protected]) callfunc "CPAddRanking","d","Emperium Ranking","Emperiums","emperiums","Guardian Stones","stones",1,[email protected];
	else callfunc "CPDropRanking","emperiums","stones",1;
	if([email protected]) callfunc "CPAddRanking","f","Level Ranking","Level","guild_lv","Experience","exp",2;
	if([email protected]) callfunc "CPAddRanking","e","WoE Ranking","Castles","castles","Captures","captures",2;
	else callfunc "CPDropRanking","castles","captures",2;

	// Modify NPC names:
	set [email protected],1;
	while(!setnpcdisplay("CP#"[email protected],[email protected]$+"#"[email protected])) set [email protected],[email protected] + 1;
	callfunc "CPPurge";
	end;

OnClock0001:
	callfunc "CPPurge";
	if(!gettime(4)) {
		set [email protected],getarraysize([email protected]$);
		while([email protected]) {
			set [email protected],[email protected] - 1;
			if([email protected][[email protected]]) {
				query_sql "SELECT `"[email protected]$[[email protected]]+"`,`"[email protected]$[[email protected]]+"` FROM `ranker_char` LEFT JOIN `char` ON `char`.`char_id` = `ranker_char`.`char_id` ORDER BY `"[email protected]$[[email protected]]+"` DESC,`"[email protected]$[[email protected]]+"` DESC LIMIT 1",[email protected],[email protected];
				if(([email protected] > 0) || ([email protected] > 0)) {
					set [email protected],0;
					do {
						while([email protected]) {
							set [email protected],[email protected] - 1;
							query_sql "INSERT `mail` (`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`nameid`,`amount`,`identify`) VALUES ('"[email protected]$+"','1','"[email protected]$[[email protected]]+"','"[email protected][[email protected]]+"','"[email protected]$[[email protected]]+"','Congratulations! Here you are a reward for holding the TOP 1 position in the "[email protected]$[[email protected]]+"!',UNIX_TIMESTAMP(),'"[email protected]+"','"[email protected][[email protected]]+"','1')";
						}
						set [email protected],query_sql("SELECT `char`.`char_id`,`name` FROM `ranker_char` LEFT JOIN `char` ON `char`.`char_id` = `ranker_char`.`char_id` WHERE `"[email protected]$[[email protected]]+"` = '"[email protected]+"' AND `"[email protected]$[[email protected]]+"` = '"[email protected]+"' LIMIT "[email protected]+",128",[email protected],[email protected]$);
						set [email protected],[email protected] + [email protected];
					} while([email protected]);
				}
			}
		}
	}
	end;

OnPCLoginEvent:
	if(getgmlevel() < [email protected]) {
		callfunc "CPAddChar";
		query_sql "UPDATE `ranker_char` SET `offline` = '0' WHERE `char_id` = '"+getcharid(0)+"'";
	}
	end;

OnPCLogoutEvent:
	callfunc "CPAddChar";
	end;

OnPCBaseLvUpEvent:
OnPCJobLvUpEvent:
	if([email protected] && (getgmlevel() < [email protected])) {
		callfunc "CPAddChar";
		set [email protected],getcharid(0);
		query_sql "SELECT `base_level`,`job_level` FROM `char` WHERE `char_id` = '"[email protected]+"'",[email protected],[email protected];
		set [email protected],callfunc("CPCount",[email protected] - 1,[email protected],[email protected]);
		set [email protected],BaseLevel;
		set [email protected],JobLevel;
		query_sql "UPDATE `char` SET `base_level` = '"[email protected]+"',`job_level` = '"[email protected]+"' WHERE `char_id` = '"[email protected]+"'";
		set [email protected],callfunc("CPCount",[email protected] - 1,[email protected],[email protected]);
		if([email protected] < [email protected])
			announce "You have raised the position ["[email protected]+"] in the Level Ranking.",bc_self,0xff6622;
	}
	end;

// PK Ranking:
OnPCKillEvent:
	if([email protected] && (getgmlevel() < [email protected])) {
		set [email protected],getcharid(3);
		set [email protected],killedrid;
		if([email protected] != [email protected] {
			set [email protected],BaseLevel;
			if(attachrid([email protected]) // Killed:
				if((getgmlevel() < [email protected]) && (!.pk || ([email protected] <= (BaseLevel + .pk)))) {
					callfunc "CPRankChar",[email protected] - 1,0,-1;
					if(!sc_check(SC_PKDELAY))
						if(attachrid([email protected])) // Killer:
							callfunc "CPRankChar",[email protected] - 1,1,0;
				}
		}
	}
	end;

// MVP Ranking:
OnNPCKillEvent:

    for ( set [email protected],0; [email protected] < getarraysize(.restrictedMap$); set [email protected], [email protected] + 1 )
        if(strcharinfo(3) == .restrictedMaps$[[email protected]])
            end;

	if([email protected] && (getgmlevel() < [email protected])) {
		set [email protected],killedrid;
		if([email protected] && ([email protected] <= (.db - 1000))) {
			if(getmonsterinfo([email protected],21) & 0x0020) {
				if(getmonsterinfo([email protected],22))
					callfunc "CPRankChar",[email protected] - 1,1,0; // MVP.
				else	callfunc "CPRankChar",[email protected] - 1,0,1; // Boss.
			}
		}
	}
	end;

// WoE Ranking:
OnAgitEnd:
	if([email protected]) callsub OnWoE,0,19;
	end;

OnAgitEnd2:
	if([email protected]) callsub OnWoE,24,33;
	end;

OnWoE:
	set [email protected],query_sql("SELECT `guild_id`,COUNT(`guild_id`) FROM `guild_castle` WHERE `castle_id` BETWEEN '"+getarg(0)+"' AND '"+getarg(1)+"' GROUP by `guild_id`",[email protected],[email protected]);
	while([email protected]) {
		set [email protected],[email protected] - 1;
		callfunc "CPRankGuild",[email protected] - 1,[email protected][[email protected]],[email protected][[email protected]],0;
	}
	return;

// GMs Control Panel:
OnWhisperGlobal:
	if(getgmlevel() >= .gm1) {
		set [email protected]$,"^008888"[email protected]$+"^000000";
		mes [email protected]$;
		mes "Hello "+strcharinfo(0)+".";
		mes "This is the Control Panel of the server Ranking.";
		mes "How can I help you?";
		next;
		set [email protected],getarraysize([email protected]$);
		while([email protected]) {
			set [email protected],[email protected] - 1;
			set [email protected]$,[email protected]$[[email protected]];
			if([email protected]$ != "") {
				if(query_sql("SHOW COLUMNS FROM `ranker_"[email protected]$+"` WHERE `Field` IN ('"[email protected]$[[email protected]]+"','"[email protected]$[[email protected]]+"')",[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]) == 2)
					set [email protected]$[[email protected]],"Reset "[email protected]$[[email protected]];
			}
		}
		set [email protected],select("^880000Exit^000000","Reset all the Rankings.",[email protected]$[0],[email protected]$[1],[email protected]$[2],[email protected]$[3],[email protected]$[4],[email protected]$[5],[email protected]$[6],[email protected]$[7],[email protected]$[8],[email protected]$[9]) - 1;
		mes [email protected]$;
		if([email protected]) {
			if([email protected] == 1) {
				callfunc "CPReset0";
				mes "All the Rankings has been reseted.";
			}
			else {
				set [email protected],[email protected] - 2;
				callfunc "CPReset1",[email protected];
				mes "The "[email protected]$[[email protected]]+" has been reseted.";
			}
		}
		mes "Have a nice day.";
		close;
	}
	end;
}

// Add a new Ranking:
// getarg(0): Ranking Id. (char)
// getarg(1): Name.
// getarg(2): 1st header.
// getarg(3): 1st column name.
// getarg(4): 2nd header.
// getarg(5): 2nd column name.
// getarg(6): Ranking type. (1 = char | 2 = guild)
// getarg(7): Amount of reward items. (optional)
function	script	CPAddRanking	{

	set [email protected],getarg(6);
	if([email protected] == 1) set [email protected]$,"char";
	else if([email protected] == 2) set [email protected]$,"guild";
	if([email protected]$ != "") {
		set [email protected],getarraysize([email protected]$);
		setd "[email protected]"+getarg(0),[email protected] + 1;
		set [email protected]$[[email protected]],getarg(1);
		if([email protected] == 2) set [email protected]$[[email protected]],"[Guild] "[email protected]$[[email protected]];
		set [email protected]$[[email protected]],getarg(2);
		set [email protected]$[[email protected]],getarg(3);
		set [email protected]$[[email protected]],getarg(4);
		set [email protected]$[[email protected]],getarg(5);
		set [email protected]$[[email protected]],[email protected]$;
		if([email protected] == 1) set [email protected][[email protected]],getarg(7,0);
		callfunc "CPAddColumn",[email protected]$,getarg(3);
		callfunc "CPAddColumn",[email protected]$,getarg(5);
	}
	return;
}

// Add a new column to the database:
// getarg(0): Database name. ("char" | "guild")
// getarg(1): Column name.
function	script	CPAddColumn	{

	if(	!query_sql("SHOW COLUMNS FROM `"+getarg(0)+"` WHERE `Field` = '"+getarg(1)+"'",[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]) &&
		!query_sql("SHOW COLUMNS FROM `ranker_"+getarg(0)+"` WHERE `Field` = '"+getarg(1)+"'",[email protected],[email protected],[email protected],[email protected],[email protected],[email protected])
	)
		query_sql "ALTER TABLE `ranker_"+getarg(0)+"` ADD `"+getarg(1)+"` mediumint NOT NULL default '0'";
	return;
}

// Drop a ranking:
// getarg(0): 1st column.
// getarg(1): 2nd column.
// getarg(2): Ranking type. (1 = char | 2 = guild)
function	script	CPDropRanking	{

	set [email protected],getarg(2);
	if([email protected] == 1) set [email protected]$,"char";
	else if([email protected] == 2) set [email protected]$,"guild";
	if([email protected]$ != "") {
		callfunc "CPDropColumn",[email protected]$,getarg(0);
		callfunc "CPDropColumn",[email protected]$,getarg(1);
	}
	return;
}

// Drop a column of the database:
// getarg(0): Table name. ("char" | "guild")
// getarg(1): Column name.
function	script	CPDropColumn	{

	if(query_sql("SHOW COLUMNS FROM `ranker_"+getarg(0)+"` WHERE `Field` = '"+getarg(1)+"'",[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]))
		query_sql "ALTER TABLE `ranker_"+getarg(0)+"` DROP COLUMN `"+getarg(1)+"`";
	return;
}

// Purge inactive Guilds and Players:
function	script	CPPurge	{

	if([email protected]) {
		set [email protected],gettimetick(2) / (60 * 60 * 24);
		if([email protected] > $d) {
			set $d,[email protected]; // Last purged.
			query_sql "DELETE FROM `ranker_char` WHERE `offline` >= '"[email protected]+"'";
			query_sql "DELETE FROM `ranker_char` WHERE `char_id` NOT IN (SELECT `char_id` FROM `char`)";
			query_sql "UPDATE `ranker_char` LEFT JOIN `char` ON `char`.`char_id` = `ranker_char`.`char_id` SET `offline` = `offline` + 1 WHERE `online` = '0'";
			query_sql "DELETE FROM `ranker_guild` WHERE `guild_id` NOT IN (SELECT `guild_id` FROM `guild`)";
			query_sql "DELETE FROM `ranker_guild` WHERE `guild_id` NOT IN (SELECT `guild_id` FROM `ranker_char` LEFT JOIN `char` ON `char`.`char_id` = `ranker_char`.`char_id`)";
		}
	}
	return;
}

// Add a new player to the ranking:
function	script	CPAddChar	{

	if(playerattached()) {
		if(getgmlevel() < [email protected]) {
			set [email protected],getcharid(0);
			if(!query_sql("SELECT `char_id` FROM `ranker_char` WHERE `char_id` = '"[email protected]+"'",[email protected])
				query_sql "INSERT `ranker_char` (`char_id`) VALUES ('"[email protected]+"')";
			set [email protected],getcharid(2);
			if([email protected]) callfunc "CPAddGuild",[email protected];
		}
	}
	return;
}

// Add a new guild to the ranking:
// getarg(0): Guild Id.
function	script	CPAddGuild	{

	if(!query_sql("SELECT `guild_id` FROM `ranker_guild` WHERE `guild_id` = '"+getarg(0)+"'",[email protected])
		query_sql "INSERT `ranker_guild` (`guild_id`) VALUES ('"+getarg(0)+"')";
	return;
}

// Modify the values in the ranker_char table:
// getarg(0): Ranking Index.
// getarg(1): 1st value increment.
// getarg(2): 2nd value increment.
function	script	CPRankChar	{

	set [email protected],getarg(0);
	if(playerattached() && ([email protected]$[[email protected]] == "char")) {
		if(getgmlevel() < [email protected]) {
			callfunc "CPAddChar";
			set [email protected],getcharid(0);
			query_sql "SELECT `"[email protected]$[[email protected]]+"`,`"[email protected]$[[email protected]]+"` FROM `ranker_char` WHERE `char_id` = '"[email protected]+"'",[email protected],[email protected];
			set [email protected],callfunc("CPCount",[email protected],[email protected],[email protected]);
			set [email protected],[email protected] + getarg(1);
			set [email protected],[email protected] + getarg(2);
			query_sql "UPDATE `ranker_char` SET `"[email protected]$[[email protected]]+"` = '"[email protected]+"',`"[email protected]$[[email protected]]+"` = '"[email protected]+"' WHERE `char_id` = '"[email protected]+"'";
			set [email protected],callfunc("CPCount",[email protected],[email protected],[email protected]);
			if([email protected] < [email protected])
				announce "You have raised the position ["[email protected]+"] in the "[email protected]$[[email protected]]+".",bc_self,0xff6622;
		}
	}
	return;
}

// Modify the value in the ranker_guild table:
// getarg(0): Ranking Index.
// getarg(1): Guild Id.
// getarg(2): 1st value increment.
// getarg(3): 2nd value increment.
function	script	CPRankGuild	{

	set [email protected],getarg(0);
	set [email protected],getarg(1);
	if([email protected] && [email protected]$[[email protected]] == "guild") {
		callfunc "CPAddGuild",[email protected];
		query_sql "SELECT `"[email protected]$[[email protected]]+"`,`"[email protected]$[[email protected]]+"` FROM `ranker_guild` WHERE `guild_id` = '"[email protected]+"'",[email protected],[email protected];
		set [email protected],callfunc("CPCount",[email protected],[email protected],[email protected]);
		set [email protected],[email protected] + getarg(2);
		set [email protected],[email protected] + getarg(3);
		query_sql "UPDATE `ranker_guild` SET `"[email protected]$[[email protected]]+"` = '"[email protected]+"',`"[email protected]$[[email protected]]+"` = '"[email protected]+"' WHERE `guild_id` = '"[email protected]+"'";
		set [email protected],callfunc("CPCount",[email protected],[email protected],[email protected]);
		if([email protected] < [email protected]) {
			if(playerattached()) set [email protected],getcharid(3);
			set [email protected],query_sql("SELECT `account_id` FROM `char` WHERE `guild_id` = '"[email protected]+"' AND `online` = '1'",[email protected]);
			while([email protected]) {
				set [email protected],[email protected] - 1;
				if(attachrid([email protected][[email protected]])) announce "The ["+getguildname([email protected]+"] guild has raised the position ["[email protected]+"] in the "[email protected]$[[email protected]]+".",bc_self,0xff6622;
			}
			if([email protected]) attachrid [email protected];
		}
	}
	return;
}

// Returns the ranking position for the given values:
// getarg(0): Ranking Index.
// getarg(1): 1st value.
// getarg(2): 2nd value.
// getarg(3): Additional condition. (optional)
function	script	CPCount	{

	set [email protected],getarg(0);
	set [email protected]$,[email protected]$[[email protected]];
	if([email protected]$ != "") {
		set [email protected]$,getarg(3,"");
		if([email protected]$ != "") set [email protected]$,"AND "[email protected]$;
		query_sql "SELECT COUNT(*) FROM `ranker_"[email protected]$+"` LEFT JOIN `"[email protected]$+"` ON `"[email protected]$+"`.`"[email protected]$+"_id` = `ranker_"[email protected]$+"`.`"[email protected]$+"_id` WHERE (`"[email protected]$[[email protected]]+"` > '"+getarg(1)+"' OR (`"[email protected]$[[email protected]]+"` = '"+getarg(1)+"' AND `"[email protected]$[[email protected]]+"` > '"+getarg(2)+"')) "[email protected]$,[email protected];
		set [email protected],[email protected] + 1;
	}
	return [email protected];
}

// Reset all the rankings:
function	script	CPReset0	{

	query_sql "TRUNCATE `ranker_char`";
	query_sql "TRUNCATE `ranker_guild`";
	return;
}

// Reset a single ranking:
// getarg(0): Ranking Index.
function	script	CPReset1	{

	set [email protected],getarg(0);
	set [email protected]$,[email protected]$[[email protected]];
	if([email protected]$ != "") query_sql "UPDATE `ranker_"[email protected]$+"` SET `"[email protected]$[[email protected]]+"` = '0', `"[email protected]$[[email protected]]+"` = '0'";
	return;
}

// Activates when breaking an Emperium:
function	script	CPEmp0	{

	if(getgmlevel() < [email protected]) {
		set [email protected],getcharid(2);
		if([email protected])		callfunc "CPRankChar",[email protected] - 1,1,0;
		if([email protected] && [email protected]	callfunc "CPRankGuild",[email protected] - 1,[email protected],0,1;
	}
	return;
}

// Activates when breaking a Guardian Stone:
function	script	CPEmp1	{

	if([email protected]) callfunc "CPRankChar",[email protected] - 1,0,1;
	return;
}

// Npcs:
-	script	CP#0::CP	-1,{

	set [email protected]$,"^008888"[email protected]$+"^000000";
	mes [email protected]$;
	mes "Hello "+strcharinfo(0)+".";
	mes "Would you like to take a look at the server rankings?";
	next;
	set [email protected],getarraysize([email protected]$);
	while([email protected]) {
		set [email protected],[email protected] - 1;
		set [email protected]$[[email protected]],[email protected]$[[email protected]];
	}
	set [email protected],select("^880000Exit^000000",[email protected]$[0],[email protected]$[1],[email protected]$[2],[email protected]$[3],[email protected]$[4],[email protected]$[5],[email protected]$[6],[email protected]$[7],[email protected]$[8],[email protected]$[9]) - 2;
	mes [email protected]$;
	if([email protected] >= 0) {
		if([email protected]$[[email protected]] == "char") {
			mes "Which players do you want to be displayed?";
			next;
			set [email protected],select("^880000All the Players^000000","Online Players","Transcendent Characters","Babies","Select a Class") - 1;
			if([email protected] == 4)
				set [email protected],select("Novice","Swordman","Mage","Archer","Acolyte","Merchant","Thief","Taekwon","Gunslinger","Ninja","Super Novice","Knight","Crussader","Wizard","Sage","Hunter","Bard/Dancer","Priest","Monk","Blacksmith","Alchemist","Assassin","Rogue","Star Gladiator","Soul Linker") - 1;
			mes [email protected]$;
		}
		mes "Ok.";
		mes "I'll send the data to your chat window.";
	}
	mes "Have a nice day.";
	close2;
	emotion 12;
	if([email protected] >= 0) {
		callfunc "CPAddChar";
		if([email protected]$[[email protected]] == "char") { // Show Player based Ranking:
			switch([email protected] {
				case 1: set [email protected]$,"`online` = '1'";	break;
				case 2: set [email protected]$,"`class` BETWEEN '4001' AND '4022'";	break;
				case 3: set [email protected]$,"`class` BETWEEN '4023' AND '4045'";	break;
				case 4: 
					switch([email protected]) {
						case 0: set [email protected]$,"IN ('0','4001','4023')"; break;
						case 1: set [email protected]$,"IN ('1','4002','4024')"; break;
						case 2: set [email protected]$,"IN ('2','4003','4025')"; break;
						case 3: set [email protected]$,"IN ('3','4004','4026')"; break;
						case 4: set [email protected]$,"IN ('4','4005','4027')"; break;
						case 5: set [email protected]$,"IN ('5','4006','4028')"; break;
						case 6: set [email protected]$,"IN ('6','4007','4029')"; break;
						case 7: set [email protected]$,"= '4046'"; break;
						case 8: set [email protected]$,"= '24'"; break;
						case 9: set [email protected]$,"= '25'"; break;
						case 10: set [email protected]$,"IN ('23','4045')"; break;
						case 11: set [email protected]$,"IN ('7','13','4008','4014','4030','4036')"; break;
						case 12: set [email protected]$,"IN ('14','21','4015','4022','4037','4044')"; break;
						case 13: set [email protected]$,"IN ('9','4010','4032')"; break;
						case 14: set [email protected]$,"IN ('16','4017','4039')"; break;
						case 15: set [email protected]$,"IN ('11','4012','4034')"; break;
						case 16: set [email protected]$,"IN ('19','20','4020','4021','4042','4043')"; break;
						case 17: set [email protected]$,"IN ('8','4009','4031')"; break;
						case 18: set [email protected]$,"IN ('15','4016','4038')"; break;
						case 19: set [email protected]$,"IN ('10','4011','4033')"; break;
						case 20: set [email protected]$,"IN ('18','4019','4041')"; break;
						case 21: set [email protected]$,"IN ('12','4013','4035')"; break;
						case 22: set [email protected]$,"IN ('17','4018','4040')"; break;
						case 23: set [email protected]$,"IN ('4047','4048')"; break;
						case 24: set [email protected]$,"= '4049'"; break;
					}
					set [email protected]$,"`class` "[email protected]$;
					break;
			}
			if([email protected] set [email protected]$," WHERE "[email protected]$;
			set [email protected],getcharid(0);
			set [email protected],getcharid(2);
			set [email protected],getcharid(3);
			set [email protected],query_sql("SELECT `char`.`char_id`,`account_id`,`name`,`class`,`guild_id`,`online`,abs(`"[email protected]$[[email protected]]+"`),abs(`"[email protected]$[[email protected]]+"`) FROM `ranker_char` LEFT JOIN `char` ON `char`.`char_id` = `ranker_char`.`char_id`"[email protected]$+" ORDER BY `"[email protected]$[[email protected]]+"` DESC,`"[email protected]$[[email protected]]+"` DESC LIMIT "[email protected],[email protected],[email protected],[email protected]$,[email protected],[email protected],[email protected],[email protected],[email protected]);
			announce "[ "[email protected]$[[email protected]]+" ] [ "[email protected]$[[email protected]]+" / "[email protected]$[[email protected]]+" ]  -  Name  -  Job  -  Guild",bc_self,0xff7700;
			set [email protected],0;
			while([email protected] < [email protected]) {
				if([email protected][[email protected]] == [email protected]) { // You.
					set [email protected],0;
					set [email protected],0;
				}
				else if([email protected][[email protected]] == [email protected]) // Account.
					set [email protected],1;
				else if([email protected] && ([email protected][[email protected]] == [email protected])) { // Guild.
					if([email protected][[email protected]]) set [email protected],2;
					else set [email protected],3;
				}
				else {
					if([email protected][[email protected]]) set [email protected],4;
					else set [email protected],5;
				}
				if([email protected]) set [email protected],1;
				else if(([email protected][[email protected]] != [email protected][[email protected] - 1]) || ([email protected][[email protected]] != [email protected][[email protected] - 1]))
					set [email protected],[email protected] + 1;
				if([email protected][[email protected]]) set [email protected]$,getguildname([email protected][[email protected]]);
				else set [email protected]$,"";
				announce "[ "[email protected]+" ] [ "[email protected][[email protected]]+" / "[email protected][[email protected]]+" ]  -  "[email protected]$[[email protected]]+"  -  "+jobname([email protected][[email protected]])+"  -  "[email protected]$,bc_self,"0x"[email protected]$[[email protected]];
				set [email protected],[email protected] + 1;
			}
			if([email protected] && ([email protected] >= [email protected])) {
				if([email protected] set [email protected]$," AND "[email protected]$;
				if(query_sql("SELECT abs(`"[email protected]$[[email protected]]+"`),abs(`"[email protected]$[[email protected]]+"`) FROM `ranker_char` LEFT JOIN `char` ON `char`.`char_id` = `ranker_char`.`char_id` WHERE `char`.`char_id` = '"[email protected]+"'"[email protected]$,[email protected],[email protected])) {
					set [email protected],callfunc("CPCount",[email protected],[email protected],[email protected],[email protected]$);
					if([email protected]) set [email protected]$,getguildname([email protected]);
					else set [email protected]$,"";
					announce "[ "[email protected]+" ] [ "[email protected]+" / "[email protected]+" ]  -  "+strcharinfo(0)+"  -  "+jobname(class)+"  -  "[email protected]$,bc_self,"0x"[email protected]$[0];
				}
			}
		}
		else if([email protected]$[[email protected]] == "guild") { // Show Guild based Ranking:
			set [email protected],getcharid(2);
			set [email protected],query_sql("SELECT `guild`.`guild_id`,`name`,abs(`"[email protected]$[[email protected]]+"`),abs(`"[email protected]$[[email protected]]+"`) FROM `ranker_guild` LEFT JOIN `guild` ON `guild`.`guild_id` = `ranker_guild`.`guild_id` ORDER BY `"[email protected]$[[email protected]]+"` DESC,`"[email protected]$[[email protected]]+"` DESC LIMIT "[email protected],[email protected],[email protected]$,[email protected],[email protected]);
			announce "[ "[email protected]$[[email protected]]+" ] [ "[email protected]$[[email protected]]+" / "[email protected]$[[email protected]]+" ]  -  Name",bc_self,0xff7700;
			set [email protected],0;
			while([email protected] < [email protected]) {
				if([email protected][[email protected]] == [email protected]) { // Your Guild.
					set [email protected],0;
					set [email protected],0;
				}
				else set [email protected],4;
				if([email protected]) set [email protected],1;
				else if(([email protected][[email protected]] != [email protected][[email protected] - 1]) || ([email protected][[email protected]] != [email protected][[email protected] - 1]))
					set [email protected],[email protected] + 1;
				announce "[ "[email protected]+" ] [ "[email protected][[email protected]]+" / "[email protected][[email protected]]+" ]  -  "[email protected]$[[email protected]],bc_self,"0x"[email protected]$[[email protected]];
				set [email protected],[email protected] + 1;
			}
			if([email protected] && ([email protected] >= [email protected])) {
				query_sql "SELECT `"[email protected]$[[email protected]]+"`,`"[email protected]$[[email protected]]+"` FROM `ranker_guild` LEFT JOIN `guild` ON `guild`.`guild_id` = `ranker_guild`.`guild_id` WHERE `guild`.`guild_id` = '"[email protected]+"'",[email protected],[email protected];
				set [email protected],callfunc("CPCount",[email protected],[email protected],[email protected]);
				set [email protected]$,getguildname([email protected]);
				announce "[ "[email protected]+" ] [ "[email protected]+" / "[email protected]+" ]  -  "[email protected]$,bc_self,"0x"[email protected]$[0];
			}
		}
		if([email protected]) announce "No result has been found.",bc_self,0x777777;
		announce "----------",bc_self,0xff7700;
	}
	end;
}
alberta,195,138,4	duplicate(CP)	CP#1	859
alberta,51,250,5	duplicate(CP)	CP#2	859
aldebaran,133,116,6	duplicate(CP)	CP#3	859
aldebaran,133,236,6	duplicate(CP)	CP#4	859
alde_gld,234,150,4	duplicate(CP)	CP#5	859
amatsu,242,279,6	duplicate(CP)	CP#6	859
amatsu,99,260,4	duplicate(CP)	CP#7	859
amatsu,207,100,4	duplicate(CP)	CP#8	859
ayothaya,212,204,4	duplicate(CP)	CP#9	859
ayothaya,157,78,4	duplicate(CP)	CP#10	859
comodo,180,329,4	duplicate(CP)	CP#11	859
comodo,205,112,4	duplicate(CP)	CP#12	859
comodo,316,181,4	duplicate(CP)	CP#13	859
comodo,36,221,6	duplicate(CP)	CP#14	859
einbech,66,92,6	duplicate(CP)	CP#15	859
einbech,131,245,6	duplicate(CP)	CP#16	859
einbech,42,201,8	duplicate(CP)	CP#17	859
einbroch,74,187,2	duplicate(CP)	CP#18	859
einbroch,149,315,6	duplicate(CP)	CP#19	859
einbroch,152,49,4	duplicate(CP)	CP#20	859
einbroch,249,239,2	duplicate(CP)	CP#21	859
geffen,123,69,4	duplicate(CP)	CP#22	859
geffen,41,107,6	duplicate(CP)	CP#23	859
geffen,124,177,4	duplicate(CP)	CP#24	859
geffen,171,123,6	duplicate(CP)	CP#25	859
gef_fild13,193,244,4	duplicate(CP)	CP#26	859
gonryun,152,110,6	duplicate(CP)	CP#27	859
gonryun,168,180,2	duplicate(CP)	CP#28	859
gonryun,153,16,6	duplicate(CP)	CP#29	859
hugel,101,130,4	duplicate(CP)	CP#30	859
hugel,178,170,4	duplicate(CP)	CP#31	859
izlude,121,94,6	duplicate(CP)	CP#32	859
jawaii,136,255,4	duplicate(CP)	CP#33	859
yuno,175,89,4	duplicate(CP)	CP#34	859
yuno,68,203,4	duplicate(CP)	CP#35	859
sch_gld,291,123,4	duplicate(CP)	CP#36	859
lighthalzen,209,95,6	duplicate(CP)	CP#37	859
lighthalzen,218,322,4	duplicate(CP)	CP#38	859
lighthalzen,311,299,4	duplicate(CP)	CP#39	859
louyang,203,104,6	duplicate(CP)	CP#40	859
louyang,57,246,4	duplicate(CP)	CP#41	859
xmas,139,306,6	duplicate(CP)	CP#42	859
xmas,161,108,4	duplicate(CP)	CP#43	859
morocc,166,76,4	duplicate(CP)	CP#44	859
morocc,47,174,4	duplicate(CP)	CP#45	859
morocc,166,289,4	duplicate(CP)	CP#46	859
morocc,279,197,8	duplicate(CP)	CP#47	859
morocc,35,290,4	duplicate(CP)	CP#48	859
moscovia,238,198,4	duplicate(CP)	CP#49	859
moscovia,159,62,4	duplicate(CP)	CP#50	859
niflheim,29,158,6	duplicate(CP)	CP#51	859
niflheim,199,188,4	duplicate(CP)	CP#52	859
payon,213,72,6	duplicate(CP)	CP#53	859
payon,160,49,2	duplicate(CP)	CP#54	859
payon,232,316,4	duplicate(CP)	CP#55	859
payon,63,120,6	duplicate(CP)	CP#56	859
pay_gld,201,157,4	duplicate(CP)	CP#57	859
prontera,165,71,4	duplicate(CP)	CP#58	859
prontera,40,212,6	duplicate(CP)	CP#59	859
prontera,164,170,4	duplicate(CP)	CP#60	859
prontera,259,213,4	duplicate(CP)	CP#61	859
prontera,161,312,4	duplicate(CP)	CP#62	859
prt_gld,166,75,4	duplicate(CP)	CP#63	859
rachel,264,136,4	duplicate(CP)	CP#64	859
rachel,150,144,4	duplicate(CP)	CP#65	859
rachel,135,45,4	duplicate(CP)	CP#66	859
rachel,39,131,6	duplicate(CP)	CP#67	859
aru_gld,179,326,6	duplicate(CP)	CP#68	859
umbala,121,128,8	duplicate(CP)	CP#69	859
umbala,163,249,4	duplicate(CP)	CP#70	859
veins,209,234,4	duplicate(CP)	CP#71	859
veins,222,352,4	duplicate(CP)	CP#72	859
veins,157,62,6	duplicate(CP)	CP#73	859
mid_camp,219,287,4	duplicate(CP)	CP#74	859
mid_camp,138,235,6	duplicate(CP)	CP#75	859
mid_camp,252,232,8	duplicate(CP)	CP#76	859
manuk,281,126,2	duplicate(CP)	CP#77	859
manuk,181,177,6	duplicate(CP)	CP#78	859
splendide,181,137,6	duplicate(CP)	CP#79	859
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...

Important Information

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