DROP TABLE IF EXISTS `pvp_ladder`;
CREATE TABLE IF NOT EXISTS `pvp_ladder` (
`char_id` int(11) UNSIGNED NOT NULL,
`count` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`char_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SCRIPT:
Quote
set .rankpoint, 1; //Ranking PvP? (0:Disable)
if(.rankpoint < 0){ set .rankpoint, 0; }
if(.rankpoint){ query_sql("INSERT INTO `pvp_ladder` SET `char_id` = '"+getcharid(0)+"', `count` = '1' ON DUPLICATE KEY UPDATE `count` = `count`+1"); }
//Player Ranking
mes "^FF7F00[ Arena PvP ]^000000";
if(!(.@nb = query_sql("SELECT `char_id`, `count` FROM `pvp_ladder` ORDER BY `count` DESC LIMIT 10", .@cid, .@count))) {
mes "Nenhuma morte foi contabilizada ainda.";
close;
}
mes "Top 10 PvP:";
for ( .@i = 0; .@i < .@nb; .@i++ )
mes (.@i+1) +". "+ strcharinfo(0,.@cid[.@i]) +": ^008aff"+ .@count[.@i] +"^000000";
close;
Agradeço a ajuda desde já!
EDIT 1 SOLUÇÃO:
SQL:
Quote
ALTER TABLE `char` ADD `pvp_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `fame`;
SCRIPT:
Quote
//Player Ranking
mes "^FF7F00[ Arena PvP ]^000000";
mes "TOP 10 PvP:";
query_sql( "SELECT `name`,`pvp_kill` FROM `char` WHERE `pvp_kill` > 0 ORDER BY `pvp_kill` DESC LIMIT 10", .@name$, .@pvp_kill );
.@size = getarraysize( .@name$ );
for ( .@i = 0; .@i < .@size; .@i++ ) {
mes "^ff0000"+(.@i + 1 )+"°^000000 "+.@name$[.@i]+" - ^008aff"+.@pvp_kill[.@i]+" kill(s)^000000";
}
close;
RESET:
Quote
query_sql("UPDATE `char` SET `pvp_kill` = 0 WHERE `pvp_kill` > 0");
CONTADOR:
Quote
OnPCKillEvent:
if ( getcharid(3) != killedrid ) {
query_sql( "UPDATE `char` SET `pvp_kill` = `pvp_kill` + 1 WHERE `char_id` = "+getcharid(0)+" LIMIT 1" );
}
end;
Question
Tdi123
Exemplo 1 (Personagem Online):
Exemplo 2 (Personagem Offline):
ERROR no Emulador:
Tabela SQL:
SCRIPT:
Agradeço a ajuda desde já!
EDIT 1 SOLUÇÃO:
SQL:
SCRIPT:
RESET:
CONTADOR:
BOM PROVEITO!
Edited by Tdi123Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.