prontera,131,207,5 script WoE Rank#PvP 421,{
mes "[ ^FF0000Top 10 WoE Killers^000000 ]";
if ( .@size = getarraysize( $topwoe1pvp_name$ ) ) {
for ( .@i = 0; .@i < .@size; .@i++ )
mes ""+( .@i +1 )+": ^0000FF"+ $topwoe1pvp_name$[.@i] +"^000000 - ^FF0000"+ $topwoe1pvp_points[.@i] +"^000000 Kill.";
}
else
mes "<empty>";
close;
OnPCKillEvent:
if ( !getmapflag( strcharinfo(3), mf_gvg_castle ) ) end;
topwoe1pvp_points++;
.@i = 0;
while ( .@i < .ladderlength ) {
if ( topwoe1pvp_points > $topwoe1pvp_points[.@i] ) { // if found
if ( $topwoe1pvp_name$[.@i] == strcharinfo(0) ) { // update your own points
$topwoe1pvp_points[.@i] = topwoe1pvp_points;
break;
}
else if ( .@i == .ladderlength - 1 ) { // last position of the ladder, just overwrite the value
$topwoe1pvp_points[.@i] = topwoe1pvp_points;
$topwoe1pvp_name$[.@i] = strcharinfo(0);
break;
}
// if more points, but somehow its not your own name
.@j = .@i +1 ; // save the index
while ( $topwoe1pvp_name$[.@j] != strcharinfo(0) && .@j < .ladderlength ) .@j++;
if ( .@j < .ladderlength ) // found your name
.@moveamount = .@j - .@i; // save amount to move
else // if not found ...
.@moveamount = .ladderlength - 1 - .@i; // means move the whole ladder from the last index
copyarray $topwoe1pvp_points[.@i +1], $topwoe1pvp_points[.@i], .@moveamount;
copyarray $topwoe1pvp_name$[.@i +1], $topwoe1pvp_name$[.@i], .@moveamount;
$topwoe1pvp_points[.@i] = topwoe1pvp_points;
$topwoe1pvp_name$[.@i] = strcharinfo(0);
break;
}
.@i++;
}
end;
OnInit:
.ladderlength = 10;
end;
}
Question
itsmeyoe
Please use CODEBOX.
Link to comment
Share on other sites
3 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.