// https://rathena.org/board/topic/107986-requesting-for-a-pvp-ranking-w-reset/
/*
ALTER TABLE `char` ADD `pvp_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `fame`;
*/
morocc,154,113,6 script PvP Room 615,{
doevent "pvp_rank_main::OnTalk";
}
- script pvp_rank_main -1,{
OnTalk:
mes "[PvP Room Master]";
mes "Where do you wanna go?";
next;
switch ( select (
"Izlude (Berry/Seed - ALLOWED)",
"Izlude (x Berry/Seed)",
"Morocc Deathmatch (x Berry/Seed)",
"PVP Ranking",
( getgmlevel() >= 99 ) ? "^FF0000[GM] Reset PVP Ranking^000000":""
)) {
case 1: callsub( L_Enter,"Izlude (Berry/Seed - ALLOWED)","pvp_y_1-2",30 ); break;
case 2: callsub( L_Enter,"Izlude (x Berry/Seed)","pvp_y_2-2",30 ); break;
case 3: callsub( L_Enter,"Morocc Deathmatch (x Berry/Seed)","pvp_y_1-5",30 ); break;
default:
mes "[PvP Room Master]";
mes "PVP Ranking";
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 "["+(.@i + 1 )+"] "+.@name$[.@i]+" - "+.@pvp_kill[.@i]+" kill(s)";
}
break;
case 5:
mes "[PvP Room Master]";
mes "Reset Ranking? Action cant be undo. Confirm your action.";
if ( select( "Confirm","Cancel" ) == 1 ) {
query_sql( "UPDATE `char` SET `pvp_kill` = 0 WHERE `pvp_kill` > 0" );
mes "Done.";
}
break;
}
close;
L_Enter:
.@title$ = getarg( 0,"" );
.@map$ = getarg( 1,"" );
.@max_player = getarg( 2,0 );
.@getmapusers = getmapusers( .@map$ );
mes "[PvP Room Master]";
if ( .@getmapusers == -1 ) {
mes "Invalid map.";
}
else if ( .@max_player > 0 && .@getmapusers >= .@max_player ) {
mes "I'm sorry but the PVP Room is already full!";
}
else {
mes .@title$ + " ["+.@getmapusers+"/"+.@max_player+"]";
if ( select( "Enter","Cancel" ) == 1 ) {
warp .@map$,0,0;
}
}
return;
OnInit:
waitingroom "PVP Room",0;
end;
OnPCKillEvent:
if ( getcharid(3) != killedrid ) {
query_sql( "UPDATE `char` SET `pvp_kill` = `pvp_kill` + 1 WHERE `char_id` = "+getcharid(0)+" LIMIT 1" );
}
end;
}
// PvP Room ----------------------------------------------
morocc,171,250,4 duplicate(PvP Room) PvP Room#d2 615
louyang,225,98,3 duplicate(PvP Room) PvP Room#d3 615
payon,167,234,3 duplicate(PvP Room) PvP Room#d4 615
gonryun,170,142,3 duplicate(PvP Room) PvP Room#d5 615
aldebaran,146,116,3 duplicate(PvP Room) PvP Room#d6 615
ayothaya,161,159,3 duplicate(PvP Room) PvP Room#d7 615
xmas,154,126,3 duplicate(PvP Room) PvP Room#d8 615
Comments
0 B
|👍
/👎