Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- command /backpack [<offline player>] [<text>]:
- trigger:
- if arg 1 is not set:
- open virtual chest inventory with size 3 named "Your Backpack" to player
- loop {backpack::%uuid of player%::*}:
- add loop-value to current inventory of player
- play sound "CHEST_OPEN" with volume 100 and pitch 1 at player for player
- else:
- if player does not have permission "rank.srmod":
- message "&cYou do not have permission to edit the backpack of others."
- stop
- set {-backpack::opened::%uuid of player%} to arg 1
- play sound "CHEST_OPEN" with volume 100 and pitch 1 at player for player
- open virtual chest inventory with size 3 named "Backpack: %player%" to player
- loop {backpack::%uuid of arg-1%::*}:
- add loop-value to current inventory of player
- on inventory click:
- if name of current inventory of player contains "Backpack":
- if type of event-item is stone sword or chain helmet or chain chestplate or chain leggings or chain boots: # configure this to your liking.
- cancel event
- message "&cYou cannot add this item to your backpack."
- on inventory close:
- if name of event-inventory is "Your Backpack":
- clear {backpack::%uuid of player%::*}
- loop all items in event-inventory:
- set {_l} to loop-item
- if loop-item is any sword or any boots or any leggings or any chestplate or any helmet:
- remove loop-item from event-inventory
- add {_l} to {_give-back-items::*}
- send "&cYou cannot add this item to your backpack."
- else:
- add loop-item to {backpack::%uuid of player%::*}
- send "&aYour backpack has been saved."
- wait 1 tick
- loop {_give-back-items::*}:
- give player loop-value
- play sound "CHEST_CLOSE" with volume 100 and pitch 1 at player for player
- else if name of event-inventory contains "Backpack: ":
- set {_u} to uuid of {-backpack::opened::%uuid of player%}
- clear {backpack::%{_u}%::*}
- loop all items in event-inventory:
- add loop-item to {backpack::%{_u}%::*}
- send "&aBackpack of &7%{-backpack::opened::%uuid of player%}% &ahas been saved."
- play sound "CHEST_CLOSE" with volume 100 and pitch 1 at player for player
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement