Jump to content
  • 0
Sign in to follow this  
Nameleszx

Another problem here.

Question

8 answers to this question

Recommended Posts

  • 0

 

// [========================================================]
// [=========== 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 $@CPn$,"Ranker"; // NPC name.

// Ranking Activation: (boolean)
set .@r0,1; // Level Ranking.
set .@r1,1; // PK Ranking.
set .@r2,1; // MvP Ranking.
set .@r3,1; // Emperium Ranking.
set .@r4,1; // [Guild] Level Ranking.
set .@r5,1; // [Guild] WoE Ranking.

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

set $@CPgm0,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 $@CPco$[0],"ff2200"; // Your character/guild.
set $@CPco$[1],"993333"; // Account characters.
set $@CPco$[2],"66bbaa"; // Online Guild members.
set $@CPco$[3],"449988"; // Offline Guild members.
set $@CPco$[4],"888888"; // Online characters/guilds.
set $@CPco$[5],"777777"; // Offline characters.

// Ranking rewards:
// Each Sunday, TOP 1 characters in each ranking will receive some item rewards. (Amount | 0 = off)
set $@CPp,7539; // Reward item id.
set .@p0,0; // Level Ranking.
set .@p1,5; // PK Ranking.
set .@p2,5; // MvP Ranking.
set .@p3,5; // Emperium Ranking.

set .db,4000; // MAX_MOB_DB value in ./src/map/mob.h .

// [--------------------------------------------------------]
// [ 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(.@r0) callfunc "CPAddRanking","a","Level Ranking","Base","base_level","Job","job_level",1,.@p0;
if(.@r1) callfunc "CPAddRanking","b","PK Ranking","Kills","kills","Deaths","deaths",1,.@p1;
else callfunc "CPDropRanking","kills","deaths",1;
if(.@r2) callfunc "CPAddRanking","c","MvP Ranking","MVPs","mvps","Bosses","bosses",1,.@p2;
else callfunc "CPDropRanking","mvps","bosses",1;
if(.@r3) callfunc "CPAddRanking","d","Emperium Ranking","Emperiums","emperiums","Guardian Stones","stones",1,.@p3;
else callfunc "CPDropRanking","emperiums","stones",1;
if(.@r4) callfunc "CPAddRanking","f","Level Ranking","Level","guild_lv","Experience","exp",2;
if(.@r5) callfunc "CPAddRanking","e","WoE Ranking","Castles","castles","Captures","captures",2;
else callfunc "CPDropRanking","castles","captures",2;

// Modify NPC names:
set .@a,1;
while(!setnpcdisplay("CP#"+.@a,$@CPn$+"#"+.@a)) set .@a,.@a + 1;
callfunc "CPPurge";
end;

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

OnPCLoginEvent:
if(getgmlevel() < $@CPgm0) {
callfunc "CPAddChar";
query_sql "UPDATE `ranker_char` SET `offline` = '0' WHERE `char_id` = '"+getcharid(0)+"'";
}
end;

OnPCLogoutEvent:
callfunc "CPAddChar";
end;

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

// PK Ranking:
OnPCKillEvent:
if($@CPb && (getgmlevel() < $@CPgm0)) {
set .@a,getcharid(3);
set .@b,killedrid;
if(.@a != .@B) {
set .@c,BaseLevel;
if(attachrid(.@B)) // Killed:
if((getgmlevel() < $@CPgm0) && (!.pk || (.@c <= (BaseLevel + .pk)))) {
callfunc "CPRankChar",$@CPb - 1,0,-1;
if(!sc_check(SC_PKDELAY))
if(attachrid(.@a)) // Killer:
callfunc "CPRankChar",$@CPb - 1,1,0;
}
}
}
end;

// MVP Ranking:
OnNPCKillEvent:
if($@CPc && (getgmlevel() < $@CPgm0)) {
set .@a,killedrid;
if(.@a && (.@a <= (.db - 1000))) {
if(getmonsterinfo(.@a,21) & 0x0020) {
if(getmonsterinfo(.@a,22))
callfunc "CPRankChar",$@CPc - 1,1,0; // MVP.
else callfunc "CPRankChar",$@CPc - 1,0,1; // Boss.
}
}
}
end;

// WoE Ranking:
OnAgitEnd:
if($@CPe) callsub OnWoE,0,19;
end;

OnAgitEnd2:
if($@CPe) callsub OnWoE,24,33;
end;

OnWoE:
set .@a,query_sql("SELECT `guild_id`,COUNT(`guild_id`) FROM `guild_castle` WHERE `castle_id` BETWEEN '"+getarg(0)+"' AND '"+getarg(1)+"' GROUP by `guild_id`",.@b,.@c);
while(.@a) {
set .@a,.@a - 1;
callfunc "CPRankGuild",$@CPe - 1,.@b[.@a],.@c[.@a],0;
}
return;

// GMs Control Panel:
OnWhisperGlobal:
if(getgmlevel() >= .gm1) {
set .@n$,"^008888"+$@CPn$+"^000000";
mes .@n$;
mes "Hello "+strcharinfo(0)+".";
mes "This is the Control Panel of the server Ranking.";
mes "How can I help you?";
next;
set .@a,getarraysize($@CP0$);
while(.@a) {
set .@a,.@a - 1;
set .@a$,$@CP5$[.@a];
if(.@a$ != "") {
if(query_sql("SHOW COLUMNS FROM `ranker_"+.@a$+"` WHERE `Field` IN ('"+$@CP2$[.@a]+"','"+$@CP4$[.@a]+"')",.@c,.@c,.@c,.@c,.@c,.@c) == 2)
set .@r$[.@a],"Reset "+$@CP0$[.@a];
}
}
set .@a,select("^880000Exit^000000","Reset all the Rankings.",.@r$[0],.@r$[1],.@r$[2],.@r$[3],.@r$[4],.@r$[5],.@r$[6],.@r$[7],.@r$[8],.@r$[9]) - 1;
mes .@n$;
if(.@a) {
if(.@a == 1) {
callfunc "CPReset0";
mes "All the Rankings has been reseted.";
}
else {
set .@a,.@a - 2;
callfunc "CPReset1",.@a;
mes "The "+$@CP0$[.@a]+" 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 .@a,getarg(6);
if(.@a == 1) set .@a$,"char";
else if(.@a == 2) set .@a$,"guild";
if(.@a$ != "") {
set .@b,getarraysize($@CP0$);
setd "$@CP"+getarg(0),.@b + 1;
set $@CP0$[.@b],getarg(1);
if(.@a == 2) set $@CP0$[.@b],"[Guild] "+$@CP0$[.@b];
set $@CP1$[.@b],getarg(2);
set $@CP2$[.@b],getarg(3);
set $@CP3$[.@b],getarg(4);
set $@CP4$[.@b],getarg(5);
set $@CP5$[.@b],.@a$;
if(.@a == 1) set $@CP6[.@b],getarg(7,0);
callfunc "CPAddColumn",.@a$,getarg(3);
callfunc "CPAddColumn",.@a$,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)+"'",.@a,.@a,.@a,.@a,.@a,.@a) &&
!query_sql("SHOW COLUMNS FROM `ranker_"+getarg(0)+"` WHERE `Field` = '"+getarg(1)+"'",.@a,.@a,.@a,.@a,.@a,.@a)
)
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 .@a,getarg(2);
if(.@a == 1) set .@a$,"char";
else if(.@a == 2) set .@a$,"guild";
if(.@a$ != "") {
callfunc "CPDropColumn",.@a$,getarg(0);
callfunc "CPDropColumn",.@a$,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)+"'",.@a,.@a,.@a,.@a,.@a,.@a))
query_sql "ALTER TABLE `ranker_"+getarg(0)+"` DROP COLUMN `"+getarg(1)+"`";
return;
}

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

if($@CPit) {
set .@a,gettimetick(2) / (60 * 60 * 24);
if(.@a > $d) {
set $d,.@a; // Last purged.
query_sql "DELETE FROM `ranker_char` WHERE `offline` >= '"+$@CPit+"'";
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() < $@CPgm0) {
set .@a,getcharid(0);
if(!query_sql("SELECT `char_id` FROM `ranker_char` WHERE `char_id` = '"+.@a+"'",.@B))
query_sql "INSERT `ranker_char` (`char_id`) VALUES ('"+.@a+"')";
set .@a,getcharid(2);
if(.@a) callfunc "CPAddGuild",.@a;
}
}
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)+"'",.@B))
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 .@a,getarg(0);
if(playerattached() && ($@CP5$[.@a] == "char")) {
if(getgmlevel() < $@CPgm0) {
callfunc "CPAddChar";
set .@b,getcharid(0);
query_sql "SELECT `"+$@CP2$[.@a]+"`,`"+$@CP4$[.@a]+"` FROM `ranker_char` WHERE `char_id` = '"+.@b+"'",.@c,.@d;
set .@e,callfunc("CPCount",.@a,.@c,.@d);
set .@c,.@c + getarg(1);
set .@d,.@d + getarg(2);
query_sql "UPDATE `ranker_char` SET `"+$@CP2$[.@a]+"` = '"+.@c+"',`"+$@CP4$[.@a]+"` = '"+.@d+"' WHERE `char_id` = '"+.@b+"'";
set .@f,callfunc("CPCount",.@a,.@c,.@d);
if(.@f < .@e)
announce "You have raised the position ["+.@f+"] in the "+$@CP0$[.@a]+".",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 .@a,getarg(0);
set .@b,getarg(1);
if(.@b && $@CP5$[.@a] == "guild") {
callfunc "CPAddGuild",.@b;
query_sql "SELECT `"+$@CP2$[.@a]+"`,`"+$@CP4$[.@a]+"` FROM `ranker_guild` WHERE `guild_id` = '"+.@b+"'",.@c,.@d;
set .@e,callfunc("CPCount",.@a,.@c,.@d);
set .@c,.@c + getarg(2);
set .@d,.@d + getarg(3);
query_sql "UPDATE `ranker_guild` SET `"+$@CP2$[.@a]+"` = '"+.@c+"',`"+$@CP4$[.@a]+"` = '"+.@d+"' WHERE `guild_id` = '"+.@b+"'";
set .@f,callfunc("CPCount",.@a,.@c,.@d);
if(.@f < .@e) {
if(playerattached()) set .@g,getcharid(3);
set .@d,query_sql("SELECT `account_id` FROM `char` WHERE `guild_id` = '"+.@b+"' AND `online` = '1'",.@e);
while(.@d) {
set .@d,.@d - 1;
if(attachrid(.@e[.@d])) announce "The ["+getguildname(.@B)+] guild has raised the position ["+.@f+"] in the "+$@CP0$[.@a]+".",bc_self,0xff6622;
}
if(.@g) attachrid .@g;
}
}
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 .@a,getarg(0);
set .@a$,$@CP5$[.@a];
if(.@a$ != "") {
set .@b$,getarg(3,"");
if(.@b$ != "") set .@b$,"AND "+.@b$;
query_sql "SELECT COUNT(*) FROM `ranker_"+.@a$+"` LEFT JOIN `"+.@a$+"` ON `"+.@a$+"`.`"+.@a$+"_id` = `ranker_"+.@a$+"`.`"+.@a$+"_id` WHERE (`"+$@CP2$[.@a]+"` > '"+getarg(1)+"' OR (`"+$@CP2$[.@a]+"` = '"+getarg(1)+"' AND `"+$@CP4$[.@a]+"` > '"+getarg(2)+"')) "+.@b$,.@b;
set .@b,.@b + 1;
}
return .@b;
}

// 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 .@a,getarg(0);
set .@a$,$@CP5$[.@a];
if(.@a$ != "") query_sql "UPDATE `ranker_"+.@a$+"` SET `"+$@CP2$[.@a]+"` = '0', `"+$@CP4$[.@a]+"` = '0'";
return;
}

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

if(getgmlevel() < $@CPgm0) {
set .@b,getcharid(2);
if($@CPd) callfunc "CPRankChar",$@CPd - 1,1,0;
if($@CPe && .@B) callfunc "CPRankGuild",$@CPe - 1,.@b,0,1;
}
return;
}

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

if($@CPd) callfunc "CPRankChar",$@CPd - 1,0,1;
return;
}

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

set .@n$,"^008888"+$@CPn$+"^000000";
mes .@n$;
mes "Hello "+strcharinfo(0)+".";
mes "Would you like to take a look at the server rankings?";
next;
set .@a,getarraysize($@CP0$);
while(.@a) {
set .@a,.@a - 1;
set .@r$[.@a],$@CP0$[.@a];
}
set .@a,select("^880000Exit^000000",.@r$[0],.@r$[1],.@r$[2],.@r$[3],.@r$[4],.@r$[5],.@r$[6],.@r$[7],.@r$[8],.@r$[9]) - 2;
mes .@n$;
if(.@a >= 0) {
if($@CP5$[.@a] == "char") {
mes "Which players do you want to be displayed?";
next;
set .@b,select("^880000All the Players^000000","Online Players","Transcendent Characters","Babies","Select a Class") - 1;
if(.@b == 4)
set .@c,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 .@n$;
}
mes "Ok.";
mes "I'll send the data to your chat window.";
}
mes "Have a nice day.";
close2;
emotion 12;
if(.@a >= 0) {
callfunc "CPAddChar";
if($@CP5$[.@a] == "char") { // Show Player based Ranking:
switch(.@B) {
case 1: set .@a$,"`online` = '1'"; break;
case 2: set .@a$,"`class` BETWEEN '4001' AND '4022'"; break;
case 3: set .@a$,"`class` BETWEEN '4023' AND '4045'"; break;
case 4:
switch(.@c) {
case 0: set .@a$,"IN ('0','4001','4023')"; break;
case 1: set .@a$,"IN ('1','4002','4024')"; break;
case 2: set .@a$,"IN ('2','4003','4025')"; break;
case 3: set .@a$,"IN ('3','4004','4026')"; break;
case 4: set .@a$,"IN ('4','4005','4027')"; break;
case 5: set .@a$,"IN ('5','4006','4028')"; break;
case 6: set .@a$,"IN ('6','4007','4029')"; break;
case 7: set .@a$,"= '4046'"; break;
case 8: set .@a$,"= '24'"; break;
case 9: set .@a$,"= '25'"; break;
case 10: set .@a$,"IN ('23','4045')"; break;
case 11: set .@a$,"IN ('7','13','4008','4014','4030','4036')"; break;
case 12: set .@a$,"IN ('14','21','4015','4022','4037','4044')"; break;
case 13: set .@a$,"IN ('9','4010','4032')"; break;
case 14: set .@a$,"IN ('16','4017','4039')"; break;
case 15: set .@a$,"IN ('11','4012','4034')"; break;
case 16: set .@a$,"IN ('19','20','4020','4021','4042','4043')"; break;
case 17: set .@a$,"IN ('8','4009','4031')"; break;
case 18: set .@a$,"IN ('15','4016','4038')"; break;
case 19: set .@a$,"IN ('10','4011','4033')"; break;
case 20: set .@a$,"IN ('18','4019','4041')"; break;
case 21: set .@a$,"IN ('12','4013','4035')"; break;
case 22: set .@a$,"IN ('17','4018','4040')"; break;
case 23: set .@a$,"IN ('4047','4048')"; break;
case 24: set .@a$,"= '4049'"; break;
}
set .@a$,"`class` "+.@a$;
break;
}
if(.@B) set .@b$," WHERE "+.@a$;
set .@c,getcharid(0);
set .@d,getcharid(2);
set .@e,getcharid(3);
set .@f,query_sql("SELECT `char`.`char_id`,`account_id`,`name`,`class`,`guild_id`,`online`,abs(`"+$@CP2$[.@a]+"`),abs(`"+$@CP4$[.@a]+"`) FROM `ranker_char` LEFT JOIN `char` ON `char`.`char_id` = `ranker_char`.`char_id`"+.@b$+" ORDER BY `"+$@CP2$[.@a]+"` DESC,`"+$@CP4$[.@a]+"` DESC LIMIT "+$@CPrs,.@g,.@h,.@c$,.@i,.@j,.@k,.@l,.@m);
announce "[ "+$@CP0$[.@a]+" ] [ "+$@CP1$[.@a]+" / "+$@CP3$[.@a]+" ] - Name - Job - Guild",bc_self,0xff7700;
set .@n,0;
while(.@n < .@f) {
if(.@g[.@n] == .@c) { // You.
set .@c,0;
set .@p,0;
}
else if(.@h[.@n] == .@e) // Account.
set .@p,1;
else if(.@d && (.@j[.@n] == .@d)) { // Guild.
if(.@k[.@n]) set .@p,2;
else set .@p,3;
}
else {
if(.@k[.@n]) set .@p,4;
else set .@p,5;
}
if(!.@n) set .@o,1;
else if((.@l[.@n] != .@l[.@n - 1]) || (.@m[.@n] != .@m[.@n - 1]))
set .@o,.@n + 1;
if(.@j[.@n]) set .@e$,getguildname(.@j[.@n]);
else set .@e$,"";
announce "[ "+.@o+" ] [ "+.@l[.@n]+" / "+.@m[.@n]+" ] - "+.@c$[.@n]+" - "+jobname(.@i[.@n])+" - "+.@e$,bc_self,"0x"+$@CPco$[.@p];
set .@n,.@n + 1;
}
if(.@c && (.@f >= $@CPrs)) {
if(.@B) set .@b$," AND "+.@a$;
if(query_sql("SELECT abs(`"+$@CP2$[.@a]+"`),abs(`"+$@CP4$[.@a]+"`) FROM `ranker_char` LEFT JOIN `char` ON `char`.`char_id` = `ranker_char`.`char_id` WHERE `char`.`char_id` = '"+.@c+"'"+.@b$,.@l,.@m)) {
set .@o,callfunc("CPCount",.@a,.@l,.@m,.@a$);
if(.@d) set .@e$,getguildname(.@d);
else set .@e$,"";
announce "[ "+.@o+" ] [ "+.@l+" / "+.@m+" ] - "+strcharinfo(0)+" - "+jobname(class)+" - "+.@e$,bc_self,"0x"+$@CPco$[0];
}
}
}
else if($@CP5$[.@a] == "guild") { // Show Guild based Ranking:
set .@d,getcharid(2);
set .@f,query_sql("SELECT `guild`.`guild_id`,`name`,abs(`"+$@CP2$[.@a]+"`),abs(`"+$@CP4$[.@a]+"`) FROM `ranker_guild` LEFT JOIN `guild` ON `guild`.`guild_id` = `ranker_guild`.`guild_id` ORDER BY `"+$@CP2$[.@a]+"` DESC,`"+$@CP4$[.@a]+"` DESC LIMIT "+$@CPrs,.@g,.@c$,.@l,.@m);
announce "[ "+$@CP0$[.@a]+" ] [ "+$@CP1$[.@a]+" / "+$@CP3$[.@a]+" ] - Name",bc_self,0xff7700;
set .@n,0;
while(.@n < .@f) {
if(.@g[.@n] == .@d) { // Your Guild.
set .@d,0;
set .@p,0;
}
else set .@p,4;
if(!.@n) set .@o,1;
else if((.@l[.@n] != .@l[.@n - 1]) || (.@m[.@n] != .@m[.@n - 1]))
set .@o,.@n + 1;
announce "[ "+.@o+" ] [ "+.@l[.@n]+" / "+.@m[.@n]+" ] - "+.@c$[.@n],bc_self,"0x"+$@CPco$[.@p];
set .@n,.@n + 1;
}
if(.@d && (.@f >= $@CPrs)) {
query_sql "SELECT `"+$@CP2$[.@a]+"`,`"+$@CP4$[.@a]+"` FROM `ranker_guild` LEFT JOIN `guild` ON `guild`.`guild_id` = `ranker_guild`.`guild_id` WHERE `guild`.`guild_id` = '"+.@d+"'",.@l,.@m;
set .@o,callfunc("CPCount",.@a,.@l,.@m);
set .@e$,getguildname(.@d);
announce "[ "+.@o+" ] [ "+.@l+" / "+.@m+" ] - "+.@e$,bc_self,"0x"+$@CPco$[0];
}
}
if(!.@n) 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,187,4 duplicate(CP) CP#58 859
prontera,40,212,6 duplicate(CP) CP#59 859
prontera,146,89,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

 

Share this post


Link to post
Share on other sites
  • 0

And there's no rid2name instruction on that script. Could you tell us the point where it gets broken? What you do for this error to appear?

 

Sorry I still have no emu for trying myself.

Share this post


Link to post
Share on other sites
  • 0

Another script that makes the error. The error came up when someone kill or been killed.

//===== eAthena Script =======================================================

//= PVP ladder script with dota announcement ( SQL only )
//===== By: ==================================================================
//= ~AnnieRuru~
//===== Current Version: =====================================================
//= 2.9
//===== Compatible With: =====================================================
//= eAthena SQL 14279, with MySQL 5.1
//===== Description: =========================================================
//= PVP ladder store in SQL table
//= plus anti-sit-killer feature
//===== Topic ================================================================
//= http://www.eathena.ws/board/index.php?showtopic=177918
//===== Additional Comments: =================================================
//= still don't have modify value option, will be done ... in next year ...
//============================================================================

// add all the maps that you want this script to trigger ... all pvp and event maps perhaps ?
// but if you already enable "all" maps, then can comment all these
new_1-1 mapflag loadevent
guild_vs1 mapflag loadevent
guild_vs2 mapflag loadevent
guild_vs3 mapflag loadevent
guild_vs4 mapflag loadevent
guild_vs5 mapflag loadevent

- script DOTAPVP -1,{
OnInit:
// Config
set .sound, 2; // soundeffect : 0 - disable, 1 - play soundeffect to all players on map, 2 - play soundeffect to an area around the killer, 3 - play soundeffect to killer only
set .announce, 1; // announce to : 0 - global, 1 - map
set .announcemap, 1; // announce the map name in the announcement ? : 0 - off, 1 - on

set .announcekill, 1; // announce who pawn who's head : 0 - off, 1 - on
set .msg_die, 0; // show message who kill you when die : 0 - off, 1 - on
set .msg_kill, 0; // show message you kill who when killed someone : 0 - off, 1 - on

set .gmnokill, 60; // GMs are not suppose to kill players. A GM with level or higher will do nothing. IF set to 60, GM60 and above kill any player will not get anything : 0 - off

set .killingspree, 3;
set .dominating, 4;
set .megakill, 5;
set .unstoppable, 6;
set .wickedsick, 7;
set .monsterkill, 8;
set .godlike, 9;
set .holyshit, 10;
set .continue, 1; // after beyond-godlike, every kills will make announcement again

set .owned, 5; // how many times the party/guild has to kill to announce ownage
set .owncontinue, 1; // after ownage, every party/guild cumulative kills will make ownage announce again

set .min_gm_menu, 60; // minimum level of GM can use the GM menu on ladder npc

set .showtotal, 20; // show the length of ladder. Note : Maximum value = 128
set .showpage, 10; // set the views per page. Note : Maximum value = 128
set .loweststreak, 3; // mininum streak count allow to show in highest streak ladder. Default 3 means must at least have killing spree streak to display in ladder
set .lowestownage, 5; // mininum ownage count allow to show in longest ownage ladder. Default 5 means must at least have 5 ownage counts to display in ladder

setarray .maptrigger$, // only these maps will trigger this script
"new_1-1", // uncomment this to allow load all maps
"guild_vs1",
"guild_vs2",
"guild_vs3",
"guild_vs4",
"guild_vs5";

// anti-sit-killer system
// a player must kill another player with this minimum base level to get the announcement and in the ladder.
// Otherwise only have streak ended announcement and killed player's streak reset.
// Its possible for a level 1 novice to kill a level 99 player and he/she will still get in the ladder
// but a level 99 kill a level 1 player will get nothing
// 0 - off this system ( default is 55, pk setting )
set .lvltokill, 0;

// when a player kill another same player times in a row, the player is warp back to save point.
// and the player's streak, kills, and ownage count will deduct accordingly
// 0 - off this system
set .counttopunish, 6;

// minimum level range to kill another player
// eg. when set to 20, player level 99 needs to kill another player with minimum level of 79 to get announcement and increase the kill rank.
// but a player with base level 50 kills a level 99 will also get the announcement
// higher base level cannot kill lower level, but lower level can kill higher level
// 0 - off this system
set .minlvlrange, 0;


// Config ends ------------------------------------------------------------------------------------------

// to prevent bug happen
if ( .announce < 0 || .announce > 1 ) set .announce, 0;
if ( .continue < 1 ) set .continue, 1;
if ( .owncontinue < 1 ) set .owncontinue, 1;
if ( .gmnokill <= 0 ) set .gmnokill, 100;
if ( .lvltokill <= 1 ) set .lvltokill, 0;
if ( .counttopunish <= 1 ) set .counttopunish, 0;
set .maptriggersize, getarraysize(.maptrigger$);
end;

// script start.
OnPCKillEvent:
if ( getgmlevel() >= .gmnokill ) end;
getmapxy .@map$, .@x, .@y, 0;
if ( .maptrigger$ != "all" ) {
for ( set .@i, 0; .@i < .maptriggersize; set .@i, .@i +1 ) {
if ( .@map$ == .maptrigger$[.@i] ) break;
}
if ( .@i == .maptriggersize ) end;
}
attachrid killedrid;
if ( killerrid != getcharid(3) && ( .msg_die || .msg_kill ) ) {
if ( .msg_die ) message strcharinfo(0),"You have been killed by "+ rid2name(killerrid);
if ( .msg_kill ) message rid2name(killerrid),"You just killed "+ strcharinfo(0);
}
if ( @PlayersKilledStreak >= .holyshit )
set .@streakname$,"Beyond Godlike";
else if ( @PlayersKilledStreak >= .godlike )
set .@streakname$,"Godlike";
else if ( @PlayersKilledStreak >= .monsterkill )
set .@streakname$,"Monster Kill";
else if ( @PlayersKilledStreak >= .wickedsick )
set .@streakname$,"Wicked Sick";
else if ( @PlayersKilledStreak >= .unstoppable )
set .@streakname$,"Unstoppable";
else if ( @PlayersKilledStreak >= .megakill )
set .@streakname$,"Mega-kill";
else if ( @PlayersKilledStreak >= .dominating )
set .@streakname$,"Dominating";
else if ( @PlayersKilledStreak >= .killingspree )
set .@streakname$,"Killing Spree";
if ( @PlayersKilledStreak >= .killingspree && killerrid == getcharid(3) )
announce strcharinfo(0) +" has ended "+( (sex)?"him":"her" )+" own "+ .@streakname$ +"["+ @PlayersKilledStreak +"] streak "+( (.announcemap)?("at "+ .@map$):""),16|.announce;
else if ( @PlayersKilledStreak >= .killingspree )
announce rid2name(killerrid) +" has ended "+ strcharinfo(0) +"'s "+ .@streakname$ +"["+ @PlayersKilledStreak +"] streak "+( (.announcemap)?("at "+ .@map$):""),16|.announce;
else if ( .announcekill && killerrid != getcharid(3) )
announce rid2name(killerrid) +" has pawned "+ strcharinfo(0) +"'s head "+( (.announcemap)?("at "+ .@map$):""),16|.announce;
set @PlayersKilledStreak,0;
set @dota_sql_deaths, @dota_sql_deaths +1;
set @dota_multikills,0;
query_sql "replace into pvpladder values ( "+ getcharid(0) +", '"+ escape_sql(strcharinfo(0)) +"', "+ @dota_sql_streaks +", "+ @dota_sql_kills +", "+ @dota_sql_deaths +", from_unixtime("+ @dota_sql_streaktime +") )";
set .@killed_gid, getcharid(2);
if ( .@killed_gid ) {
setd ".dota_sql_"+ .@killed_gid +"_c", 0;
if ( getd(".dota_sql_"+ .@killed_gid +"_h") )
query_sql "replace into ownladder values ( "+ .@killed_gid +", '"+ escape_sql(getguildname(.@killed_gid)) +"', "+ getd(".dota_sql_"+ .@killed_gid +"_c") +", "+ getd(".dota_sql_"+ .@killed_gid +"_h") +", from_unixtime("+ getd(".dota_sql_"+ .@killed_gid +"_t") +") )";
}
if ( killerrid == getcharid(3) || baselevel < .lvltokill ) end;
if ( .minlvlrange ) set .@killedlvl, baselevel;
attachrid killerrid;
if ( .minlvlrange && .@killedlvl + .minlvlrange < baselevel ) end;
if ( .counttopunish ) {
if ( @sitkillminute != gettime(2) ) {
deletearray @sitkillid, 128;
deletearray @sitkilltimes, 128;
set @sitkillminute, gettime(2);
}
set .@sitkillsize, getarraysize(@sitkillid);
for ( set .@i,0; .@i < .@sitkillsize; set .@i, .@i +1 ) {
if ( @sitkillid[.@i] != killedrid ) continue;
else {
set @sitkilltimes[.@i], @sitkilltimes[.@i] +1 ;
if ( @sitkilltimes[.@i] >= .counttopunish ) {
warp "SavePoint",0,0;
announce strcharinfo(0) +" , Stop killing "+ rid2name(killedrid) + " !!!",0;
debugmes strcharinfo(0) +" is sit-killing "+ rid2name(killedrid) +" for "+ @sitkilltimes[.@i] + " times";
logmes "is sit-killing "+ rid2name(killedrid) +" for "+ @sitkilltimes[.@i] +" times";
if ( @PlayersKilledStreak == @dota_sql_streaks ) {
set @dota_sql_streaks, @dota_sql_streaks +1 - .counttopunish;
set @dota_sql_streaktime, gettimetick(2);
}
set @PlayersKilledStreak, @PlayersKilledStreak +1 - .counttopunish;
set @dota_sql_kills, @dota_sql_kills +1 - .counttopunish;
query_sql "replace into pvpladder values ( "+ getcharid(0) +", '"+ escape_sql(strcharinfo(0)) +"', "+ @dota_sql_streaks +", "+ @dota_sql_kills +", "+ @dota_sql_deaths +", from_unixtime("+ @dota_sql_streaktime +") )";
set .@killer_gid, getcharid(2);
if ( .@killer_gid ) {
if ( getd(".dota_sql_"+ .@killer_gid +"_c") == getd(".dota_sql_"+ .@killer_gid +"_h") ) {
setd ".dota_sql_"+ .@killer_gid +"_h", getd(".dota_sql_"+ .@killer_gid +"_h") +1 - .counttopunish;
setd ".dota_sql_"+ .@killer_gid +"_t", gettimetick(2);
}
setd (".dota_sql_"+ .@killer_gid +"_c"), getd(".dota_sql_"+ .@killer_gid +"_c") +1 - .counttopunish;
query_sql "replace into ownladder values ( "+ .@killer_gid +", '"+ escape_sql(getguildname(.@killer_gid)) +"', "+ getd(".dota_sql_"+ .@killer_gid +"_c") +", "+ getd(".dota_sql_"+ .@killer_gid +"_h") +", from_unixtime("+ getd(".dota_sql_"+ .@killer_gid +"_t") +") )";
}
end;
}
break;
}
}
if ( .@i == .@sitkillsize ) {
set @sitkillid[.@i], killedrid;
set @sitkilltimes[.@i], 1;
}
}
set @PlayersKilledStreak, @PlayersKilledStreak +1 ;
set @dota_sql_kills, @dota_sql_kills +1 ;
if ( @PlayersKilledStreak > @dota_sql_streaks ) {
set @dota_sql_streaks, @PlayersKilledStreak;
set @dota_sql_streaktime, gettimetick(2);
}
query_sql "replace into pvpladder values ( "+ getcharid(0) +", '"+ escape_sql(strcharinfo(0)) +"', "+ @dota_sql_streaks +", "+ @dota_sql_kills +", "+ @dota_sql_deaths +", from_unixtime("+ @dota_sql_streaktime +") )";
if ( @PlayersKilledStreak == .killingspree )
setarray .@streakname$,"killingspree.wav","is on a KILLING SPREE","!";
else if ( @PlayersKilledStreak == .dominating )
setarray .@streakname$,"dominating.wav","is DOMINATING","!";
else if ( @PlayersKilledStreak == .megakill )
setarray .@streakname$,"megakill.wav","has a MEGA KILL","!";
else if ( @PlayersKilledStreak == .unstoppable )
setarray .@streakname$,"unstoppable.wav","is UNSTOPPABLE","!!";
else if ( @PlayersKilledStreak == .wickedsick )
setarray .@streakname$,"wickedsick.wav","is WICKED SICK","!!";
else if ( @PlayersKilledStreak == .monsterkill )
setarray .@streakname$,"monsterkill.wav","has a MONSTER KILL","!!";
else if ( @PlayersKilledStreak == .godlike )
setarray .@streakname$,"godlike.wav","is GODLIKE","!!!";
else if ( @PlayersKilledStreak >= .holyshit && ( (@PlayersKilledStreak - .holyshit) % .continue == 0 ) )
setarray .@streakname$,"holyshit.wav","is BEYOND GODLIKE",". Someone KILL "+( (sex)?"HIM":"HER" ) +"!!!!!!";
if ( .@streakname$[1] != "" ) {
announce strcharinfo(0) +" "+ .@streakname$[1] +"["+ @PlayersKilledStreak +"] "+( (.announcemap)?("at "+ .@map$):"") + .@streakname$[2],16|.announce;
if ( .sound == 1 ) soundeffectall .@streakname$[0],0,.@map$;
else if ( .sound == 2 ) soundeffectall .@streakname$[0],0;
else if ( .sound == 3 ) soundeffect .@streakname$[0],0;
}
set @dota_multikills, @dota_multikills + 1;
deltimer "DOTAPVP::OnStreakReset";
addtimer 18000,"DOTAPVP::OnStreakReset";
set .@killer_gid, getcharid(2);
if ( .@killer_gid && .@killer_gid != .@killed_gid ) {
setd ".dota_sql_"+ .@killer_gid +"_c", getd(".dota_sql_"+ .@killer_gid +"_c") +1 ;
if ( getd(".dota_sql_"+ .@killer_gid +"_c") > getd(".dota_sql_"+ .@killer_gid +"_h") ) {
setd ".dota_sql_"+ .@killer_gid +"_h", getd(".dota_sql_"+ .@killer_gid +"_c");
setd ".dota_sql_"+ .@killer_gid +"_t", gettimetick(2);
}
query_sql "replace into ownladder values ( "+ .@killer_gid +", '"+ escape_sql(getguildname(.@killer_gid)) +"', "+ getd(".dota_sql_"+ .@killer_gid +"_c") +", "+ getd(".dota_sql_"+ .@killer_gid +"_h") +", from_unixtime("+ getd(".dota_sql_"+ .@killer_gid +"_t") +") )";
}
set .@dota_multikills, @dota_multikills;
set .@origin, getcharid(3);
sleep 1500;
if ( .@killer_gid && .@killer_gid != .@killed_gid && getd(".dota_sql_"+ .@killer_gid +"_c") >= .owned && ( ( getd(".dota_sql_"+ .@killer_gid +"_c") - .owned ) % .owncontinue == 0 ) ) {
if ( .announce ) mapannounce .@map$, "The guild ["+ getguildname(.@killer_gid) +"] is OWNING["+ getd(".dota_sql_"+ .@killer_gid +"_c") +"] !!!",16;
else announce "The guild ["+ getguildname(.@killer_gid) +"] is OWNING["+ getd(".dota_sql_"+ .@killer_gid +"_c") +"] !!!",16;
if ( .sound == 1 ) soundeffectall "ownage.wav",0,.@map$;
else if ( .sound == 2 ) soundeffectall "ownage.wav",0;
else if ( .sound == 3 && attachrid(.@origin) ) soundeffect "ownage.wav",0;
}
sleep 1250;
if ( !attachrid(.@origin) ) end;
if ( .@dota_multikills == 2 ) {
if ( .announce ) mapannounce .@map$, strcharinfo(0) +" just got a Double Kill !",16;
else announce strcharinfo(0) +" just got a Double Kill !",16;
if ( .sound == 1 ) soundeffectall "doublekill.wav",0,.@map$;
else if ( .sound == 2 ) soundeffectall "doublekill.wav",0;
else if ( .sound == 3 ) soundeffect "doublekill.wav",0;
}
else if ( .@dota_multikills == 3 ) {
if ( .announce ) mapannounce .@map$, strcharinfo(0) +" just got a Triple Kill !!!",16;
else announce strcharinfo(0) +" just got a Triple Kill !!!",16;
if ( .sound == 1 ) soundeffectall "triplekill.wav",0,.@map$;
else if ( .sound == 2 ) soundeffectall "triplekill.wav",0;
else if ( .sound == 3 ) soundeffect "triplekill.wav",0;
}
else if ( .@dota_multikills == 4 ) {
if ( .announce ) mapannounce .@map$, strcharinfo(0) +" just got a Ultra Kill !!!",16;
else announce strcharinfo(0) +" just got a Ultra Kill !!!",16;
if ( .sound == 1 ) soundeffectall "ultrakill.wav",0,.@map$;
else if ( .sound == 2 ) soundeffectall "ultrakill.wav",0;
else if ( .sound == 3 ) soundeffect "ultrakill.wav",0;
}
else if ( .@dota_multikills >= 5 ) {
if ( .announce ) mapannounce .@map$, strcharinfo(0) +" is on a Rampage !!!",16;
else announce strcharinfo(0) +" is on a Rampage !!!",16;
if ( .sound == 1 ) soundeffectall "rampage.wav",0,.@map$;
else if ( .sound == 2 ) soundeffectall "rampage.wav",0;
else if ( .sound == 3 ) soundeffect "rampage.wav",0;
}
end;
OnStreakReset:
set @dota_multikills, 0;
end;
OnWhisperGlobal:
if ( @spam_dotapvp + 3 >= gettimetick(2) ) // 3 seconds interval so player don spam this command
end;
set @spam_dotapvp, gettimetick(2);
if ( @dota_sql_kills == 0 && @dota_sql_deaths == 0 )
query_sql "select kills, deaths, streaks, unix_timestamp(streaktime) from pvpladder where char_id = "+ getcharid(0), @dota_sql_kills, @dota_sql_deaths, @dota_sql_streaks, @dota_sql_streaktime;
if ( @dota_sql_kills || @dota_sql_deaths ) {
dispbottom "Your current Streak : "+ @PlayersKilledStreak;
dispbottom "Your total Kills : "+ @dota_sql_kills;
dispbottom "Your total Deaths : "+ @dota_sql_deaths;
dispbottom "Your highest Streak : "+ @dota_sql_streaks;
query_sql "select date_format( from_unixtime("+ @dota_sql_streaktime +"),'%a %e/%c/%y %r')", .@time1$;
dispbottom "Your highest Streak on : "+ .@time1$;
}
else
dispbottom "You are not in the pvp ladder yet.";
if ( getcharid(2) ) {
if ( getd(".dota_sql_"+ getcharid(2) +"_h") == 0 ) {
query_sql "select currentown, highestown, unix_timestamp(owntime) from ownladder where guild_id = "+ getcharid(2), .@c, .@h, .@t;
setd ".dota_sql_"+ getcharid(2) +"_c", .@c;
setd ".dota_sql_"+ getcharid(2) +"_h", .@h;
setd ".dota_sql_"+ getcharid(2) +"_t", .@t;
}
if ( getd(".dota_sql_"+ getcharid(2) +"_h") ) {
dispbottom "Your guild current Own : "+ getd(".dota_sql_"+ getcharid(2) +"_c");
dispbottom "Your guild highest Own : "+ getd(".dota_sql_"+ getcharid(2) +"_h");
query_sql "select date_format( from_unixtime("+ getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_t"), "DOTAPVP" ) +"),'%a %e/%c/%y %r')", .@time2$;
dispbottom "Your guild highest Own on : "+ .@time2$;
}
else
dispbottom "Your guild is not in the ladder yet.";
}
end;
OnPCLoginEvent:
if ( .maptrigger$ != "all" ) end;
OnPCLoadMapEvent:
if ( @dota_sql_kills == 0 && @dota_sql_deaths == 0 ) {
if ( .maptrigger$ != "all" ) {
getmapxy .@map$, .@x, .@y, 0;
for ( set .@i, 0; .@i < .maptriggersize; set .@i, .@i +1 ) {
if ( .@map$ == .maptrigger$[.@i] ) break;
}
if ( .@i == .maptriggersize ) end;
}
query_sql "select kills, deaths, streaks, unix_timestamp(streaktime) from pvpladder where char_id = "+ getcharid(0), @dota_sql_kills, @dota_sql_deaths, @dota_sql_streaks, @dota_sql_streaktime;
}
if ( getcharid(2) && getd(".dota_sql_"+ getcharid(2) +"_h") == 0 ) {
query_sql "select currentown, highestown, unix_timestamp(owntime) from ownladder where guild_id = "+ getcharid(2), .@c, .@h, .@t;
setd ".dota_sql_"+ getcharid(2) +"_c", .@c;
setd ".dota_sql_"+ getcharid(2) +"_h", .@h;
setd ".dota_sql_"+ getcharid(2) +"_t", .@t;
}
end;
}

prontera,161,187,4 script PvP-StatsViewer 57,{
set .@npcname$, strnpcinfo(0);
while (1) {
mes "["+ .@npcname$ +"]";
mes "Hello "+ strcharinfo(0) +"...";
mes "If you want to I can show you your PVP stats.";
next;
switch ( select ( "Most Kills","Highest Streak","Longest Ownage","Own Information","Explanation" ) ) {
case 1:
set .@nb, query_sql("select name, kills, deaths from pvpladder order by kills desc limit "+ getvariableofnpc(.showtotal,"DOTAPVP"), .@name$, .@kills, .@deaths);
if ( .@nb == 0 ) {
mes "["+ .@npcname$ +"]";
mes "The ladder currently is empty.";
next;
}
for ( set .@j,0; .@j < .@nb; set .@j, .@j + getvariableofnpc(.showpage,"DOTAPVP") ) {
mes "["+ .@npcname$ +"]";
for ( set .@i, .@j; .@i < (getvariableofnpc(.showpage,"DOTAPVP") + .@j) && .@i < .@nb; set .@i, .@i + 1 ) {
mes "^996600"+ (.@i+1) +": ^006699"+ .@name$[.@i] +" ^00AA00["+ .@kills[.@i] +"] ^FF0000<"+ .@deaths[.@i] +">^000000";
}
next;
}
break;
case 2:
set .@nb, query_sql("select name, streaks, date_format(streaktime,'%a %e/%c/%y %r') from pvpladder where streaks >= "+ getvariableofnpc(.loweststreak,"DOTAPVP") +" order by streaks desc limit "+ getvariableofnpc(.showtotal,"DOTAPVP"), .@name$, .@streak, .@time$);
if ( .@nb == 0 ) {
mes "["+ .@npcname$ +"]";
mes "The ladder currently is empty.";
next;
}
for ( set .@j,0; .@j < .@nb; set .@j, .@j + getvariableofnpc(.showpage,"DOTAPVP") ) {
mes "["+ .@npcname$ +"]";
for ( set .@i, .@j; .@i < (getvariableofnpc(.showpage,"DOTAPVP") + .@j) && .@i < .@nb; set .@i, .@i + 1 ) {
mes "^996600"+ (.@i+1) +": ^006699"+ .@name$[.@i] +" ^70AC11{"+ .@streak[.@i] +"} ^000000on :";
mes " ^EE8800"+ .@time$[.@i] +"^000000";
}
next;
}
break;
case 3:
set .@nb, query_sql("select name, highestown, date_format(owntime,'%a %e/%c/%y %r') from ownladder where highestown >= "+ getvariableofnpc(.lowestownage,"DOTAPVP") +" order by highestown desc limit "+ getvariableofnpc(.showtotal,"DOTAPVP"), .@name$, .@owned, .@time$);
if ( .@nb == 0 ) {
mes "["+ .@npcname$ +"]";
mes "The ladder currently is empty.";
next;
}
for ( set .@j,0; .@j < .@nb; set .@j, .@j + getvariableofnpc(.showpage,"DOTAPVP") ) {
mes "["+ .@npcname$ +"]";
for ( set .@i, .@j; .@i < (getvariableofnpc(.showpage,"DOTAPVP") + .@j) && .@i < .@nb; set .@i, .@i + 1 ) {
mes "^996600"+ (.@i+1) +": ^006699"+ .@name$[.@i] +" ^00AAAA("+ .@owned[.@i] +") ^000000on :";
mes " ^EE8800"+ .@time$[.@i] +"^000000";
}
next;
}
break;
case 4:
if ( @dota_sql_kills == 0 && @dota_sql_deaths == 0 )
query_sql "select kills, deaths, streaks, unix_timestamp(streaktime), date_format(streaktime,'%a %e/%c/%y %r') from pvpladder where char_id = "+ getcharid(0), @dota_sql_kills, @dota_sql_deaths, @dota_sql_streaks, @dota_sql_streaktime, .@time1$;
mes "["+ .@npcname$ +"]";
if ( @dota_sql_kills == 0 && @dota_sql_deaths == 0 )
mes "You not yet kill any player.";
else {
mes "Your Current Streak : ^70AC11{"+ @PlayersKilledStreak +"}^000000";
mes "Your Total Kills : ^00AA00["+ @dota_sql_kills +"]^000000";
mes "Your Death Counts : ^FF0000<"+ @dota_sql_deaths +">^000000";
if ( @dota_sql_kills || @dota_sql_streaks ) {
mes "Highest Streak was ^70AC11{"+ @dota_sql_streaks +"}^000000 on :";
query_sql "select date_format( from_unixtime("+ @dota_sql_streaktime +"),'%a %e/%c/%y %r')", .@time1$;
mes " ^EE8800"+ .@time1$ +"^000000";
}
}
next;
if ( getcharid(2) ) {
if ( getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_h"), "DOTAPVP" ) == 0 ) {
query_sql "select currentown, highestown, unix_timestamp(owntime) from ownladder where guild_id = "+ getcharid(2), .@c, .@h, .@t;
set getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_c"), "DOTAPVP" ), .@c;
set getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_h"), "DOTAPVP" ), .@h;
set getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_t"), "DOTAPVP" ), .@t;
}
mes "["+ .@npcname$ +"]";
if ( getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_h"), "DOTAPVP" ) == 0 ) {
mes "Your guild not yet kill any player.";
} else {
mes "Your guild name : ^006699"+ strcharinfo(2) +"^000000";
mes "Current Owning : ^00AAAA("+ getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_c"), "DOTAPVP" ) +")^000000";
mes "Longest Ownage was ^00AAAA("+ getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_h"), "DOTAPVP" ) + ")^000000 on :";
query_sql "select date_format( from_unixtime("+ getvariableofnpc( getd(".dota_sql_"+ getcharid(2) +"_t"), "DOTAPVP" ) +"),'%a %e/%c/%y %r')", .@time2$;
mes " ^EE8800"+ .@time2$ +"^000000";
}
next;
}
break;
case 5:
mes "["+ .@npcname$ +"]";
mes "Explanation for Most Kills:";
mes " ";
mes "^996600Rank. ^006699NAME ^00AA00[Total Kills] ^FF0000^000000";
mes " ";
mes "--------------------------------";
mes " ";
mes "The ^00AA00Kills^000000 added when a player kills another player.";
mes " ";
mes "^FF0000Deaths^000000 count increase when a player killed by another player, or suicide (eg: Grand Cross).";
mes " ";
mes "A player killed by monsters, homunculus or pets will not add the kills or deaths count.";
next;
mes "["+ .@npcname$ +"]";
mes "Explanation for Highest Streak:";
mes " ";
mes "^996600Rank. ^006699NAME ^70AC11{Highest Streak} ^000000on :";
mes " ^EE8800TIME^000000";
mes " ";
mes "--------------------------------";
mes " ";
mes "The ^70AC11Streak^000000 are added every time a player kills another player. It will reset upon log out, killed by another player, or suicide (eg: Sacrifice).";
mes " ";
mes "Then it record in the server the ^EE8800TIME^000000 when that player got that highest streak.";
mes " ";
mes "A player killed by monsters, homunculus or pets will not reset the streak.";
mes " ";
mes "--------------------------------";
mes " ";
mes "The numbers of straight kills to get these announcements are :";
mes "^70AC11"+ getvariableofnpc(.killingspree,"DOTAPVP") +"^000000 : Killing Spree";
mes "^70AC11"+ getvariableofnpc(.dominating,"DOTAPVP") +"^000000 : Dominating";
mes "^70AC11"+ getvariableofnpc(.megakill,"DOTAPVP") +"^000000 : Mega Kill";
mes "^70AC11"+ getvariableofnpc(.unstoppable,"DOTAPVP") +"^000000 : Unstoppable";
mes "^70AC11"+ getvariableofnpc(.wickedsick,"DOTAPVP") +"^000000 : Wicked Sick";
mes "^70AC11"+ getvariableofnpc(.monsterkill,"DOTAPVP") +"^000000 : Monster Kill";
mes "^70AC11"+ getvariableofnpc(.godlike,"DOTAPVP") +"^000000 : Godlike";
mes "^70AC11"+ getvariableofnpc(.holyshit,"DOTAPVP") +"^000000 : Beyond Godlike";
next;
mes "["+ .@npcname$ +"]";
mes "Explanation for Longest Ownage:";
mes " ";
mes "^996600Rank. ^006699NAME ^00AAAA(Longest Ownage) ^000000on :";
mes " ^EE8800TIME^000000";
mes " ";
mes "--------------------------------";
mes " ";
mes "The ^00AAAAOwnage^000000 added every time any guild members killed another player that doesn't belong to his/her guild. It will reset when any of the guild member was killed by ANY player, including his/her guild member.";
mes " ";
mes "Then it record in the server the ^EE8800TIME^000000 when the guild got that longest ownage.";
mes " ";
mes "If the server went under maintainance, the current ownage will survive after the server restart.";
mes " ";
mes "Any guild member killed by monster, homunculus or pets will not reset the ownage count.";
next;
if ( getvariableofnpc(.lvltokill,"DOTAPVP") ) {
mes "["+ .@npcname$ +"]";
mes "You must kill another player with minimum base level of "+ getvariableofnpc(.lvltokill,"DOTAPVP") +", in order to get an announcement or get in the ladder.";
mes " ";
mes "It's possible for a base level 1 novice kills a base level 99 player and still can get in the ladder.";
mes "However when a player level 99 kills a level 1 novice will get nothing.";
next;
}
if ( getvariableofnpc(.counttopunish,"DOTAPVP") ) {
mes "["+ .@npcname$ +"]";
mes "Some noob players try to kill the same person over and over again in hope of getting his/her name appear in the ladder.";
mes "However if you trying to do the same thing on this ladder, your name will announce to the public, and your action will be recorded into the server to notify the GMs.";
next;
}
if ( getvariableofnpc(.minlvlrange,"DOTAPVP") ) {
mes "["+ .@npcname$ +"]";
mes "When you kill another player thats lower base level than you, the base level gap between you and that player must not more than "+ getvariableofnpc(.minlvlrange,"DOTAPVP") +".";
mes " ";
if ( getvariableofnpc(.minlvlrange,"DOTAPVP") >= 200)
mes "In other words, if your base level is 500, the player you killed must be at least level "+( 500 - getvariableofnpc(.minlvlrange,"DOTAPVP") )+" then only you will get the announcement and in the ladder.";
else if ( getvariableofnpc(.minlvlrange,"DOTAPVP") >= 70)
mes "In other words, if your base level is 255, the player you killed must be at least level "+( 255 - getvariableofnpc(.minlvlrange,"DOTAPVP") )+" then only you will get the announcement and in the ladder.";
else
mes "In other words, if your base level is 99, the player you killed must be at least level "+( 99 - getvariableofnpc(.minlvlrange,"DOTAPVP") )+" then only you will get the announcement and in the ladder.";
mes "Higher base level kills lower level gets nothing, however lower level player kills higher level will get the announcement.";
next;
}
break;
}
}
}




 

Share this post


Link to post
Share on other sites
  • 0

Gosh... you have ancient scripts and the only problem with ancient scripts is well.. they're ancient. They're ancient for a reason... because since those scripts have been released, there has been SOOOO many updates within script functions, etc. throughout eAthena -> rAthena -> Hercules lol

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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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