Guest User

Untitled

a guest
Jul 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. prontera,140,169,5 script Hourly Points Shop 405,{
  2. if(getgmlevel() >= 60) {
  3. mes "[ Hourly Points Shop ]";
  4. mes "Hello "+strcharinfo(0);
  5. mes "Do you want to exchange your Hourly Points to items in this shop?";
  6. menu "Yes, please.",Normalmenu;
  7. end;
  8. }
  9.  
  10. Normalmenu:
  11. callshop "Donator_SHOP#02",1;
  12. npcshopattach "Donator_SHOP#02";
  13. message strcharinfo(0),"You currently have ["+#KAFRAPOINTS+"] Hourly Points.";
  14. end;
  15.  
  16. OnBuyItem:
  17. for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
  18. for(set @j,0; @j < getarraysize(.POD_ITEMS); set @j,@j+2) {
  19. if(.POD_ITEMS[@j] == @bought_nameid[@i]) {
  20. set @itemcost,(.POD_ITEMS[(@j+1)]*@bought_quantity[@i]);
  21. set @totalcost,(@totalcost+@itemcost);
  22. break;
  23. }
  24. }
  25. }
  26. if(@totalcost > #KAFRAPOINTS) {
  27. message strcharinfo(0),"You don't have enough Hourly Points.";
  28. } else {
  29. for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
  30. getitem @bought_nameid[@i],@bought_quantity[@i];
  31. }
  32. set #KAFRAPOINTS,#KAFRAPOINTS-@totalcost;
  33. //delitem .pod_item,@totalcost;
  34. message strcharinfo(0),"You now have ["+#KAFRAPOINTS+"] Hourly Points left.";
  35. }
  36. set @totalcost,0;
  37. deletearray @bought_nameid[0],128;
  38. deletearray @bought_quantity[0],128;
  39. end;
  40.  
  41. OnInit:
  42. npcshopdelitem "Donator_SHOP#02",909;
  43. set .name$,"^9933FF[ Hourly Points Trader ]^000000";
  44. setarray .POD_ITEMS
  45.  
  46. [0],13517::15,30110::15,30021::1000,30004::1000,7086::3000,7077::3000,7078::3000,7079::3000,7088::3000,7089::3000,7090::3000,7091::3000,7092::3000,; // Input as many
  47.  
  48. items as you want (item::price)
  49.  
  50. for(set .@i,0; .@i < getarraysize(.POD_ITEMS); set .@i,.@i+2) {
  51. npcshopadditem "Donator_SHOP#02",.POD_ITEMS[.@i],.POD_ITEMS[(.@i+1)];
  52. }
  53. }
  54.  
  55. - shop Donator_SHOP#02 139,909:10
Add Comment
Please, Sign In to add comment