prontera,138,183,6 script Credit Exchanger 807,{
mes "[Creditz]";
mes "I can change Creditz and Zeny";
next;
mes "[Credit Exchanger]";
mes "What Do You Want?";
menu "Credit = Zeny",-,"Zeny = Credit",ztc;
next;
mes "[Credit Exchanger]";
mes "Put the Number of Credit you Need";
input .@t;
if( .@t < 0 )||( countitem(21011) < .@t ){ cutin "",255; close; }
set Zeny,Zeny+10000000*.@t;
delitem 21011,.@t;
cutin "",255;
close;
ztc:
mes "[Credit Exchanger]";
mes "Put The Number of Credit to be Change";
input .@t;
if (checkweight(21011,.@t)) {
if( Zeny < 10000000*.@t ){ cutin "",255; close; }
set Zeny,Zeny-10000000*.@t;
getitem 21011,.@t;
} else {
mes "You don't have enough space in your inventory.";
}
cutin "",255;
close;
G_no:
mes "[Credit Exchanger]";
mes "^0055ff Come Back Any time =)^000000";
cutin "",255;
close;
end;
}
//---Coin Exchanger
prontera,140,181,5 script Coin Exchanger 807,{
function int__;
do{
callsub exchange_rate;
.@menu = select( "-Zeny to Coin","-Coin to Zeny","Close" );
switch( .@menu ){
Case 1:
mes "Convert Zeny to which Coins ?";
.@coin = select( implode( .coin_name$,":" ) ) - 1;
if( Zeny < .value[.@coin] ){
mes "^FF0000[ERROR]^000000 You didnt have enough zeny.";
}else{
.@maximum = Zeny / .value[.@coin];
mes "You can get maximum of ^FF0000"+int__( .@maximum )+" x "+getitemname( .coin_id[.@coin] )+"^000000";
input .@amount,0,.@maximum;
if( .@amount )
if( checkweight( .coin_id[.@coin],.@amount ) ){
.@total = ( .@amount * .value[.@coin] );
Zeny -= .@total;
getitem .coin_id[.@coin],.@amount;
message strcharinfo(0),"Exchanged "+int__( .@total )+" Zeny to "+int__( .@amount )+" "+getitemname( .coin_id[.@coin] )+"^000000";
}else{
mes "^FF0000[ERROR]^000000 You cant take this much.";
}
}
break;
Case 2:
mes "Convert which Coins to Zeny ?";
.@coin = select( implode( .coin_name$,":" ) ) - 1;
if( !countitem( .coin_id[.@coin] ) ){
mes "^FF0000[ERROR]^000000 You didnt have any "+getitemname( .coin_id[.@coin] )+".";
}else if( ( .max_zeny - Zeny ) < .value[.@coin] ){
mes "^FF0000[ERROR]^000000 You cant exchange this Coin as it will exceed the Zeny limit.";
}else{
.@maximum = (( .max_zeny - Zeny ) / .value[.@coin] );
if( .@maximum > countitem( .coin_id[.@coin] ) ) .@maximum = countitem( .coin_id[.@coin] );
mes "You can exchange maximum of ^FF0000"+int__( .@maximum )+" x "+getitemname( .coin_id[.@coin] )+"^000000 to zeny";
input .@amount,0,.@maximum;
if( .@amount ){
.@total = ( .@amount * .value[.@coin] );
Zeny += .@total;
delitem .coin_id[.@coin],.@amount;
message strcharinfo(0),"Exchanged "+int__( .@amount )+" "+getitemname( .coin_id[.@coin] )+" to "+int__( .@total )+" Zeny^000000";
}
}
break;
default: break;
}
next;
}while( .@menu != 3 );
mes "Thank you.";
close;
OnInit:
// server max zeny
.max_zeny = 2000000000;
// coin list + name + value
setarray .coin_name$,"^ff9900Gold Coinz^000000","^6633ccBag Of Coinz^000000";
setarray .coin_id,671,670;
setarray .value,50000000,100000000;
.coin_size = getarraysize( .coin_name$ );
end;
// credits to annieruru
function int__ {
set .@num, atoi(""+getarg(0));
if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
set .@l, getstrlen(""+.@num);
for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
}
return .@num$;
}
}
Here's my script and some errors keep appearing in my map server console when someone doing a transaction on this NPC.. kindly help me to solve the issue guys... Thank you in advance.. Please see the attach file below for screenshot of errors..
Question
Brahms
Here's my script and some errors keep appearing in my map server console when someone doing a transaction on this NPC.. kindly help me to solve the issue guys... Thank you in advance.. Please see the attach file below for screenshot of errors..
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.