Advertisement
Emistry

[RO] Exchange NPC - Items to Box

Feb 2nd, 2017
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1.  
  2.  
  3. prontera,155,181,5 script Sample#box_exchange 4_F_KAFRA1,{
  4. function func_AddBox;
  5.  
  6. mes "What items you want to pack into boxes?";
  7. next;
  8. .@i = select( .box_menu$ ) - 1;
  9. mes "Item Box - "+getitemname( .box_nameid[.@i] );
  10. mes "Required Item - "+.amount[.@i]+"x "+getitemname( .nameid[.@i] );
  11. if ( .zeny[.@i] )
  12. mes "Required Zeny - "+F_InsertComma( .zeny[.@i] );
  13. if ( ( .zeny[.@i] > 0 && Zeny < .zeny[.@i] ) || ( countitem( .nameid[.@i] ) < .amount[.@i] ) )
  14. .@fail++;
  15. if ( !.@fail )
  16. if ( select( "Exchange","Cancel" ) == 1 ) {
  17. if ( .zeny[.@i] > 0 )
  18. Zeny -= .zeny[.@i];
  19. delitem .nameid[.@i],.amount[.@i];
  20. getitem .box_nameid[.@i],1;
  21. mes "Done.";
  22. }
  23. close;
  24.  
  25. function func_AddBox {
  26. .@box_nameid = getarg(0,0);
  27. .@zeny = getarg(1,0);
  28. .@nameid = getarg(2,0);
  29. .@amount = getarg(3,0);
  30.  
  31. if ( .@box_nameid && .@nameid && .@amount > 0 && .@zeny >= 0 ) {
  32. .box_nameid[.box_nameid_size] = .@box_nameid;
  33. .zeny[.box_nameid_size] = .@zeny;
  34. .nameid[.box_nameid_size] = .@nameid;
  35. .amount[.box_nameid_size] = .@amount;
  36. .box_nameid_size++;
  37.  
  38. .box_menu$ = .box_menu$ + getitemname( .@box_nameid ) + ":";
  39. debugmes "Added "+getitemname( .@box_nameid );
  40. }
  41.  
  42. return;
  43. }
  44.  
  45. OnInit:
  46. // AddBox( <box_nameid>,<zeny_cost>,<item_id>,<amount> );
  47. func_AddBox( 512,1000000,511,1 );
  48. end;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement