Jump to content
  • 0

Help Ticket Gambler


Elysium

Question


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

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

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

https://pastebin.com/f4hQEXX2

you didnt add the announcement at the part it get the reward.

  • Upvote 1
Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

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

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

Thank you for the response but still didn't work.

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

Please explain to me what the script should do normally?

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  145
  • Reputation:   1
  • Joined:  04/03/17
  • Last Seen:  

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