* Blaze * 6 Posted January 18, 2017 Any idea how add checkweight here thanks setarray .@CoinID[0],607; for( set .@i,0; .@i < getarraysize( .@CoinID ); set .@i,.@i + 1 ) set .@Menu$,.@Menu$ + getitemname( .@CoinID[.@i] )+":"; set .@i,( select( .@Menu$ ) - 1 ); if( #KAFRAPOINTS < 2 ){ mes "Sorry but you didnt have 2 Reward Points."; }else{ mes "How many ^339FFFArrow Quiver^000000"; mes "you want to purchase?"; mes "Amount : 1 ~ "+( #KAFRAPOINTS / 2 ); input .@Amount,0,( #KAFRAPOINTS / 2 ); if( .@Amount ){ set #KAFRAPOINTS,#KAFRAPOINTS - ( .@Amount * 2 ); getitem .@CoinID[.@i],.@Amount; mes "Done"; } } close; Quote Share this post Link to post Share on other sites
0 * Blaze * 6 Posted January 19, 2017 setarray .@CoinID[0], 607; for (.@i = 0; .@i < getarraysize(.@CoinID); ++.@i) .@Menu$ += getitemname( .@CoinID[.@i] )+":"; .@i = select(.@Menu$) - 1; if (#KAFRAPOINTS < 2) { mes "Sorry but you didnt have 2 Reward Points."; } else { mes "How many ^339FFFArrow Quiver^000000"; mes "you want to purchase?"; mes "Amount : 1 ~ " + (#KAFRAPOINTS / 2); input .@Amount, 0, (#KAFRAPOINTS / 2); if (.@Amount) { if (!checkweight(Knife, 1) || MaxWeight - Weight < 1000) { mes "- You're over weight or you dont have enough space in your inventory -"; close; } #KAFRAPOINTS -= .@Amount * 2; getitem .@CoinID[.@i], .@Amount; mes "Done"; } } close; hello i got error line 76 it seems like you're not using hercules Hello im using rAmod sorry old revision Fixed thanks Quote Share this post Link to post Share on other sites
0 Asheraf 123 Posted January 18, 2017 setarray .@CoinID[0], 607; for (.@i = 0; .@i < getarraysize(.@CoinID); ++.@i) .@Menu$ += getitemname( .@CoinID[.@i] )+":"; .@i = select(.@Menu$) - 1; if (#KAFRAPOINTS < 2) { mes "Sorry but you didnt have 2 Reward Points."; } else { mes "How many ^339FFFArrow Quiver^000000"; mes "you want to purchase?"; mes "Amount : 1 ~ " + (#KAFRAPOINTS / 2); input .@Amount, 0, (#KAFRAPOINTS / 2); if (.@Amount) { if (!checkweight(Knife, 1) || MaxWeight - Weight < 1000) { mes "- You're over weight or you dont have enough space in your inventory -"; close; } #KAFRAPOINTS -= .@Amount * 2; getitem .@CoinID[.@i], .@Amount; mes "Done"; } } close; Quote Share this post Link to post Share on other sites
0 Ragno 57 Posted January 18, 2017 Just after the if( .@Amount ){ check, you can add a new check to verify weight: if (.@Amount) { if (checkweight(.@CoinID[.@i], .@Amount)) { #KAFRAPOINTS = #KAFRAPOINTS - ( .@Amount * 2 ); getitem .@CoinID[.@i], .@Amount; mes "Done"; } else { mes "You have no space on inventory."; } } Also, you need to avoid usage of set command, Set script command is deprecated and it may be remove in any future. Instead, set values directly in this way: .@i = 1; .@i = select(.@string$); .@i = .@a + .@b; Or, as in previous example: #KAFRAPOINTS = #KAFRAPOINTS - ( .@Amount * 2 ); It's easier and more clean. Also, I recommend you to put a space after a comma, since it is standard in Hercules and also makes the script more clean and more readable. Quote Share this post Link to post Share on other sites
0 * Blaze * 6 Posted January 19, 2017 setarray .@CoinID[0], 607; for (.@i = 0; .@i < getarraysize(.@CoinID); ++.@i) .@Menu$ += getitemname( .@CoinID[.@i] )+":"; .@i = select(.@Menu$) - 1; if (#KAFRAPOINTS < 2) { mes "Sorry but you didnt have 2 Reward Points."; } else { mes "How many ^339FFFArrow Quiver^000000"; mes "you want to purchase?"; mes "Amount : 1 ~ " + (#KAFRAPOINTS / 2); input .@Amount, 0, (#KAFRAPOINTS / 2); if (.@Amount) { if (!checkweight(Knife, 1) || MaxWeight - Weight < 1000) { mes "- You're over weight or you dont have enough space in your inventory -"; close; } #KAFRAPOINTS -= .@Amount * 2; getitem .@CoinID[.@i], .@Amount; mes "Done"; } } close; hello i got error line 76 Quote Share this post Link to post Share on other sites
0 Asheraf 123 Posted January 19, 2017 setarray .@CoinID[0], 607; for (.@i = 0; .@i < getarraysize(.@CoinID); ++.@i) .@Menu$ += getitemname( .@CoinID[.@i] )+":"; .@i = select(.@Menu$) - 1; if (#KAFRAPOINTS < 2) { mes "Sorry but you didnt have 2 Reward Points."; } else { mes "How many ^339FFFArrow Quiver^000000"; mes "you want to purchase?"; mes "Amount : 1 ~ " + (#KAFRAPOINTS / 2); input .@Amount, 0, (#KAFRAPOINTS / 2); if (.@Amount) { if (!checkweight(Knife, 1) || MaxWeight - Weight < 1000) { mes "- You're over weight or you dont have enough space in your inventory -"; close; } #KAFRAPOINTS -= .@Amount * 2; getitem .@CoinID[.@i], .@Amount; mes "Done"; } } close; hello i got error line 76 it seems like you're not using hercules Quote Share this post Link to post Share on other sites
Share this post
Link to post
Share on other sites