Emistry icon

[RO] Exchanger - CP to Item - Random

Emistry | PRO | 12/30/16 09:36:50 AM UTC | 0 ⭐ | 717 👁️ | Never ⏰ | []
text |

730 B

|

None

|

0 👍

/

0 👎

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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎