/***
** Script Request (Cash Trader NPC)
** Link: http://rathena.org/board/topic/57101-request-cash-trader/
** By Slim
***/
prt_in,34,116,4 script RoK Point Trader 894,{
//,677
set .@coinid,671;
mes "[^0000FFCash Trader^000000]";
mes "Hi ^ff8800"+strcharinfo(0)+"^000000,";
mes "What can i do for you?";
mes "The Exchange ratio is 10:1";
mes "Your RoK Point: [^ff0000"+#ROK_POINTS+"^000000]";
switch(select("Cancel:Chaos coins to RoK points:RoK points to Chaos coins"))
{
case 1: break;
case 2:
next;
mes "[^0000FFCash Trader^000000]";
mes "Please input the amount of coins that you want to exchange.";
mes "Note: Put ^0000ff0^000000 to exit.";
L_inpcoin:
input @hcoins;
set @hhcoins,@hcoins;
if(@hhcoins == 0) { break; }
if(countitem(.@coinid) < @hhcoins) { mes "* ^ff0000Please input a valid amount^000000"; mes "(Put ^0000ff0^000000 to exit)."; goto L_inpcoin; }
next;
delitem .@coinid,@hhcoins;
set #ROK_POINTS,#ROK_POINTS+@hhcoins;
mes "[^0000FFCash Trader^000000]";
mes "You've exchanged (^ff0000"+@hhcoins+"^000000) "+getitemname(.@coinid)+"(s). Total RoK Points: [^0000ff"+#ROK_POINTS+"^000000]";
dispbottom "[Cash Trader] You've exchanged ("+@hhcoins+") "+getitemname(.@coinid)+"(s). Total RoK Points: ["+#ROK_POINTS+"]";
break;
case 3:
next;
mes "[^0000FFCash Trader^000000]";
mes "Please input the amount of RoK that you want to exchange.";
mes "Note: Put ^0000ff0^000000 to exit.";
L_inpcash:
input @hcash;
set @hhcash,@hcash;
if(@hhcash == 0) { break; }
if(#ROK_POINTS < @hhcash) { mes "* ^ff0000Please input a valid amount^000000"; mes "(Put ^0000ff0^000000 to exit)."; goto L_inpcash; }
//I know they weight 0 but just in case you change its weight
if (!checkweight(.@coinid,@hhcash)) { mes "* ^ff0000You're overweight please store some items.^000000"; dispbottom "[Cash Trader] You're overweight please store some items."; break; }
next;
set #ROK_POINTS,#ROK_POINTS - @hhcash;
getitem .@coinid,@hhcash;
mes "[^0000FFCash Trader^000000]";
mes "You've exchanged (^ff0000"+@hhcash+"^000000) RoK Points to "+getitemname(.@coinid)+"(s). Total RoK Points: [^0000ff"+#ROK_POINTS+"^000000]";
dispbottom "[Cash Trader] You've exchanged ("+@hhcash+") RoK Points to "+getitemname(.@coinid)+"(s). Total RoK Points: ["+#ROK_POINTS+"]";
break;a
}
close;
OnInit:
waitingroom "RoK Exchanger",0;
end;
}
Question
Zxcv
Now it accept 1 coin for 1 Rok Ppoint
/*** ** Script Request (Cash Trader NPC) ** Link: http://rathena.org/board/topic/57101-request-cash-trader/ ** By Slim ***/ prt_in,34,116,4 script RoK Point Trader 894,{ //,677 set .@coinid,671; mes "[^0000FFCash Trader^000000]"; mes "Hi ^ff8800"+strcharinfo(0)+"^000000,"; mes "What can i do for you?"; mes "The Exchange ratio is 10:1"; mes "Your RoK Point: [^ff0000"+#ROK_POINTS+"^000000]"; switch(select("Cancel:Chaos coins to RoK points:RoK points to Chaos coins")) { case 1: break; case 2: next; mes "[^0000FFCash Trader^000000]"; mes "Please input the amount of coins that you want to exchange."; mes "Note: Put ^0000ff0^000000 to exit."; L_inpcoin: input @hcoins; set @hhcoins,@hcoins; if(@hhcoins == 0) { break; } if(countitem(.@coinid) < @hhcoins) { mes "* ^ff0000Please input a valid amount^000000"; mes "(Put ^0000ff0^000000 to exit)."; goto L_inpcoin; } next; delitem .@coinid,@hhcoins; set #ROK_POINTS,#ROK_POINTS+@hhcoins; mes "[^0000FFCash Trader^000000]"; mes "You've exchanged (^ff0000"+@hhcoins+"^000000) "+getitemname(.@coinid)+"(s). Total RoK Points: [^0000ff"+#ROK_POINTS+"^000000]"; dispbottom "[Cash Trader] You've exchanged ("+@hhcoins+") "+getitemname(.@coinid)+"(s). Total RoK Points: ["+#ROK_POINTS+"]"; break; case 3: next; mes "[^0000FFCash Trader^000000]"; mes "Please input the amount of RoK that you want to exchange."; mes "Note: Put ^0000ff0^000000 to exit."; L_inpcash: input @hcash; set @hhcash,@hcash; if(@hhcash == 0) { break; } if(#ROK_POINTS < @hhcash) { mes "* ^ff0000Please input a valid amount^000000"; mes "(Put ^0000ff0^000000 to exit)."; goto L_inpcash; } //I know they weight 0 but just in case you change its weight if (!checkweight(.@coinid,@hhcash)) { mes "* ^ff0000You're overweight please store some items.^000000"; dispbottom "[Cash Trader] You're overweight please store some items."; break; } next; set #ROK_POINTS,#ROK_POINTS - @hhcash; getitem .@coinid,@hhcash; mes "[^0000FFCash Trader^000000]"; mes "You've exchanged (^ff0000"+@hhcash+"^000000) RoK Points to "+getitemname(.@coinid)+"(s). Total RoK Points: [^0000ff"+#ROK_POINTS+"^000000]"; dispbottom "[Cash Trader] You've exchanged ("+@hhcash+") RoK Points to "+getitemname(.@coinid)+"(s). Total RoK Points: ["+#ROK_POINTS+"]"; break;a } close; OnInit: waitingroom "RoK Exchanger",0; end; }
Please use CODEBOX.
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.