Currently Posted January 6, 2013 Group: Members Topic Count: 162 Topics Per Day: 0.03 Content Count: 313 Reputation: 1 Joined: 01/22/12 Last Seen: November 17, 2023 Share 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 Link to comment Share on other sites More sharing options...
nanakiwurtz Posted January 6, 2013 Group: Members Topic Count: 81 Topics Per Day: 0.02 Content Count: 1654 Reputation: 583 Joined: 08/09/12 Last Seen: January 14, 2020 Share 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 Link to comment Share on other sites More sharing options...
Question
Currently
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.