Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 34441

DC when i try to use the NPC

$
0
0
Hi guys i am new to NPC scripting but i know Java, well i have created an NPC :

Code:

var saddle = Array(3010001, 3010002, 3010003, 3010004, 3010005, 3010006, 3010007, 3010008, 3010009, 3010010, 3010011, 3010012, 3010013, 3010014, 3010179, 3010180, 3010181, 3010015, 3010016, 3010017, 3010018, 3010019, 3010020, 3010021, 3010022, 3010023, 3010024, 3010025, 3010026, 3010027, 3010028, 3010029, 3010030, 3010031, 3010032, 3010033, 3010034, 3010035, 3010036, 3010037, 3010038, 3010039, 3010040, 3010041, 3010043, 3010044, 3010045, 3010046, 3010047, 3010048, 3010049, 3010050, 3010051, 3010052, 3010053, 3010054, 3010055, 3010056, 3010057, 3010058, 3010059, 3010060, 3010061, 3010062, 3010063, 3010066, 3010067, 3010068, 3010070, 3010071, 3010072, 3010073, 3010074, 3010075, 3010077, 3010078, 3010079, 3010080, 3010081, 3010082, 3010083, 3010083, 3010084, 3010085, 3010086, 3010087, 3010088, 3010089, 3010091, 3010092, 3010093, 3010094, 3010095, 3010096, 3010097, 3010098, 3010099, 3010100, 3010101, 3010102, 3010103, 3010104, 3010106, 3010109, 3010110, 3010112, 3010111, 3010113, 3010119, 3010121, 3010122, 3010123, 3010124, 3010125, 3010135, 3010136, 3010139, 3010140, 3010141, 3010142, 3010144, 3010145, 3010147, 3010148, 3010149, 3010150, 3010153, 3010157, 3010159, 3010164, 3010163, 3010162, 3010166, 3010169, 3010171, 3010173, 3010174, 3010175);
var price = 2000000;
var text = "#eHey I'm selling New Chairs\r\n buy one:";
for(var t = 0; t < saddle.length ;t++)
text +="\r\n#L"+t+"##v"+saddle[t]+"# for "+price+" #rMesos#k#l";
var i;
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) {
                        cm.sendOk("Have a nice day...");
                        cm.dispose();
                        return;
                }
        }
       
        if (mode == 1) {
                status++;
        } else {
                status--;
        }
       
        if (status == 0) {
                cm.sendNext(text);
        } else if (status == 1) {
                i = selection;
                cm.sendYesNo("Are you sure you want to buy #v"+saddle[i]+"# for "+price+" #rMesos");
        } else if (status == 2) {
                if(cm.getMeso() >= price) {
                cm.gainMeso(-price);
                cm.gainItem(saddle[i], 1);
                cm.sendOk("#eHave fun.");
                cm.dispose();
                return;
        } else {
                cm.sendOk("#eYou have not enough #rMesos#k");
                cm.dispose();
                return;
        }
        }
}

well after i click the NPC i get a DC if some one can fix the problem or is there any syntax error...

p.s
This NPC gives a ver 140 items when the actual server is on ver 62 but i've added the WZ files to my directory...

Viewing all articles
Browse latest Browse all 34441

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>