HyperSonic2097 1 Posted September 10, 2017 (edited) Hi all, anyone know how I make this work? if (countitem (501) > 1) { mes "you have the requested item"; delitem 501,1; getitem 502,1; close; } else { mes "you don't have anything"; close; } What I am doing wrong? This gave me "you don't have anything" even I have the correct item. Thanks! EDIT: nevermind, I have forgot an = in the code correct code: if (countitem (501) >= 1) { mes "you have the requested item"; delitem 501,1; getitem 502,1; close; } else { mes "you don't have anything"; close; } Edited September 10, 2017 by HyperSonic2097 Quote Share this post Link to post Share on other sites
0 meko 170 Posted September 10, 2017 remove the space between countitem and the opening parenthesis countitem () => countitem() Quote Share this post Link to post Share on other sites
0 HyperSonic2097 1 Posted September 10, 2017 (edited) Thanks! Edited September 10, 2017 by HyperSonic2097 Quote Share this post Link to post Share on other sites
0 meko 170 Posted September 10, 2017 Also, don't forget to check if the item can be carried by the player: if (countitem(501) >= 1) { mes("you have the requested item"); if (!checkweight(502, 1)) { mes("...but you can't carry it!"); } else { delitem(501, 1); getitem(502, 1); } } else { mes("you don't have anything"); } close; And instead of 501 / 502 you should use constants Quote Share this post Link to post Share on other sites
Hi all,
anyone know how I make this work?
if (countitem (501) > 1) {
mes "you have the requested item";
delitem 501,1;
getitem 502,1;
close;
} else {
mes "you don't have anything";
close;
}
What I am doing wrong? This gave me "you don't have anything" even I have the correct item.
Thanks!
EDIT: nevermind, I have forgot an = in the code
correct code:
if (countitem (501) >= 1) {
Edited by HyperSonic2097mes "you have the requested item";
delitem 501,1;
getitem 502,1;
close;
} else {
mes "you don't have anything";
close;
}
Share this post
Link to post
Share on other sites