prontera,155,181,5 script Sample#cp_rand_item 757,{
mes "Pay CP and get random items.";
mes .cash + " CP per round";
while ( #CASHPOINTS >= .cash ) {
if ( select( "Pay","Cancel" ) == 2 ) break;
#CASHPOINTS -= .cash;
do {
.@index = rand( .item_size );
} while( rand( .total_rate ) > .rate[.@index] );
getitem .item[.@index],1;
announce "<Random Item> '"+strcharinfo(0)+"' gained "+getitemname( .item[.@index] )+" at "+.rate[.@index]+"%. Gratz.",bc_all;
}
close;
OnInit:
.cash = 10;
setarray .item,501,502,503,504,505,506,507;
setarray .rate, 10, 10, 20, 30, 30, 40, 50;
.item_size = getarraysize( .item );
for ( .@i = 0; .@i < .item_size; .@i++ )
.total_rate += .rate[.@i];
end;
}
Comments
0 B
|👍
/👎