Guest User

eaeaa

a guest
Sep 18th, 2022
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. command /shop:
  2. trigger:
  3. if player is in world "eternalgens":
  4. shop(player)
  5. else:
  6. send "&cGo into gens to do this!" to player
  7.  
  8.  
  9.  
  10.  
  11. on inventory click:
  12. if name of player's current inventory contains "&a&l&nShop":
  13. cancel event
  14. if clicked inventory != player's inventory:
  15. if index of event-slot = 9:
  16. shopGens(player)
  17. stop
  18. if index of event-slot = 10:
  19. shopBlocks(player)
  20. stop
  21. if name of player's current inventory contains "&a&l&nBuy Gens" or "&a&l&nBuy Blocks!":
  22. cancel event
  23. if clicked inventory != player's inventory:
  24. if clicked slot != air:
  25. set {_cost} to uncolored line 1 of lore of event-slot
  26. replace all "Cost: $" with "" in {_cost}
  27. replace all "k" with "" in {_cost}
  28. set {_cost} to ({_cost} parsed as integer)
  29. if player's balance >= {_cost}:
  30. remove {_cost} from player's balance
  31. set {_type} to type of event-slot
  32. delete line 1 of lore of {_type}
  33. give player {_type} named name of event-slot
  34. send "&aYou have bought a %name of event-slot%"
  35. else:
  36. close player's inventory
  37. send "&cYou dont have enough money!"
  38.  
  39.  
  40.  
  41. function shopGens(P: player):
  42. open chest inventory with 6 rows named "&a&l&nBuy Gens" to {_P}
  43. add coarse dirt named "<##9a5f00>&lDead Bush Gen" with lore "&bCost: &2$&a100" and "&2$&a5 &cper Drop" to {_gens::*}
  44. add hay bale named "&e&lWheat Gen" with lore "&bCost: &2$&a750" and "&2$&a10 &cper Drop" to {_gens::*}
  45. add melon block named "&a&lMelon &c&lGen" with lore "&bCost: &2$&a8.5k" and "&2$&a22 &cper Drop" to {_gens::*}
  46. add brown mushroom block named "<##fbb495>&lBrown Mushroom Gen" with lore "&bCost: &2$&a72.5k" and "&2$&a37 &cper Drop" to {_gens::*}
  47. add red mushroom block named "<##ff5858>&lRed Mushroom Gen" with lore "&bCost: &2$&a450k" and "&2$&a60 &cper Drop" to {_gens::*}
  48.  
  49. set {_var} to -1
  50. loop {_gens::*}:
  51. add 1 to {_var}
  52. set slot {_var} of {_P}'s current inventory to loop-value
  53.  
  54. function shopBlocks(P: player):
  55. open chest inventory with 6 rows named "&a&l&nBuy Blocks!" to {_P}
  56. add dirt named "<##9a5f00>&lDirt" with lore "&bCost: &2$&a1" to {_blocks::*}
  57. add oak log named "&f&lOak Log" with lore "&bCost: &2$&a2" to {_blocks::*}
  58. add spruce log named "&f&lSpruce Log" with lore "&bCost: &2$&a2" to {_blocks::*}
  59. add birch log named "&f&lBirch Log" with lore "&bCost: &2$&a2" to {_blocks::*}
  60. add jungle log named "&f&lJungle Log" with lore "&bCost: &2$&a2" to {_blocks::*}
  61. add soul sand named "&f&lSoul Sand" with lore "&bCost: &2$&a5" to {_blocks::*}
  62. add magma block named "&f&lMagma Block" with lore "&bCost: &2$&a5" to {_blocks::*}
  63. add diorite named "&f&lDiorite" with lore "&bCost: &2$&a2" to {_blocks::*}
  64. add stone named "&f&lStone" with lore "&bCost: &2$&a2" to {_blocks::*}
  65. add cobblestone named "&f&lCobblestone" with lore "&bCost: &2$&a2" to {_blocks::*}
  66. add grass block named "&f&lGrass Block" with lore "&bCost: &2$&a1" to {_blocks::*}
  67. add water bucket named "&f&lWater Bucket" with lore "&bCost: &2$&a100" to {_blocks::*}
  68. add lava bucket named "&f&lLava Bucket" with lore "&bCost: &2$&a100" to {_blocks::*}
  69. add amethyst block named "&f&lAmethyst Block" with lore "&bCost: &2$&a3" to {_blocks::*}
  70.  
  71. set {_var} to -1
  72. loop {_blocks::*}:
  73. add 1 to {_var}
  74. set slot {_var} of {_P}'s current inventory to loop-value
  75.  
  76.  
  77. function shop(P: player):
  78. open chest inventory with 3 rows named "&a&l&nShop" to {_P}
  79. set slot integers between 0 and 8 of {_P}'s current inventory to black stained glass pane named "&f"
  80. set slot integers between 18 and 27 of {_P}'s current inventory to black stained glass pane named "&f"
  81. set slot 9 of {_P}'s current inventory to hay bale named "&e&lBuy Gens!"
  82. set slot 10 of {_P}'s current inventory to grass block named "&a&lBuy Blocks!"
  83.  
  84.  
Advertisement
Add Comment
Please, Sign In to add comment