prontera,163,168,4 script Item Trader 797,{
mes "[Item Trader]";
mes "Would you like to";
mes "trade something in?";
mes "The item ID must be";
mes "between ^0055FF["+.Bounds[0]+"]^000000 and ^0055FF["+.Bounds[1]+"]^000000.";
next;
if(select("Sure.:No, thanks.") == 2) close;
mes "[Item Trader]";
mes "Select a single item to trade in.";
mes "You can change your mind later, don't worry.";
callshop "item_trader",2;
npcshopattach "item_trader";
end;
OnSellItem:
mes "[Item Trader]";
if (@sold_nameid < .Bounds[0] || @sold_nameid > .Bounds[1]) {
mes "I'm afraid I can't do anything with this ^0055FF"+getitemname(@sold_nameid)+"^000000...";
close;
}
mes "You want to trade in your ^0055FF"+getitemname(@sold_nameid)+"^000000?";
sleep2 1000;
doevent strnpcinfo(0)+"::OnContinue";
end;
OnContinue:
mes "Pick one item you'd like, then.";
callshop "item_trader",1;
npcshopattach "item_trader";
end;
OnBuyItem:
mes "[Item Trader]";
mes "Are you sure you want to trade your ^0055FF"+getitemname(@sold_nameid)+"^000000 for a ^0055FF"+getitemname(@bought_nameid)+"^000000?";
next;
if(select("Yes, I'm sure.:Wait a second...") == 2) {
mes "[Item Trader]";
mes "Okay, take your time.";
close;
}
mes "[Item Trader]";
mes "Here you go.";
mes "Enjoy!";
delitem @sold_nameid,1;
getitem @bought_nameid,1;
close;
OnInit:
// Write the lower and upper bounds of item IDs to trade in.
setarray .Bounds[0],500,550;
// List the items available to purchase.
setarray .@Items[0],501,502,503,504,505,506,507,508,509,510,511;
freeloop(1);
npcshopdelitem "item_trader",512;
for(set .@i,0; .@i<getarraysize(.@Items); set .@i,.@i+1)
npcshopadditem "item_trader",.@Items[.@i],0;
freeloop(0);
end;
}
- shop item_trader -1,512:-1