• 0
Elysium

Help Ticket Gambler

Question

Hi, i was wondering what's wrong with the script? i tested it a couple of times somethings going that i couldn't figure it out can i have some a little assistance on the script please.
Problem: variable .GlobalMessage doesn't show up properly looks like it announces a random items instead of only 1 .set

prontera,164,173,3	script	Ticket Gambling	562,{
	mes .n$;
	for( .@j = 0; .@j < getarraysize(.item); .@j++ ) {
		mes .qnt[.@j] +"x "+ Itemlink(.item[.@j ]) +"";
    }
	next;
	mes .n$;
	mes "Would you like to insert a Ticket now?";
	next;
	if( select("- Insert Ticket:- Cancel") == 2 ) {
		mes .n$;
		mes " ";
		close;
	}
	if( countitem(7608) >= 1 ) {
		mes .n$;
		mes "^0000FF*You insert the Promotion Ticket into the Machine slot and watch as she pulls the Ticket automatically*^000000";
		next;
		mes .n$;
		mes "This is great! This will be very useful.";
		delitem 7608,1;
		for( .@i = 0; .@i < getarraysize(.item); .@i++ ) {
			if( rand(1,100) <= .chance[.@i] ) {
				if( .item[.@i] == .GlobalMessage ) {
			}
			getitem .item[.@i],.qnt[.@i];
			.@reward = 1;
			mes ""+.qnt[.@i]+" x "+Itemlink(.item[.@i])+"";
			end;
		}
	}
	if( !.@reward ) {
		.@i = rand(getarraysize(.item));
		if( .item[.@i] == .GlobalMessage ) {
			announce "Player "+ strcharinfo(0) +" obtaining "+ .qnt[.@i] +" x "+ getitemname(.item[.@i]) +".",0;
		}
		getitem .item[.@i], .qnt[.@i];
		end;
	}
	else {
		mes "You must have ^008800Premium Ticket^000000 to receive one of the items.";
		close;
	}
}

OnInit:
	.n$ = "[ Ticket Gambling ]";
	// Array of items, quantity and chance.
	// Chance 1 = 0.01
	setarray .item[0],		30029,	12412,	12915,	12903,	12904,	12908,	12905,	12906,	12907,	12912,	13858,	13588,	12210,	12709,	12710,	13718,	13750,	13756,	13714,	13711,	7608; 
	setarray .qnt[0],		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		5,		1,		1,		1,		20,		5,		1,		1,		1,		1;
	setarray .chance[0], 	50,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		3,		3,		3,		3,		5,		5,		10,		10;

	// Send a Global Message to everyone online when win item with id
	.GlobalMessage = 7608;
	end;
}

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • -1
On 9/16/2018 at 12:22 AM, Elysium said:

.@i = rand(getarraysize(.item));

if( .item[.@i] == .GlobalMessage ) {

announce "Player "+ strcharinfo(0) +" obtaining "+ .qnt[.@i] +" x "+ getitemname(.item[.@i]) +".",0;

}

getitem .item[.@i], .qnt[.@i];

Edit that rand() line?

Share this post


Link to post
Share on other sites
  • -1
On 9/25/2018 at 6:19 AM, Hyroshima said:

Please explain to me what the script should do normally?

yes please , is there any one can explain about this nice script?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now