Advertisement
Emistry

[RO] Exchanger - CP to Item - Random

Dec 30th, 2016
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. prontera,155,181,5 script Sample#cp_rand_item 757,{
  2.  
  3. mes "Pay CP and get random items.";
  4. mes .cash + " CP per round";
  5. while ( #CASHPOINTS >= .cash ) {
  6. if ( select( "Pay","Cancel" ) == 2 ) break;
  7. #CASHPOINTS -= .cash;
  8. do {
  9. .@index = rand( .item_size );
  10. } while( rand( .total_rate ) > .rate[.@index] );
  11. getitem .item[.@index],1;
  12. announce "<Random Item> '"+strcharinfo(0)+"' gained "+getitemname( .item[.@index] )+" at "+.rate[.@index]+"%. Gratz.",bc_all;
  13. }
  14. close;
  15.  
  16. OnInit:
  17. .cash = 10;
  18. setarray .item,501,502,503,504,505,506,507;
  19. setarray .rate, 10, 10, 20, 30, 30, 40, 50;
  20.  
  21. .item_size = getarraysize( .item );
  22. for ( .@i = 0; .@i < .item_size; .@i++ )
  23. .total_rate += .rate[.@i];
  24. end;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement