Currently Posted January 6, 2013 Posted January 6, 2013 (edited) OnBuyItem: set @currentprice,0; for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1){ set @currentprice,@currentprice + (getiteminfo(@bought_nameid[@i],0) * @bought_quantity[@i]); } if(countitem(12618) < @bought_quantity*@currentprice) { //It doesn't read. Not enough 12618 but script still buys. mes @npc$; mes "You do not have enough Misc Points."; close; } delitem 12618,-@bought_quantity*@currentprice; //doesn't work? //Let's give them those items! for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1){ getitem @bought_nameid[@i],@bought_quantity[@i]; } mes @npc$; mes "That's that, then! Come again!"; deletearray @bought_quantity, getarraysize(@bought_quantity); deletearray @bought_nameid, getarraysize(@bought_nameid); close; } } Edited January 6, 2013 by Dreamworks Quote
nanakiwurtz Posted January 6, 2013 Posted January 6, 2013 What if: OnBuyItem: set @currentprice,0; for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1) { set @currentprice,@currentprice + (getiteminfo(@bought_nameid[@i],0) * @bought_quantity[@i]); } if(countitem(12618) < (@bought_quantity*@currentprice)) { mes @npc$; mes "You do not have enough Misc Points."; close; } delitem 12618,(-@bought_quantity*@currentprice); for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1){ getitem @bought_nameid[@i],@bought_quantity[@i]; } mes @npc$; mes "That's that, then! Come again!"; deletearray @bought_quantity, getarraysize(@bought_quantity); deletearray @bought_nameid, getarraysize(@bought_nameid); close; } } Quote
Question
Currently
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.