Some one can make me NPC please?
im need NPC seller some items :
potential scroll - 1M Mesos
Angelic Blessing - 5M Mesos
Mircale Cube - 500k Mesos
the other i will add
thanks who can make one for me!
Printable View
Some one can make me NPC please?
im need NPC seller some items :
potential scroll - 1M Mesos
Angelic Blessing - 5M Mesos
Mircale Cube - 500k Mesos
the other i will add
thanks who can make one for me!
Provide the ID's, what you want the NPC to say, and the NPC Name.
Script without defining the amount of item you wish to buy
Correct me If the usage of my multi-dimensional array is wrong.PHP Code:/* @Author: Hecari of RZ */
var status;
var itemAvailable = new Array([2049401, 1000000], [1112585, 5000000], [5062000, 500000]);
var serverName = "[insertyourservernamehere]";
// code is given in multi-dimensional array; [itemid, price]
function start() {
status = -1;
action(1,0,0);
}
function action(mode, type, selection) {
if(mode == -1) {
cm.dispose(); // somebody clicked endchat
} else {
if(mode == 1) {
status++;
} else {
status--;
}
}
if(status == 0) {
cm.sendNext("Hello #h #, I am the rare item seller of " + serverName + " .");
} else if(status == 1) {
for (var i = 0; i < itemAvailable.length; i++) {
text += "\r\n#L"+i+"##t"+itemAvailable[i][0]+"# #v"+itemAvailable[i][0]+"# for " + (itemAvailable[i][1]).toString() + " mesos #l";
}
cm.sendSimple(text);
} else if(status == 2) {
var price = itemAvailable[selection][1];
var item = itemAvailable[selection][0];
var item_String = item.toString(); //unsure whether the itemid need to be in string or not.
var quantity = 1; // for further usage if you want to add quantity by using cm.getText or cm.getNumber
if (cm.getMeso() >= price) {
cm.sendOk("You have received 1 #v" + item_String + "# #t" + item_String + "# for " + price.toString() + " mesos");
cm.gainMeso(-price);
cm.gainItem(item, quantity);
cm.dispose();
} else {
cm.sendOk("YOU DO NOT HAVE TEH CASHZ");
cm.dispose();
}
}
}
Disclaimer: I did not test the script since I'm lazy to even launch my test server.