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;
}