Jump to content
  • 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;
}

 

Link to comment
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?

Link to comment
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?

 

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...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.