Jump to content
  • 0

Seeking help in Wheel of Fortune Mac Address


BFPkiller

Question


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  111
  • Reputation:   2
  • Joined:  05/09/13
  • Last Seen:  

Hi there!

I'd like to ask some help regarding a script that i use.

It's the Wheel of Fortune script and i'd like to add a limit per use per ip, once a day.
Can someone help me out on that ?

Much appreciated!

-	script	Wheel_of_Fortune	FAKE_NPC ,{

OnInit:
	disablenpc("Wheel of Fortune#Main");
//	disablenpc("Hussein#WOF");
	.Eventname$ = "[Wheel Of Fortune]";
	end;

OnClock1500:
OnClock1630:
OnClock1900:
OnClock2200:

OnStart:
	.Start = true;
	announce(sprintf("%s : The event will begin in 1 minute, in the Secret Gambling Room.", .Eventname$), bc_blue | bc_all);
	initnpctimer();
	end;

OnTimer60000: // 1 min
	enablenpc("Wheel of Fortune#Main");
//	enablenpc("Hussein#WOF");
	announce(sprintf("%s : Come to Secret Gambling Room and test your luck", .Eventname$), bc_blue | bc_all);
	end;

OnTimer1800000: // 30 mins
	announce(sprintf("%s : One more minute, do your last spin!", .Eventname$), bc_blue | bc_all);
	end;

OnTimer1860000: // 31 mins
OnEndEvent:
	.Start = false;
        announce(sprintf("%s : The event is now over.", .Eventname$), bc_blue | bc_all);
	stopnpctimer();
	disablenpc("Wheel of Fortune#Main");
//	disablenpc("Hussein#WOF");
	end;

OnCommand:
	if (.@atcmd_numparameters != 1) {
		dispbottom(sprintf("Usage: %s <start/end>", .@atcmd_command$), 0x00FF00);
		dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		end;
	}

	if (.@atcmd_parameters$[0] == "start") {
		if (!.Start)
			donpcevent(sprintf("%s::OnStart", strnpcinfo(NPC_NAME)));
		else {
			dispbottom("The Wheel of Fortune has already started.", 0x00FF00);
			dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		}
	} else if (.@atcmd_parameters$[0] == "end") {
		if (.Start)
			donpcevent(sprintf("%s::OnEndEvent", strnpcinfo(NPC_NAME)));
		else {
			dispbottom("The Wheel of Fortune is not active.", 0x00FF00);
			dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		}
	} else {
		dispbottom(sprintf("Usage: %s <start/end>", .@atcmd_command$), 0x00FF00);
		dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
	}
	end;
}

vip_lounge,145,60,3	script	Wheel of Fortune#Main	2_SLOT_MACHINE,{
	
OnTalk:
	if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0) {
		mes(.Eventname$);
		mes("You are out of Zeny");
		mes("and have no more");
		mes("free spins. Come back");
		mes("next time for more!");
		close();
	}

	.@mes$ = (#freewheelfortunespin > 0) ? sprintf(", but you, my friend, have %d free spin%s!", #freewheelfortunespin, (#freewheelfortunespin == 1) ? "" : "s") : ".";
	cutin("aca_salim02", 2);
	addtimer(1, sprintf("%s::OnEndEvent", strnpcinfo(NPC_NAME)));
	mes(.Eventname$);
	mes("Do you want to spin the wheel?");
	mes(sprintf("It costs ^FF0000%d Zeny^000000 to play%s", .Zeny_Cost, .@mes$));
	next();

	while (true) {
		if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0)
			callsub(S_End);
		switch (select(
			(#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
			(Zeny >= .Zeny_Cost ) ? sprintf("Yes! Use Zeny. (costs %dz)", .Zeny_Cost) : "",
			"No (Leave)"
		)) {
		// pay with free spin
		case 1:
			if (#freewheelfortunespin > 0) {
				if ((#freewheelfortunespin -= 1) < 0)
					#freewheelfortunespin = 0;
				callsub(S_Spin);
			} else
				callsub(S_End);
			break;

		// Pay with zeny
		case 2:
			if (Zeny >= .Zeny_Cost) {
			    Zeny -= .Zeny_Cost;
				callsub(S_Spin);
			} else {
				cutin("aca_salim02", 2);
				mes(.Eventname$);
				mes("Awww, you don't have enough to gamble...");
				mes(" ");
				mes("Have you ever heard?");
				mes("'Money isn't all that matters' Got it?");
				mes("Byeeeeeeeeeeeeee ;)");
				callsub(S_End);
			}
			break;

		default:
			callsub(S_End);
		}
	}

// Wheel spin animation
S_Spin:
	.@Sector = rand(.Sector_Range[0], .Sector_Range[1]);
	.@Display = .@Sector * 2 - 1;
	.@Speed = .Spin_Speed;
	
	for (.@i = 0; .@i < .nbTurns; .@i++) {
		.@b = .Cutin_Range[0];
		while (.@b <= .Cutin_Range[1]) {
			cutin(sprintf("%s%d", .Cutin$, .@b), 4);
			sleep2(.@Speed);
			.@b++;
			.@Speed += 1; // not ++, because  you may want to adjust the stopping +1 +2 +3
		}
	}
	
	.@b = .Cutin_Range[0];
	while (.@b < .@Display) {
		cutin(sprintf("%s%d", .Cutin$, .@b), 4);
		sleep2(.@Speed);
		.@b++;
	}

	cutin(sprintf("%s%d", .Cutin$, .@b), 4);

	if (.Prize_ID[.@Sector] == -1) {
		// Free spin
		if (.Sound_Effects)
			soundeffect("wheel_jackpot.wav", 0);
		announce(sprintf("[%s] : Wow, %dx more Free spins!!!", .Eventname$, .Prize_Qty[.@Sector]), bc_blue | bc_self);
		#freewheelfortunespin = #freewheelfortunespin == 0 ? .Prize_Qty[.@Sector] : #freewheelfortunespin + .Prize_Qty[.@Sector];
	} else if (.Prize_ID[.@Sector] == 0) {
		// Nothing
		if (.Sound_Effects)
			soundeffect("wheel_lost.wav", 0);
		announce(sprintf("[%s] : Awwww, no luck in your gamble, more luck in love...", .Eventname$), bc_blue | bc_self);
	} else { 
		// Item
		if (.Sound_Effects)
			soundeffect("wheel_won.wav", 0);
		announce(sprintf("[%s] : %dx %s - enjoy your prize!", .Eventname$, .Prize_Qty[.@Sector], getitemname(.Prize_ID[.@Sector])), bc_blue | bc_self);
		getitem(.Prize_ID[.@Sector], .Prize_Qty[.@Sector]);
	}

	sleep2(1000);
	if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0) {
		mes(.Eventname$);
		mes("You are out of Zeny");
		mes("and have no more");
		mes("free spins. Come back");
		mes("next time for more!");
		close();
	}
	return;
	
S_End:
	close2();
OnEndEvent:
	cutin("", 255);
	end;
	
OnInit:
	.Eventname$ = "Wheel Of Fortune";

	bindatcmd("wof", "Wheel_of_Fortune::OnCommand", 99,  false);

	.Spin_Speed = 50; // What is the base spin speed? (ms)
	.nbTurns = 2; // How many times the arrow makes a complete turn, before entering the stopping routine
	.Zeny_Cost = 100000; // How much zeny does it cost for a spin?
	.Sound_Effects = true; // Enable sound effects? (true/false)

	// You must have a total of 10 prizes. DO NOT remove 0 or -1 from the array and do not
	// change their order.
	setarray(.Prize_ID[1], -1, 6046, 13277, 12187,   617,   607, 603,   604, 0,  23093);
	setarray(.Prize_Qty[1], 2,     1,     1,     1,     3,     3,     3,     3, 0,     1);

	// Don't touch below
	.Cutin$ = "WheelOfFortune_";
	setarray(.Sector_Range, 1, 10); // Sector range
	setarray(.Cutin_Range, 0, 19); // Cutin range
	end;
}

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

5 hours ago, BFPkiller said:

Hi there!

I'd like to ask some help regarding a script that i use.

It's the Wheel of Fortune script and i'd like to add a limit per use per ip, once a day.
Can someone help me out on that ?

Much appreciated!


-	script	Wheel_of_Fortune	FAKE_NPC ,{

OnInit:
	disablenpc("Wheel of Fortune#Main");
//	disablenpc("Hussein#WOF");
	.Eventname$ = "[Wheel Of Fortune]";
	end;

OnClock1500:
OnClock1630:
OnClock1900:
OnClock2200:

OnStart:
	.Start = true;
	announce(sprintf("%s : The event will begin in 1 minute, in the Secret Gambling Room.", .Eventname$), bc_blue | bc_all);
	initnpctimer();
	end;

OnTimer60000: // 1 min
	enablenpc("Wheel of Fortune#Main");
//	enablenpc("Hussein#WOF");
	announce(sprintf("%s : Come to Secret Gambling Room and test your luck", .Eventname$), bc_blue | bc_all);
	end;

OnTimer1800000: // 30 mins
	announce(sprintf("%s : One more minute, do your last spin!", .Eventname$), bc_blue | bc_all);
	end;

OnTimer1860000: // 31 mins
OnEndEvent:
	.Start = false;
        announce(sprintf("%s : The event is now over.", .Eventname$), bc_blue | bc_all);
	stopnpctimer();
	disablenpc("Wheel of Fortune#Main");
//	disablenpc("Hussein#WOF");
	end;

OnCommand:
	if (.@atcmd_numparameters != 1) {
		dispbottom(sprintf("Usage: %s <start/end>", .@atcmd_command$), 0x00FF00);
		dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		end;
	}

	if (.@atcmd_parameters$[0] == "start") {
		if (!.Start)
			donpcevent(sprintf("%s::OnStart", strnpcinfo(NPC_NAME)));
		else {
			dispbottom("The Wheel of Fortune has already started.", 0x00FF00);
			dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		}
	} else if (.@atcmd_parameters$[0] == "end") {
		if (.Start)
			donpcevent(sprintf("%s::OnEndEvent", strnpcinfo(NPC_NAME)));
		else {
			dispbottom("The Wheel of Fortune is not active.", 0x00FF00);
			dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		}
	} else {
		dispbottom(sprintf("Usage: %s <start/end>", .@atcmd_command$), 0x00FF00);
		dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
	}
	end;
}

vip_lounge,145,60,3	script	Wheel of Fortune#Main	2_SLOT_MACHINE,{
	
OnTalk:
	if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0) {
		mes(.Eventname$);
		mes("You are out of Zeny");
		mes("and have no more");
		mes("free spins. Come back");
		mes("next time for more!");
		close();
	}

	.@mes$ = (#freewheelfortunespin > 0) ? sprintf(", but you, my friend, have %d free spin%s!", #freewheelfortunespin, (#freewheelfortunespin == 1) ? "" : "s") : ".";
	cutin("aca_salim02", 2);
	addtimer(1, sprintf("%s::OnEndEvent", strnpcinfo(NPC_NAME)));
	mes(.Eventname$);
	mes("Do you want to spin the wheel?");
	mes(sprintf("It costs ^FF0000%d Zeny^000000 to play%s", .Zeny_Cost, .@mes$));
	next();

	while (true) {
		if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0)
			callsub(S_End);
		switch (select(
			(#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
			(Zeny >= .Zeny_Cost ) ? sprintf("Yes! Use Zeny. (costs %dz)", .Zeny_Cost) : "",
			"No (Leave)"
		)) {
		// pay with free spin
		case 1:
			if (#freewheelfortunespin > 0) {
				if ((#freewheelfortunespin -= 1) < 0)
					#freewheelfortunespin = 0;
				callsub(S_Spin);
			} else
				callsub(S_End);
			break;

		// Pay with zeny
		case 2:
			if (Zeny >= .Zeny_Cost) {
			    Zeny -= .Zeny_Cost;
				callsub(S_Spin);
			} else {
				cutin("aca_salim02", 2);
				mes(.Eventname$);
				mes("Awww, you don't have enough to gamble...");
				mes(" ");
				mes("Have you ever heard?");
				mes("'Money isn't all that matters' Got it?");
				mes("Byeeeeeeeeeeeeee ;)");
				callsub(S_End);
			}
			break;

		default:
			callsub(S_End);
		}
	}

// Wheel spin animation
S_Spin:
	.@Sector = rand(.Sector_Range[0], .Sector_Range[1]);
	.@Display = .@Sector * 2 - 1;
	.@Speed = .Spin_Speed;
	
	for (.@i = 0; .@i < .nbTurns; .@i++) {
		.@b = .Cutin_Range[0];
		while (.@b <= .Cutin_Range[1]) {
			cutin(sprintf("%s%d", .Cutin$, .@b), 4);
			sleep2(.@Speed);
			.@b++;
			.@Speed += 1; // not ++, because  you may want to adjust the stopping +1 +2 +3
		}
	}
	
	.@b = .Cutin_Range[0];
	while (.@b < .@Display) {
		cutin(sprintf("%s%d", .Cutin$, .@b), 4);
		sleep2(.@Speed);
		.@b++;
	}

	cutin(sprintf("%s%d", .Cutin$, .@b), 4);

	if (.Prize_ID[.@Sector] == -1) {
		// Free spin
		if (.Sound_Effects)
			soundeffect("wheel_jackpot.wav", 0);
		announce(sprintf("[%s] : Wow, %dx more Free spins!!!", .Eventname$, .Prize_Qty[.@Sector]), bc_blue | bc_self);
		#freewheelfortunespin = #freewheelfortunespin == 0 ? .Prize_Qty[.@Sector] : #freewheelfortunespin + .Prize_Qty[.@Sector];
	} else if (.Prize_ID[.@Sector] == 0) {
		// Nothing
		if (.Sound_Effects)
			soundeffect("wheel_lost.wav", 0);
		announce(sprintf("[%s] : Awwww, no luck in your gamble, more luck in love...", .Eventname$), bc_blue | bc_self);
	} else { 
		// Item
		if (.Sound_Effects)
			soundeffect("wheel_won.wav", 0);
		announce(sprintf("[%s] : %dx %s - enjoy your prize!", .Eventname$, .Prize_Qty[.@Sector], getitemname(.Prize_ID[.@Sector])), bc_blue | bc_self);
		getitem(.Prize_ID[.@Sector], .Prize_Qty[.@Sector]);
	}

	sleep2(1000);
	if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0) {
		mes(.Eventname$);
		mes("You are out of Zeny");
		mes("and have no more");
		mes("free spins. Come back");
		mes("next time for more!");
		close();
	}
	return;
	
S_End:
	close2();
OnEndEvent:
	cutin("", 255);
	end;
	
OnInit:
	.Eventname$ = "Wheel Of Fortune";

	bindatcmd("wof", "Wheel_of_Fortune::OnCommand", 99,  false);

	.Spin_Speed = 50; // What is the base spin speed? (ms)
	.nbTurns = 2; // How many times the arrow makes a complete turn, before entering the stopping routine
	.Zeny_Cost = 100000; // How much zeny does it cost for a spin?
	.Sound_Effects = true; // Enable sound effects? (true/false)

	// You must have a total of 10 prizes. DO NOT remove 0 or -1 from the array and do not
	// change their order.
	setarray(.Prize_ID[1], -1, 6046, 13277, 12187,   617,   607, 603,   604, 0,  23093);
	setarray(.Prize_Qty[1], 2,     1,     1,     1,     3,     3,     3,     3, 0,     1);

	// Don't touch below
	.Cutin$ = "WheelOfFortune_";
	setarray(.Sector_Range, 1, 10); // Sector range
	setarray(.Cutin_Range, 0, 19); // Cutin range
	end;
}

 

Not tested.

-	script	Wheel_of_Fortune	FAKE_NPC ,{

OnInit:
	disablenpc("Wheel of Fortune#Main");
//	disablenpc("Hussein#WOF");
	.Eventname$ = "[Wheel Of Fortune]";
	end;

OnClock1500:
OnClock1630:
OnClock1900:
OnClock2200:

OnStart:
	.Start = true;
	announce(sprintf("%s : The event will begin in 1 minute, in the Secret Gambling Room.", .Eventname$), bc_blue | bc_all);
	initnpctimer();
	end;

OnTimer60000: // 1 min
	enablenpc("Wheel of Fortune#Main");
//	enablenpc("Hussein#WOF");
	announce(sprintf("%s : Come to Secret Gambling Room and test your luck", .Eventname$), bc_blue | bc_all);
	end;

OnTimer1800000: // 30 mins
	announce(sprintf("%s : One more minute, do your last spin!", .Eventname$), bc_blue | bc_all);
	end;

OnTimer1860000: // 31 mins
OnEndEvent:
	.Start = false;
        announce(sprintf("%s : The event is now over.", .Eventname$), bc_blue | bc_all);
	stopnpctimer();
	disablenpc("Wheel of Fortune#Main");
//	disablenpc("Hussein#WOF");
	end;

OnCommand:
	if (.@atcmd_numparameters != 1) {
		dispbottom(sprintf("Usage: %s <start/end>", .@atcmd_command$), 0x00FF00);
		dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		end;
	}

	if (.@atcmd_parameters$[0] == "start") {
		if (!.Start)
			donpcevent(sprintf("%s::OnStart", strnpcinfo(NPC_NAME)));
		else {
			dispbottom("The Wheel of Fortune has already started.", 0x00FF00);
			dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		}
	} else if (.@atcmd_parameters$[0] == "end") {
		if (.Start)
			donpcevent(sprintf("%s::OnEndEvent", strnpcinfo(NPC_NAME)));
		else {
			dispbottom("The Wheel of Fortune is not active.", 0x00FF00);
			dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		}
	} else {
		dispbottom(sprintf("Usage: %s <start/end>", .@atcmd_command$), 0x00FF00);
		dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
	}
	end;
}

vip_lounge,145,60,3	script	Wheel of Fortune#Main	2_SLOT_MACHINE,{
	
OnTalk:
	.@today = atoi( gettimestr( "%Y%m%d", 9 ) );
	if ( $wof_today != .@today ) {
		$wof_today = .@today;
		deletearray $wof_charip$;
	}
	if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0) {
		mes(.Eventname$);
		mes("You are out of Zeny");
		mes("and have no more");
		mes("free spins. Come back");
		mes("next time for more!");
		close();
	}
	.@mes$ = (#freewheelfortunespin > 0) ? sprintf(", but you, my friend, have %d free spin%s!", #freewheelfortunespin, (#freewheelfortunespin == 1) ? "" : "s") : ".";
	cutin("aca_salim02", 2);
	addtimer(1, sprintf("%s::OnEndEvent", strnpcinfo(NPC_NAME)));
	mes(.Eventname$);
	mes("Do you want to spin the wheel?");
	mes(sprintf("It costs ^FF0000%d Zeny^000000 to play%s", .Zeny_Cost, .@mes$));
	next();

	while (true) {
		if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0)
			callsub(S_End);
		switch (select(
			(#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
			(Zeny >= .Zeny_Cost ) ? sprintf("Yes! Use Zeny. (costs %dz)", .Zeny_Cost) : "",
			"No (Leave)"
		)) {
		// pay with free spin
		case 1:
			if (#freewheelfortunespin > 0) {
				if ((#freewheelfortunespin -= 1) < 0)
					#freewheelfortunespin = 0;
				callsub(S_Spin);
			} else
				callsub(S_End);
			break;

		// Pay with zeny
		case 2:
			if (Zeny >= .Zeny_Cost) {
			    Zeny -= .Zeny_Cost;
				callsub(S_Spin);
			} else {
				cutin("aca_salim02", 2);
				mes(.Eventname$);
				mes("Awww, you don't have enough to gamble...");
				mes(" ");
				mes("Have you ever heard?");
				mes("'Money isn't all that matters' Got it?");
				mes("Byeeeeeeeeeeeeee ;)");
				callsub(S_End);
			}
			break;

		default:
			callsub(S_End);
		}
	}

// Wheel spin animation
S_Spin:
	.@Sector = rand(.Sector_Range[0], .Sector_Range[1]);
	.@Display = .@Sector * 2 - 1;
	.@Speed = .Spin_Speed;
	.@charip$ = getcharip();
	if ( countinarray($wof_charip$,.@charip$) ) {
		mes "You can only spin one IP per day.";
		close;
	} else
		$wof_charip$[getarraysize($wof_charip$)] = .@charip$;
	
	for (.@i = 0; .@i < .nbTurns; .@i++) {
		.@b = .Cutin_Range[0];
		while (.@b <= .Cutin_Range[1]) {
			cutin(sprintf("%s%d", .Cutin$, .@b), 4);
			sleep2(.@Speed);
			.@b++;
			.@Speed += 1; // not ++, because  you may want to adjust the stopping +1 +2 +3
		}
	}
	
	.@b = .Cutin_Range[0];
	while (.@b < .@Display) {
		cutin(sprintf("%s%d", .Cutin$, .@b), 4);
		sleep2(.@Speed);
		.@b++;
	}

	cutin(sprintf("%s%d", .Cutin$, .@b), 4);

	if (.Prize_ID[.@Sector] == -1) {
		// Free spin
		if (.Sound_Effects)
			soundeffect("wheel_jackpot.wav", 0);
		announce(sprintf("[%s] : Wow, %dx more Free spins!!!", .Eventname$, .Prize_Qty[.@Sector]), bc_blue | bc_self);
		#freewheelfortunespin = #freewheelfortunespin == 0 ? .Prize_Qty[.@Sector] : #freewheelfortunespin + .Prize_Qty[.@Sector];
	} else if (.Prize_ID[.@Sector] == 0) {
		// Nothing
		if (.Sound_Effects)
			soundeffect("wheel_lost.wav", 0);
		announce(sprintf("[%s] : Awwww, no luck in your gamble, more luck in love...", .Eventname$), bc_blue | bc_self);
	} else { 
		// Item
		if (.Sound_Effects)
			soundeffect("wheel_won.wav", 0);
		announce(sprintf("[%s] : %dx %s - enjoy your prize!", .Eventname$, .Prize_Qty[.@Sector], getitemname(.Prize_ID[.@Sector])), bc_blue | bc_self);
		getitem(.Prize_ID[.@Sector], .Prize_Qty[.@Sector]);
	}

	sleep2(1000);
	if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0) {
		mes(.Eventname$);
		mes("You are out of Zeny");
		mes("and have no more");
		mes("free spins. Come back");
		mes("next time for more!");
		close();
	}
	return;
	
S_End:
	close2();
OnEndEvent:
	cutin("", 255);
	end;
	
OnInit:
	.Eventname$ = "Wheel Of Fortune";

	bindatcmd("wof", "Wheel_of_Fortune::OnCommand", 99,  false);

	.Spin_Speed = 50; // What is the base spin speed? (ms)
	.nbTurns = 2; // How many times the arrow makes a complete turn, before entering the stopping routine
	.Zeny_Cost = 100000; // How much zeny does it cost for a spin?
	.Sound_Effects = true; // Enable sound effects? (true/false)

	// You must have a total of 10 prizes. DO NOT remove 0 or -1 from the array and do not
	// change their order.
	setarray(.Prize_ID[1], -1, 6046, 13277, 12187,   617,   607, 603,   604, 0,  23093);
	setarray(.Prize_Qty[1], 2,     1,     1,     1,     3,     3,     3,     3, 0,     1);

	// Don't touch below
	.Cutin$ = "WheelOfFortune_";
	setarray(.Sector_Range, 1, 10); // Sector range
	setarray(.Cutin_Range, 0, 19); // Cutin range
	end;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  111
  • Reputation:   2
  • Joined:  05/09/13
  • Last Seen:  

Many thanks on this !

Is it possible to add a checkweight as well ?

Thanks again!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  45
  • Reputation:   7
  • Joined:  11/07/14
  • Last Seen:  

On 11/28/2019 at 7:38 PM, Mabuhay said:

Not tested.


-	script	Wheel_of_Fortune	FAKE_NPC ,{

OnInit:
	disablenpc("Wheel of Fortune#Main");
//	disablenpc("Hussein#WOF");
	.Eventname$ = "[Wheel Of Fortune]";
	end;

OnClock1500:
OnClock1630:
OnClock1900:
OnClock2200:

OnStart:
	.Start = true;
	announce(sprintf("%s : The event will begin in 1 minute, in the Secret Gambling Room.", .Eventname$), bc_blue | bc_all);
	initnpctimer();
	end;

OnTimer60000: // 1 min
	enablenpc("Wheel of Fortune#Main");
//	enablenpc("Hussein#WOF");
	announce(sprintf("%s : Come to Secret Gambling Room and test your luck", .Eventname$), bc_blue | bc_all);
	end;

OnTimer1800000: // 30 mins
	announce(sprintf("%s : One more minute, do your last spin!", .Eventname$), bc_blue | bc_all);
	end;

OnTimer1860000: // 31 mins
OnEndEvent:
	.Start = false;
        announce(sprintf("%s : The event is now over.", .Eventname$), bc_blue | bc_all);
	stopnpctimer();
	disablenpc("Wheel of Fortune#Main");
//	disablenpc("Hussein#WOF");
	end;

OnCommand:
	if (.@atcmd_numparameters != 1) {
		dispbottom(sprintf("Usage: %s <start/end>", .@atcmd_command$), 0x00FF00);
		dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		end;
	}

	if (.@atcmd_parameters$[0] == "start") {
		if (!.Start)
			donpcevent(sprintf("%s::OnStart", strnpcinfo(NPC_NAME)));
		else {
			dispbottom("The Wheel of Fortune has already started.", 0x00FF00);
			dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		}
	} else if (.@atcmd_parameters$[0] == "end") {
		if (.Start)
			donpcevent(sprintf("%s::OnEndEvent", strnpcinfo(NPC_NAME)));
		else {
			dispbottom("The Wheel of Fortune is not active.", 0x00FF00);
			dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
		}
	} else {
		dispbottom(sprintf("Usage: %s <start/end>", .@atcmd_command$), 0x00FF00);
		dispbottom(sprintf("%s failed.", .@atcmd_command$), 0x00FF00);
	}
	end;
}

vip_lounge,145,60,3	script	Wheel of Fortune#Main	2_SLOT_MACHINE,{
	
OnTalk:
	.@today = atoi( gettimestr( "%Y%m%d", 9 ) );
	if ( $wof_today != .@today ) {
		$wof_today = .@today;
		deletearray $wof_charip$;
	}
	if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0) {
		mes(.Eventname$);
		mes("You are out of Zeny");
		mes("and have no more");
		mes("free spins. Come back");
		mes("next time for more!");
		close();
	}
	.@mes$ = (#freewheelfortunespin > 0) ? sprintf(", but you, my friend, have %d free spin%s!", #freewheelfortunespin, (#freewheelfortunespin == 1) ? "" : "s") : ".";
	cutin("aca_salim02", 2);
	addtimer(1, sprintf("%s::OnEndEvent", strnpcinfo(NPC_NAME)));
	mes(.Eventname$);
	mes("Do you want to spin the wheel?");
	mes(sprintf("It costs ^FF0000%d Zeny^000000 to play%s", .Zeny_Cost, .@mes$));
	next();

	while (true) {
		if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0)
			callsub(S_End);
		switch (select(
			(#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
			(Zeny >= .Zeny_Cost ) ? sprintf("Yes! Use Zeny. (costs %dz)", .Zeny_Cost) : "",
			"No (Leave)"
		)) {
		// pay with free spin
		case 1:
			if (#freewheelfortunespin > 0) {
				if ((#freewheelfortunespin -= 1) < 0)
					#freewheelfortunespin = 0;
				callsub(S_Spin);
			} else
				callsub(S_End);
			break;

		// Pay with zeny
		case 2:
			if (Zeny >= .Zeny_Cost) {
			    Zeny -= .Zeny_Cost;
				callsub(S_Spin);
			} else {
				cutin("aca_salim02", 2);
				mes(.Eventname$);
				mes("Awww, you don't have enough to gamble...");
				mes(" ");
				mes("Have you ever heard?");
				mes("'Money isn't all that matters' Got it?");
				mes("Byeeeeeeeeeeeeee ;)");
				callsub(S_End);
			}
			break;

		default:
			callsub(S_End);
		}
	}

// Wheel spin animation
S_Spin:
	.@Sector = rand(.Sector_Range[0], .Sector_Range[1]);
	.@Display = .@Sector * 2 - 1;
	.@Speed = .Spin_Speed;
	.@charip$ = getcharip();
	if ( countinarray($wof_charip$,.@charip$) ) {
		mes "You can only spin one IP per day.";
		close;
	} else
		$wof_charip$[getarraysize($wof_charip$)] = .@charip$;
	
	for (.@i = 0; .@i < .nbTurns; .@i++) {
		.@b = .Cutin_Range[0];
		while (.@b <= .Cutin_Range[1]) {
			cutin(sprintf("%s%d", .Cutin$, .@b), 4);
			sleep2(.@Speed);
			.@b++;
			.@Speed += 1; // not ++, because  you may want to adjust the stopping +1 +2 +3
		}
	}
	
	.@b = .Cutin_Range[0];
	while (.@b < .@Display) {
		cutin(sprintf("%s%d", .Cutin$, .@b), 4);
		sleep2(.@Speed);
		.@b++;
	}

	cutin(sprintf("%s%d", .Cutin$, .@b), 4);

	if (.Prize_ID[.@Sector] == -1) {
		// Free spin
		if (.Sound_Effects)
			soundeffect("wheel_jackpot.wav", 0);
		announce(sprintf("[%s] : Wow, %dx more Free spins!!!", .Eventname$, .Prize_Qty[.@Sector]), bc_blue | bc_self);
		#freewheelfortunespin = #freewheelfortunespin == 0 ? .Prize_Qty[.@Sector] : #freewheelfortunespin + .Prize_Qty[.@Sector];
	} else if (.Prize_ID[.@Sector] == 0) {
		// Nothing
		if (.Sound_Effects)
			soundeffect("wheel_lost.wav", 0);
		announce(sprintf("[%s] : Awwww, no luck in your gamble, more luck in love...", .Eventname$), bc_blue | bc_self);
	} else { 
		// Item
		if (.Sound_Effects)
			soundeffect("wheel_won.wav", 0);
		announce(sprintf("[%s] : %dx %s - enjoy your prize!", .Eventname$, .Prize_Qty[.@Sector], getitemname(.Prize_ID[.@Sector])), bc_blue | bc_self);
		getitem(.Prize_ID[.@Sector], .Prize_Qty[.@Sector]);
	}

	sleep2(1000);
	if (Zeny < .Zeny_Cost && #freewheelfortunespin < 0) {
		mes(.Eventname$);
		mes("You are out of Zeny");
		mes("and have no more");
		mes("free spins. Come back");
		mes("next time for more!");
		close();
	}
	return;
	
S_End:
	close2();
OnEndEvent:
	cutin("", 255);
	end;
	
OnInit:
	.Eventname$ = "Wheel Of Fortune";

	bindatcmd("wof", "Wheel_of_Fortune::OnCommand", 99,  false);

	.Spin_Speed = 50; // What is the base spin speed? (ms)
	.nbTurns = 2; // How many times the arrow makes a complete turn, before entering the stopping routine
	.Zeny_Cost = 100000; // How much zeny does it cost for a spin?
	.Sound_Effects = true; // Enable sound effects? (true/false)

	// You must have a total of 10 prizes. DO NOT remove 0 or -1 from the array and do not
	// change their order.
	setarray(.Prize_ID[1], -1, 6046, 13277, 12187,   617,   607, 603,   604, 0,  23093);
	setarray(.Prize_Qty[1], 2,     1,     1,     1,     3,     3,     3,     3, 0,     1);

	// Don't touch below
	.Cutin$ = "WheelOfFortune_";
	setarray(.Sector_Range, 1, 10); // Sector range
	setarray(.Cutin_Range, 0, 19); // Cutin range
	end;
}

 

Hi, we realized that when the players choose to play and it says they can only spin once it takes their 100,000z anyway. Do you think you could help us with that please? Also maybe use Mac Adress instead of ip. Thank you!

Kind Regards,

Sirique

Edit:

I fixed the zeny issue. If you ever come across this message maybe if you could help us with the mac adress it would be very much appreciated. Thank you. I'll try to figure it out on my end.

Edited by Sirique
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  111
  • Reputation:   2
  • Joined:  05/09/13
  • Last Seen:  

can anyone help on this ?

Sorry to Bump , but haven't gotten it fixed yet.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...