viewing paste Zeny to Donation Credit Converter | 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
//https://rathena.org/board/topic/108845-can-anyone-give-me-the-mvp-npc-script-and-help-me-unknown-item-3/
prontera,184,177,5      script  Credit Trader   851,{
        .@zeny_worth = 1000000;
        query_sql ( "SELECT `balance` FROM `cp_credits` WHERE `account_id` = "+getcharid(3)+";", .@credits );
       
        mes "What would you like to do?";
        next;
        .@select = select("Credits -> Zeny?:Zeny -> Credits?") -1;
       
        mes "How "+( .@select ? "much zeny" : "many credits" )+" would you like to convert?";
        mes .@select ? "Zeny: ^0000FF"+Zeny+"^000000" : "Credits: ^0000FF"+.@credits+"^000000";
        next;
        if( input( .@withdraw, 1, .@select ? Zeny : .@credits ) != 0 ) {
                mes "Please input a number between 1 and ^0000FF"+(.@select ? Zeny : .@credits)+"^000000.";
                close;
        }
        if( .@select && .@withdraw < .@zeny_worth ) {
                mes "Each credit costs at least ^0000FF"+.@zeny_worth+"^000000 Zeny.";
                close;
        }
        mes "Are you sure?";
        mes .@select ?
                "^0000FF"+.@withdraw+"^000000 Zeny -> ^00FF00"+( .@withdraw / .@zeny_worth )+"^000000 Credits.";
        :
                "^0000FF"+.@withdraw+"^000000 Credits -> ^00FF00"+( .@withdraw * .@zeny_worth )+"^000000 Zeny.";
        next;
        if( select("Yes:No") == 2 ) {
                mes "Alright come again!";
                close;
        }
       
        Zeny = .@select ? ( ( Zeny - .@withdraw ) + ( .@withdraw % .@zeny_worth ) ) : Zeny + ( .@withdraw * .@zeny_worth );
        query_sql ( "UPDATE `cp_credits` SET `balance` = "+( .@select ? .@credits + ( .@withdraw / .@zeny_worth ) : .@credits - .@withdraw )+" WHERE `account_id` = "+getcharid(3)+";" );
        mes "Thanks for using our service have a nice day.";
        close;
}
Viewed 875 times, submitted by Skorm.