office,122,18,0	script	Teller	1_F_LIBRARYGIRL,{
	disable_items;
	while(1) {	
		mes "[ ^996600BANK System^000000 ]";
		mes "Hello " + strcharinfo( PC_NAME ) + ", Please sit down. What can i do for you?";
		next;
		switch( select( ("Deposit:Withdraw:Balance Inquiry:" ) + "Close" ) ) {
			case 1:
				mes "[ ^996600BANK System^000000 ]";
				mes "Hi, how much would you like to deposit?";
				mes "Maximum amount per transaction is ";
				mes "^000080"+callfunc("F_InsertComma",.maxtransaction)+ "^000000 zeny";
				next;
				input .@amount;
				if ( !.@amount || .@amount > .maxtransaction ) {
					mes "[ ^996600BANK System^000000 ]";
					mes "Invalid amount. Maximum amount per transaction is ";
					mes "^000080"+callfunc("F_InsertComma",.maxtransaction)+ "^000000 zeny";
					next;
					break;
				}
				mes "[ ^996600BANK System^000000 ]";
				mes "Are you sure you want to deposit ";
				mes  "^000080"+callfunc("F_InsertComma",.@amount)+ "^000000 zeny";
				mes "to your bank account?";
				next;
				if ( select( "Yes:No" ) - 1 ) break;
				if ( Zeny < .@amount ) {
					mes "[ ^996600BANK System^000000 ]";
					mes "Seems like you don't have that";
					mes "kind of amount. I will terminate";
					mes "this transaction then.";
					next;
					break;
				}
				mes "[ ^996600BANK System^000000 ]";
				mes "^000080"+callfunc("F_InsertComma",.@amount)+ "^000000 zeny";
				mes "have been deposited on your account.";
				mes "Thank you for using this BANK System";
				Zeny -= .@amount;
				BankVault += .@amount;
				query_logsql "INSERT INTO `zenylog` ( `time`, `char_id`,`src_id`,`type`,`amount`,`map` ) VALUES ( '"+gettimestr("%Y-%m-%d %H:%M:%S",21)+"','" + getcharid( CHAR_ID_CHAR ) + "','" + getcharid( CHAR_ID_CHAR ) + "','K','"+(.@amount)+"','" +strnpcinfo(NPC_MAP)+ "' )";
				next;	
 				break;
			case 2:
				mes "[ ^996600BANK System^000000 ]";
				mes "Hi, how much would you like to withdraw? Maximum amount per transaction is ";
				mes "^000080"+callfunc("F_InsertComma",.maxtransaction)+ "^000000 zeny";
				next;
				input .@amount;
				if ( !.@amount || .@amount > .maxtransaction ) {
					mes "[ ^996600BANK System^000000 ]";
					mes "Invalid amount. Maximum amount per transaction is ";
					mes "^000080"+callfunc("F_InsertComma",.maxtransaction)+ "^000000 zeny";
					next;
					break;
				}
				mes "[ ^996600BANK System^000000 ]";
				mes "Are you sure you want to withdraw";
				mes "^000080"+callfunc("F_InsertComma",.@amount)+ "^000000 zeny";
				mes "from your bank account?";
				next;
				if ( select( "Yes:No" ) - 1 ) break;
				if ( BankVault < .@amount ) {
					mes "[ ^996600BANK System^000000 ]";
					mes "Seems like you don't have that kind of amount. I will terminate this transaction then.";
					next;
					break;
				}
				if ( ( Zeny + .@amount ) > 2000000000 ) {
					mes "[ ^996600BANK System^000000 ]";
					mes "You cannot afford to hold this kind of zeny. The maximum zeny you can hold is";
					mes "^0000802,000,000,000^000000 zeny only.";
					break;
				}
				mes "[ ^996600BANK System^000000 ]";
				mes "^000080"+callfunc("F_InsertComma",.@amount)+ "^000000 zeny";
				mes "have been withdrew on your account. Thank you for using this BANK System";
				BankVault -= .@amount;
				Zeny += .@amount;
				query_logsql "INSERT INTO `zenylog` ( `time`, `char_id`,`src_id`,`type`,`amount`,`map` ) VALUES ( '"+gettimestr("%Y-%m-%d %H:%M:%S",21)+"','" + getcharid( CHAR_ID_CHAR ) + "','" + getcharid( CHAR_ID_CHAR ) + "','K','"+(-.@amount)+"','" +strnpcinfo(NPC_MAP)+ "' )";
				next;	
				break;
			case 3: 
				mes "[ ^996600BANK System^000000 ]";
				mes "Your account balance is : ";
				mes "^000080"+callfunc("F_InsertComma",BankVault)+ "^000000 zeny";
				next;					
				break;
			default:
				close();
		}
	}	

OnInit:
	waitingroom "Bank Teller",0;
	.npc$ = "[ ^996600BANK System^000000 ]";
	.maxtransaction = 10000000;
	end;
}
