- Joined
- Aug 5, 2009
- Messages
- 1,400
- Reaction score
- 163
doesnt work for me
but i think i did something wrong >_>
Did you edit ItemID ? and the Prizes?
doesnt work for me
but i think i did something wrong >_>
yeah lolDid you edit ItemID ? and the Prizes?
/**
Gift Box NPC
Based off of Gachapon
Coded by: bboy242 of RageZone aka Shawn with help from X-Tasis aka Osiris
Special Thanks: X-Tasis aka Osiris for attempting to teach me randoms and arrays better xD
**/
var status;
var boxes = [4000422, 4000423, 4000424, 4000425, 4031168, 4031169]; // Boxes to choose from
var prize = [[4000000, 4000001, 4000002, 4000003, 4000004, 4000005], [2049**** 2049**** 4031545, 4031545], [4031545, 1112000]]; // Add your prizes here
var rand = Math.floor(Math.random()*100);
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
}else{
if (status >= 5 && mode == 0) {
cm.sendOk("See you next time!.");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}else{
status--;
}
if (status == 0) {
if (cm.haveItem("4031545", 1)) { // You choose what item.
cm.gainItem("4031545", -1); // You choose what item, same as above
cm.sendNext("Step right up and test your luck. See if you can win an amazing prize by guessing the correct box!");
}else{
cm.sendOk("You don't have the right item.");
cm.dispose();
}
} else if (status == 1) {
cm.sendNext("Do you feel lucky?");
} else if (status == 2) {
for(var i = 0, text = "Choose one of the prize below.\r\n\r\n"; i < boxes.length; text += "\t\t#L" + i + "##i" + boxes[i] + "##l" + ((i+1) % 2 == 0 ? "\r\n" : ""), i++);
cm.sendSimple(text);
} else if (status == 3) {
cm.sendYesNo("Do you want to choose #i" + boxes[selection] + "#?");
} else if (status == 4) {
var rand2;
if ((rand >= 1) && (rand <= 50)) {
rand2 = Math.floor(Math.random() * prize[0].length);
} else if ((rand >= 51) && (rand <= 90)) {
rand2 = Math.floor(Math.random() * prize[1].length);
}else{
rand2 = Math.floor(Math.random() * prize[2].length);
}
cm.gainItem([rand >= 1 && rand <= 50 ? prize[0][rand2] : rand >= 51 && rand <= 90 ? prize[1][rand2] : prize[2][rand2]]);
cm.sendOk("You have won a #v" + [rand >= 1 && rand <= 50 ? prize[0][rand2] : rand >= 51 && rand <= 90 ? prize[1][rand2] : prize[2][rand2]] + "#");
cm.dispose();
}
}
}
not working for me lol
not working for me lol

i did not edit anything but it says it is an uncode npc when i add in my server
cm.gainItem((rand >= 1 && rand <= 50 ? prize[0][rand2] : rand >= 51 && rand <= 90 ? prize[1][rand2] : prize[2][rand2]));
cm.sendOk("You have won a #v" + (rand >= 1 && rand <= 50 ? prize[0][rand2] : rand >= 51 && rand <= 90 ? prize[1][rand2] : prize[2][rand2]) + "#");
cm.dispose();
PHP:cm.gainItem((rand >= 1 && rand <= 50 ? prize[0][rand2] : rand >= 51 && rand <= 90 ? prize[1][rand2] : prize[2][rand2])); cm.sendOk("You have won a #v" + (rand >= 1 && rand <= 50 ? prize[0][rand2] : rand >= 51 && rand <= 90 ? prize[1][rand2] : prize[2][rand2]) + "#"); cm.dispose();
what file format should i save it as?