Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- PermMsg: &cYou need the permission : &6
- Perm: backpack.create
- Perm2: backpack.delete
- on load:
- if {backpack.id} isn't set:
- set {backpack.id} to 0
- on rightclick with a chest:
- loop {backpack.id} times:
- add 1 to {_loop}
- if name of player's held item is "%{backpack.%{_loop}%.name}%":
- cancel event
- open chest with {backpack.%{_loop}%.columns} rows named "%{backpack.%{_loop}%.name}%" to player
- set {rows.%player%} to {backpack.%{_loop}%.columns} * 9
- wait 2 ticks
- loop {backpacks::%player%::*}:
- add loop-value to current inventory of player
- set {backpacks.%player%} to true
- on inventory close:
- if {backpacks.%player%} is true:
- clear {backpacks::%player%::*}
- loop {rows.%player%} times:
- set {backpacks::%player%::%loop-number - 1%} to slot "%loop-number - 1%" parsed as an integer of current inventory of player
- set {backpacks.%player%} to false
- delete {rows.%player%}
- command /backpack [<String>] [<int>] [<int>] [<text>]:
- description: §cBackpack command !
- aliases: bp, bag
- trigger:
- if arg 1 isn't set:
- send "&e&m-----&e> &b&lBackpacks &e<&e&m----"
- send "&d/backpack create <number> <price> <name>%nl%&aCreate a backpack who cost <price> with <number> rows named <nom>"
- send "&d/backpack delete <id>%nl%&aDelete the backpack with the following ID <id>"
- send "&d/backpack buy <id>%nl%&aBuy the backpack with the following ID <id>"
- send "&d/backpack info <id>%nl%&aGet informations about the backpack who has the following ID <id>"
- send "&d/backpack list%nl%&aList of all created backpacks"
- if arg 1 is "create":
- if player has permission "{@Perm}":
- if arg 2 is set:
- if arg 3 is set:
- if arg 4 is set:
- set {_var} to arg 4
- replace all "&" in {_var} with "§"
- add 1 to {backpack.id}
- set {backpack.%{backpack.id}%.name} to {_var}
- set {backpack.%{backpack.id}%.price} to arg 3
- set {backpack.%{backpack.id}%.columns} to arg 2
- 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."
- else:
- send "&cEnter a name to the backpack!"
- else:
- send "&cSet a price to the backpack!"
- else:
- send "&cEnter a number of rows to the backpack!"
- else:
- send "{@PermMsg}{@Perm}"
- if arg 1 is "delete":
- if player has permission "{@Perm2}":
- if arg 2 is set:
- if arg 2 is below {backpack.id} + 1:
- if arg 2 is greater than 0:
- delete {backpack.%arg 2%.name}
- delete {backpack.%arg 2%.price}
- delete {backpack.%arg 2%.columns}
- send "&aThe backpack with ID %arg 2% has been deleted!"
- else:
- send "&cEnter a number between 0 and %{backpack.id}%!"
- else:
- send "&cEnter a number between 0 and %{backpack.id}%!"
- else:
- send "&cPrecise which backpack you want to delete!"
- else:
- send "{@PermMsg}{@Perm2}"
- if arg 1 is "buy":
- if arg 2 is set:
- if arg 2 is below {backpack.id} + 1:
- if arg 2 is greater than 0:
- set {_bal} to {backpack.%arg 2%.price} - 1
- set {_money} to player's balance
- if {_money} is greater than {_bal}:
- remove {backpack.%arg 2%.price} from player's balance
- give a chest named "%{backpack.%arg 2%.name}%" with lore "||&eCapacity : &d%{backpack.%arg 2%.columns}*9% places" to player
- send "&aYou have buy the backpack named %{backpack.%arg 2%.name}%&a!"
- else:
- send "&cYou don't have enought money ! Do /backpack info %arg 2% to know the price!"
- else:
- send "&cEnter a number between 0 and %{backpack.id}%!"
- else:
- send "&cEnter a number between 0 and %{backpack.id}%!"
- else:
- send "&cEnter a backpack's ID!"
- if arg 1 is "info":
- if arg 2 is set:
- if arg 2 is below {backpack.id} + 1:
- if arg 2 is greater than 0:
- send "&d--> &r%{backpack.%arg 2%.name}% &d<--"
- send "&eCapacity : &d%{backpack.%arg 2%.columns}*9% places"
- send "&ePrice : &d%{backpack.%arg 2%.price}%$"
- else:
- send "&cEnter a number between 0 and %{backpack.id}%!"
- else:
- send "&cEnter a number between 0 and %{backpack.id}%!"
- else:
- send "&cEnter a backpack's ID!"
- if arg 1 is "list":
- loop {backpack.id} times:
- add 1 to {_loop}
- 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