viewing paste Mail NPC | 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
 
prontera,155,175,5  script  Mail NPC    4_F_KAFRA9,{
 
    .@sql$ = "SELECT `id`, `send_name`, `message`, `time`, `zeny`, `nameid`, `amount`, `refine`, `attribute`, `identify`, `card0`, `card1`, `card2`, `card3` "
            + "FROM `mail` "
            + "WHERE `dest_name` = '"+escape_sql( strcharinfo(0) )+"' "
            + "LIMIT 50";
            
    query_sql( .@sql$, .@id, .@send_name$, .@title$, .@message$, .@zeny, .@nameid, .@amount, .@refine, .@attribute, .@identify, .@card0, .@card1, .@card2, .@card3 );
    .@size = getarraysize( .@id );
    
    for ( .@i = 0; .@i < .@size; .@i++ )
        .@menu$ = .@menu$ + replacestr( .@title$, ":", " " ) + ":";
    
    mes "Mail NPC";
    
    if ( !.@size ) {
        mes "No mail.";
    }
    else {
        .@i = select( .@menu$ ) - 1;
        
        mes "Sender: "+.@send_name$[.@i];
        mes "Title: "+.@title$[.@i];
        mes "Message: "+.@message$[.@i];
        if ( .@zeny[.@i] ) 
            mes "Zeny: "+.@zeny[.@i];
        if ( .@nameid && .@amount[.@i] )
            mes "Item: "+.@amount[.@i]+"x "+getitemname( .@nameid[.@i] );
        
        if ( select( "Remove Mail","Cancel" ) == 1 ) {
            if ( !checkweight( .@nameid[.@i], .@amount[.@i] ) ) {
                mes "overweight.";
            }
            else {
                query_sql( "DELETE FROM `mail` WHERE `id` = '"+.@id[.@i]+"' LIMIT 1" );
                if ( .@zeny[.@i] )
                    Zeny += .@zeny[.@i];
                if ( .@nameid && .@amount[.@i] )
                    getitem2 .@nameid[.@i], .@amount[.@i], .@identify[.@i], .@refine[.@i], .@attribute[.@i], .@card0[.@i], .@card1[.@i], .@card2[.@i], .@card3[.@i];
                mes "Done, mail removed.";
            }
        }
    }
    close;
}
 
Viewed 1229 times, submitted by Emistry.