viewing paste show your current rank | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/*
create table testest (
account_id int(11) primary key,
name varchar(24),
kills int(11),
key (kills)
) engine = myisam;
*/
prontera,155,180,5      script  poring_ladder   1_F_MARIA,{
        mes "most poring killed";
        if ( !( .@nb = query_sql( "select name, kills from testest order by kills desc limit 10", .@name$, .@kills ) ) ) {
                mes "no entry";
                close;
        }
        for ( .@i = 0; .@i < .@nb; ++.@i )
                mes ( .@i +1 )+". "+ .@name$[.@i] +" -> "+ .@kills[.@i] +" kills.";
        next;
        if ( !query_sql( "select kills, find_in_set( kills, ( select group_concat( kills order by kills desc ) from testest ) ) from testest where account_id = "+ getcharid(3), .@kills, .@rank ) ) {
                mes "you haven't made a single kill";
                close;
        }
        mes "you have killed "+ .@kills +" porings";
        mes "Your rank is No."+ .@rank;
        close;
OnNPCKillEvent:
        if ( killedrid != 1002 ) end;
        query_sql "insert into testest values ( "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update kills = kills +1";
        end;
}
Viewed 51 times, submitted by AnnieRuru.