johnlol

Credit Trader

May 10th, 2019
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //https://rathena.org/board/topic/108845-can-anyone-give-me-the-mvp-npc-script-and-help-me-unknown-item-3/
  2. prontera,184,177,5  script  Credit Trader   851,{
  3.     .@zeny_worth = 1000000;
  4.     query_sql ( "SELECT `balance` FROM `cp_credits` WHERE `account_id` = "+getcharid(3)+";", .@credits );
  5.    
  6.     mes "What would you like to do?";
  7.     next;
  8.     .@select = select("Credits -> Zeny?:Zeny -> Credits?") -1;
  9.    
  10.     mes "How "+( .@select ? "much zeny" : "many credits" )+" would you like to convert?";
  11.     mes .@select ? "Zeny: ^0000FF"+Zeny+"^000000" : "Credits: ^0000FF"+.@credits+"^000000";
  12.     next;
  13.     if( input( .@withdraw, 1, .@select ? Zeny : .@credits ) != 0 ) {
  14.         mes "Please input a number between 1 and ^0000FF"+(.@select ? Zeny : .@credits)+"^000000.";
  15.         close;
  16.     }
  17.     if( .@select && .@withdraw < .@zeny_worth ) {
  18.         mes "Each credit costs at least ^0000FF"+.@zeny_worth+"^000000 Zeny.";
  19.         close;
  20.     }
  21.     mes "Are you sure?";
  22.     mes .@select ?
  23.         "^0000FF"+.@withdraw+"^000000 Zeny -> ^00FF00"+( .@withdraw / .@zeny_worth )+"^000000 Credits.";
  24.     :
  25.         "^0000FF"+.@withdraw+"^000000 Credits -> ^00FF00"+( .@withdraw * .@zeny_worth )+"^000000 Zeny.";
  26.     next;
  27.     if( select("Yes:No") == 2 ) {
  28.         mes "Alright come again!";
  29.         close;
  30.     }
  31.    
  32.     Zeny = .@select ? ( ( Zeny - .@withdraw ) + ( .@withdraw % .@zeny_worth ) ) : Zeny + ( .@withdraw * .@zeny_worth );
  33.     query_sql ( "UPDATE `cp_credits` SET `balance` = "+( .@select ? .@credits + ( .@withdraw / .@zeny_worth ) : .@credits - .@withdraw )+" WHERE `account_id` = "+getcharid(3)+";" );
  34.     mes "Thanks for using our service have a nice day.";
  35.     close;
  36. }
Add Comment
Please, Sign In to add comment