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;
}