I took the script off Shawns NPC scripting guide, and added selection 2, as well as the 'Nice' var.
When I choose the last option, nothing happens(exists out of NPC).
Would appreciate help :)
When I choose the last option, nothing happens(exists out of NPC).
Would appreciate help :)
PHP Code:
var yes = "Good Job! You have enough Golden Maple Leafs!";
var no = "I'm sorry, you don't have enough Golden Maple Leafs.";
var Nice = "Nice man";
var status;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
}else{
status--;
}
if (status == 0) {
cm.sendSimple("#L0# I have 10 Golden Maple Leafs #l \r\n#L1# I have 20 Golden Maple Leafs #l \r\n#L2# I have 1 golden leaf #l");
}else if (status == 1) {
if (selection == 0) {
if (cm.haveItem(4000313, 10)) {
cm.sendOk(yes);
cm.dispose();
}else{
cm.sendOk("no");
cm.getItem(4000313,1);
cm.dispose();
}
} else if (selection == 1) {
if (cm.haveItem(4000313, 20)) {
cm.sendOk(yes);
cm.dispose();
}else{
cm.sendOk(no);
cm.dispose();
} if (selection == 2) {
if(cm.haveItem(4000313, 1)) {
cm.sendOk(Nice);
cm.dispose();
} else {
cm.sendOk("Dam you're out man");
cm.dispose();
}
}
}
}
}