Jump to content

Question

2 answers to this question

Recommended Posts

Posted

Try This one..

prontera,147,196,3<tab>script <tab>GoldShop<tab>403,{
mes .name$;
mes "You currently have "+countitem(.gold_item)+" GOLD.";
mes "Would you like to look at the shop?";
next;
if(select("Yes:No") == 2) {
close;
}
close2;
callshop "GOLD_SHOP",1;
npcshopattach "GOLD_SHOP";
dispbottom "You currently have "+countitem(.gold_item)+" GOLD.";
end;

OnBuyItem:
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
for(set @j,0; @j < getarraysize(.GOLD_ITEMS); set @j,@j+2) {
if(.GOLD_ITEMS[@j] == @bought_nameid[@i]) {
set @itemcost,(.GOLD_ITEMS[(@j+1)]*@bought_quantity[@i]);
set @totalcost,(@totalcost+@itemcost);
break;
}
}
}
if(@totalcost > countitem(.gold_item)) {
dispbottom "You don't have enough GOLD.";
}
else {
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
getitem @bought_nameid[@i],@bought_quantity[@i];
}
delitem .gold_item,@totalcost;
dispbottom "Thank you for shopping.";
dispbottom "You now have "+countitem(.gold_item)+" GOLD left.";
}
set @totalcost,0;
deletearray @bought_nameid[0],128;
deletearray @bought_quantity[0],128;
end;
OnInit:
npcshopdelitem "GOLD_SHOP",909; // Leave this alone
set .name$,"[GOLD Trader]";
set .gold_item,7720; // Input GOLD ID
setarray .GOLD_ITEMS[0],4174,40,4047,40,4302,40,4263,30,4305,30,4121,40,4236,25,4168,40,43
18,30,4276,40,4146,30,4131,30,4143,30,4135,40,5374,250,5375,200,5377,200,5373,200
,5372,150,12906,2,12907,2,13592,4,12905,2,12903,2; // Input as many items as you want (item::price)

for(set .@i,0; .@i < getarraysize(.GOLD_ITEMS); set .@i,.@i+2) {
npcshopadditem "GOLD_SHOP",.GOLD_ITEMS[.@i],.GOLD_ITEMS[(.@i+1)];
}
}

- shop GOLD_SHOP 139,909:1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...