yozora_1202

Untitled

Jun 29th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. options:
  2. PermMsg: &cYou need the permission : &6
  3. Perm: backpack.create
  4. Perm2: backpack.delete
  5.  
  6. on load:
  7. if {backpack.id} isn't set:
  8. set {backpack.id} to 0
  9.  
  10. on rightclick with a chest:
  11. loop {backpack.id} times:
  12. add 1 to {_loop}
  13. if name of player's held item is "%{backpack.%{_loop}%.name}%":
  14. cancel event
  15. open chest with {backpack.%{_loop}%.columns} rows named "%{backpack.%{_loop}%.name}%" to player
  16. set {rows.%player%} to {backpack.%{_loop}%.columns} * 9
  17. wait 2 ticks
  18. loop {backpacks::%player%::*}:
  19. add loop-value to current inventory of player
  20. set {backpacks.%player%} to true
  21.  
  22. on inventory close:
  23. if {backpacks.%player%} is true:
  24. clear {backpacks::%player%::*}
  25. loop {rows.%player%} times:
  26. set {backpacks::%player%::%loop-number - 1%} to slot "%loop-number - 1%" parsed as an integer of current inventory of player
  27. set {backpacks.%player%} to false
  28. delete {rows.%player%}
  29.  
  30. command /backpack [<String>] [<int>] [<int>] [<text>]:
  31. description: §cBackpack command !
  32. aliases: bp, bag
  33. trigger:
  34. if arg 1 isn't set:
  35. send "&e&m-----&e> &b&lBackpacks &e<&e&m----"
  36. send "&d/backpack create <number> <price> <name>%nl%&aCreate a backpack who cost <price> with <number> rows named <nom>"
  37. send "&d/backpack delete <id>%nl%&aDelete the backpack with the following ID <id>"
  38. send "&d/backpack buy <id>%nl%&aBuy the backpack with the following ID <id>"
  39. send "&d/backpack info <id>%nl%&aGet informations about the backpack who has the following ID <id>"
  40. send "&d/backpack list%nl%&aList of all created backpacks"
  41. if arg 1 is "create":
  42. if player has permission "{@Perm}":
  43. if arg 2 is set:
  44. if arg 3 is set:
  45. if arg 4 is set:
  46. set {_var} to arg 4
  47. replace all "&" in {_var} with "§"
  48. add 1 to {backpack.id}
  49. set {backpack.%{backpack.id}%.name} to {_var}
  50. set {backpack.%{backpack.id}%.price} to arg 3
  51. set {backpack.%{backpack.id}%.columns} to arg 2
  52. send "&aThe backpack %{backpack.%{backpack.id}%.name}% &d(ID %{backpack.id}%) &awho cost %{backpack.%{backpack.id}%.price}%$ with %{backpack.%{backpack.id}%.columns}% rows has been created."
  53. else:
  54. send "&cEnter a name to the backpack!"
  55. else:
  56. send "&cSet a price to the backpack!"
  57. else:
  58. send "&cEnter a number of rows to the backpack!"
  59. else:
  60. send "{@PermMsg}{@Perm}"
  61. if arg 1 is "delete":
  62. if player has permission "{@Perm2}":
  63. if arg 2 is set:
  64. if arg 2 is below {backpack.id} + 1:
  65. if arg 2 is greater than 0:
  66. delete {backpack.%arg 2%.name}
  67. delete {backpack.%arg 2%.price}
  68. delete {backpack.%arg 2%.columns}
  69. send "&aThe backpack with ID %arg 2% has been deleted!"
  70. else:
  71. send "&cEnter a number between 0 and %{backpack.id}%!"
  72. else:
  73. send "&cEnter a number between 0 and %{backpack.id}%!"
  74. else:
  75. send "&cPrecise which backpack you want to delete!"
  76. else:
  77. send "{@PermMsg}{@Perm2}"
  78. if arg 1 is "buy":
  79. if arg 2 is set:
  80. if arg 2 is below {backpack.id} + 1:
  81. if arg 2 is greater than 0:
  82. set {_bal} to {backpack.%arg 2%.price} - 1
  83. set {_money} to player's balance
  84. if {_money} is greater than {_bal}:
  85. remove {backpack.%arg 2%.price} from player's balance
  86. give a chest named "%{backpack.%arg 2%.name}%" with lore "||&eCapacity : &d%{backpack.%arg 2%.columns}*9% places" to player
  87. send "&aYou have buy the backpack named %{backpack.%arg 2%.name}%&a!"
  88. else:
  89. send "&cYou don't have enought money ! Do /backpack info %arg 2% to know the price!"
  90. else:
  91. send "&cEnter a number between 0 and %{backpack.id}%!"
  92. else:
  93. send "&cEnter a number between 0 and %{backpack.id}%!"
  94. else:
  95. send "&cEnter a backpack's ID!"
  96. if arg 1 is "info":
  97. if arg 2 is set:
  98. if arg 2 is below {backpack.id} + 1:
  99. if arg 2 is greater than 0:
  100. send "&d--> &r%{backpack.%arg 2%.name}% &d<--"
  101. send "&eCapacity : &d%{backpack.%arg 2%.columns}*9% places"
  102. send "&ePrice : &d%{backpack.%arg 2%.price}%$"
  103. else:
  104. send "&cEnter a number between 0 and %{backpack.id}%!"
  105. else:
  106. send "&cEnter a number between 0 and %{backpack.id}%!"
  107. else:
  108. send "&cEnter a backpack's ID!"
  109. if arg 1 is "list":
  110. loop {backpack.id} times:
  111. add 1 to {_loop}
  112. send "%nl%&cBackpack %{_loop}% :%nl%&eName : &d&r%{backpack.%{_loop}%.name}%%nl%&eInformations : &a/backpack info %{_loop}%%nl%"
Add Comment
Please, Sign In to add comment