prontera,0,0,0 shop market2#hidden -1,501:1000 prontera,156,172,5 script market 100,{ dispbottom "You currently have "+ getd(.var$) +" points."; callshop .shopname$, 1; end; OnInit: function addshopitem { npcshopdelitem .shopname$, 501; .@count = getargcount(); for ( .@i = 0; .@i < .@count; .@i++ ) { if ( .@i % 2 == 0 ) .itemid[ .@i /2 ] = getarg( .@i ); else { .itemcost[ .@i /2 ] = getarg( .@i ); npcshopadditem .shopname$, .itemid[ .@i /2 ], getarg( .@i ); } } } // ----- Configuration ------ .shopname$ = "market2#hidden"; // shop name that match the 1st line in this script .var$ = "CUSTOM_POINTS"; // variable name for this shop addshopitem // adds shop items here 512,10, 513,20, 514,30, 515,40, 516,50, 607,1; // ------------------------- .itemsize = getarraysize( .itemid ); for ( .@i = 0; .@i < .itemsize; .@i++ ) setd ".item"+ .itemid[.@i] +"cost", .itemcost[.@i]; npcshopattach .shopname$; end; OnBuyItem: if ( !@bought_quantity ) end; .@size = getarraysize( @bought_nameid ); for ( .@i = 0; .@i < .@size; .@i++ ) .@itemcost = .@itemcost + getd( ".item"+ @bought_nameid[.@i] +"cost" ) * @bought_quantity[.@i]; if ( .@itemcost > getd(.var$) ) { mes "you don't have enough points to buy them"; close; } if ( !checkweight2( @bought_nameid, @bought_quantity ) ) { mes "you can't carry all these items !"; close; } setd .var$, getd(.var$) - .@itemcost; for ( .@i = 0; .@i < .@size; .@i++ ) getitem @bought_nameid[.@i], @bought_quantity[.@i]; end; }