Welcome!

Join our community of MMORPG enthusiasts and private server developers! By registering, you'll gain access to in-depth discussions on source codes, binaries, and the latest developments in MMORPG server files. Collaborate with like-minded individuals, explore tutorials, and share insights on building and optimizing private servers. Join us today and unlock the full potential of MMORPG server development!

Join Today!

Can someone tell me what's wrong with this script?

Junior Spellweaver
Joined
May 16, 2012
Messages
116
Reaction score
2
Location
Planet Earth
PASTE BIN :

or

THE CODE
Code:
 /*
 
 @Author Kyodia
 * NPC for : DRAZELMS
 * Purpose : Event Trophy Trade-In

 */

var yes1 = "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"
var yes2 = "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k"
var no = "I'm not sure you have the items needed!"
var status;
 
function start() {
	status = -1;
	action(1, 0, 0);
}

function action(m, t, s) {
	if (mode == 1) {
		status++;
		}else{
		status--;
		}
		if (status == 0) {
			cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l"); 
		}else if (status == 1) {
			if (selection == 0) {
			if (cm.haveItem(4000038, 1)) {
				cm.sendOk(yes1);
				cm.gainNX(10000);
				cm.dispose();
			}else{
				cm.sendOk(no);
				cm.dispose();
		}else if (selection == 1) {
			if (cm.haveItem(4000038, 2)) {
				cm.sendOk(yes2);
				cm.gainNX(22500);
				cm.dispose();
			}else{
				cm.sendOk(no);
				cm.dispose();
				}
			}
		}
	}
}


Thanks,
-Jonathan
 
Here you are...

PHP:
 /*
 
 @Author Kyodia
 * NPC for : DRAZELMS
 * Purpose : Event Trophy Trade-In

 */

var yes1 = "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"; // Missing semicolon or ;
var yes2 = "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k"; // Same as above
var no = "I'm not sure you have the items needed!"; // Same as above
var status;
 
function start() {
	status = -1;
	action(1, 0, 0);
}

function action(m, t, s) {
	if (mode == 1) {
		status++;
	}else{
		status--;
	}
	if (status == 0) {
		cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l"); 
	} else if (status == 1) {
		if (selection == 0) {
			if (cm.haveItem(4000038, 1)) {
				cm.sendOk(yes1);
				cm.gainItem(4000038, -1); // Just assuming you want it to take away the item
				cm.gainNX(10000);
				cm.dispose();
			} else {
				cm.sendOk(no);
				cm.dispose();
			} // Missing closing bracket for else statement
		} else if (selection == 1) {
			if (cm.haveItem(4000038, 2)) {
				cm.sendOk(yes2);
				cm.gainItem(4000038, -2); // Assuming you want to remove the item
				cm.gainNX(22500);
				cm.dispose();
			} else {
				cm.sendOk(no);
				cm.dispose();
			}
		}
	}
}
// } <- Unnecessary or just not correctly placed
 
Upvote 0
^ That won't work.

PHP:
/*
 
 @Author Kyodia
 * NPC for : DRAZELMS
 * Purpose : Event Trophy Trade-In

 */

var yes1 = "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"; //idem
var yes2 = "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k";
var no = "I'm not sure you have the items needed!";
var status;
 
function start() {
	status = -1;
	action(1, 0, 0);
}

function action(m, t, s) { //You defined Mode, Type and Selection as m, t and s. 
	status++;
	if (m != 1) {
		cm.dispose();
		return;
	}
	if (status == 0) {
		cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l"); 
	} else if (status == 1) {
		if (s == 0) {
			if (cm.haveItem(4000038, 1)) {
				cm.gainItem(4000038, -1);
				cm.sendOk(yes1);
				cm.gainNX(10000);
			} else {
				cm.sendOk(no);
			}
		} else if (s == 1) {
			if (cm.haveItem(4000038, 2)) {
				cm.gainItem(4000038, -2);
				cm.sendOk(yes2);
				cm.gainNX(22500);
			} else {
				cm.sendOk(no);
			}
		}
		cm.dispose(); //One general dispose has the same effect.
		//Fixed your syntax
	}
}
 
Last edited:
Upvote 0
Back