PHP Code:
status = -1;
req = [03991005, 03991011, 03991000, 03991012, 03991004];
function start() {
var text = "Hello there! I am the <insert purpose of NPC here> of <insert server name here>! To be able to proceed you need to have 1 piece of the following items:\r\n";
for (var i = 0; i < req.length; i++)
text += "\r\n#o"+req[i]+"#"; // I believe #o shows the Item image.
text += "Do you have those items?";
cm.sendYesNo(text);
}
function action(mode, type, selection) {
cm.dispose();
if (mode == 1) {
if (status == 0) {
for (var i = 0; i < req.length; i++) {
if (!cm.haveItem(req[i], 1) {
cm.dispose();
return;
}
}
cm.sendNext("Insert text here.");
} else if (status == 1) {
cm.sendOk("Blabla, thank you for your items.");
for (var i = 0; i < req.length; i++) {
cm.gainItem(req[i], -1);
}
cm.gainItem(1002553 , 1);
}
cm.dispose();
}
}
I really couldn't figure the purpose of your NPC so I made you one which I thought would server it. Do tell me if it needs some modification of any sort.