- Joined
- May 29, 2008
- Messages
- 258
- Reaction score
- 0
Ok so heres a simple npc script that sells chairs
PHP:
//Kippieeej for the base of the script,Brianobb For editing it to this function
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendSimple("Hello #h #, Welcome to #rSaphireMs#k\r\nWould you like to buy a chair\r\n \r\nWhich Chair would you like \r\n#L1##bBuy a #v3010002##k#l \r\n \r\n#L2##bBuy 1 #v3010008# #k#l \r\n \r\n#L3##bBuy 1 #v3010012##l \r\n \r\n#L4##bBuy 1 #v3010014# #l \r\n \r\n#L5##bBuy 1 #v3010007##l \r\n \r\n#L6##bBuy 1 #v3011000# #l");
//cm.dispose();
} else if (status == 1) {
if (selection == 1) {
if (cm.itemQuantity(5200002) >= 50) {
cm.sendOk(" I Think you have enough #v5200002# saved up, try spending some of your mesos, and cashing in a few #v5200002# before you buy more.");
cm.dispose();
} else if (cm.getMeso() >= 100) {
cm.gainMeso(-100);
cm.gainItem(3010002, 1);
cm.dispose();
} else {
cm.sendOk("You don't have enough #bMesos#k, are you trying to #eScam#k me!?");
cm.dispose();
}
} else if (selection == 2) {
if (cm.itemQuantity(5200000) >= 50) {
cm.sendOk(" I Think you have enough #v5200001# saved up, try spending some of your mesos, and cashing in a few #v5200001# before you buy more.");
cm.dispose();
} else if (cm.getMeso() >= 100) {
cm.gainMeso(-100);
cm.gainItem(3010008, 1);
cm.dispose();
} else {
cm.sendOk("You don't have enough #bMesos#k, are you trying to #eScam#k me!?");
cm.dispose();
}
} else if (selection == 3) {
if (cm.itemQuantity(5200000) >= 50) {
cm.sendOk(" I Think you have enough #v5200001# saved up, try spending some of your mesos, and cashing in a few #v5200001# before you buy more.");
cm.dispose();
} else if (cm.getMeso() >= 100) {
cm.gainMeso(-100);
cm.gainItem(3010012, 1);
cm.dispose();
}
} else if (selection == 4) {
if (cm.itemQuantity(5200000) >= 50) {
cm.sendOk(" I Think you have enough #v5200001# saved up, try spending some of your mesos, and cashing in a few #v5200001# before you buy more.");
cm.dispose();
} else if (cm.getMeso() >= 100) {
cm.gainMeso(-100);
cm.gainItem(3010014, 1);
cm.dispose();
}
} else if (selection == 5) {
if (cm.itemQuantity(5200000) >= 50) {
cm.sendOk(" I Think you have enough #v5200000# saved up, try spending some of your mesos, and cashing in a few #v5200000# before you buy more.");
cm.dispose();
} else if (cm.getMeso() >= 100) {
cm.gainMeso(-100);
cm.gainItem(3010007, 1);
cm.dispose();
}
} else if (selection == 6) {
if (cm.itemQuantity(5200000) >= 50) {
cm.sendOk(" I Think you have enough #v5200000# saved up, try spending some of your mesos, and cashing in a few #v5200000# before you buy more.");
cm.dispose();
} else if (cm.getMeso() >= 100) {
cm.gainMeso(-100);
cm.gainItem(3011000, 1);
cm.dispose();
}
}
}
}
}
![brianobb - [Release]Chair Vendor - RaGEZONE Forums brianobb - [Release]Chair Vendor - RaGEZONE Forums](http://i197.photobucket.com/albums/aa156/brianobb/Maple0003-1.jpg)
![brianobb - [Release]Chair Vendor - RaGEZONE Forums brianobb - [Release]Chair Vendor - RaGEZONE Forums](http://i197.photobucket.com/albums/aa156/brianobb/Maple0004-1.jpg)
Last edited: