Advertisement
hangtight

Untitled

Dec 8th, 2020
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. command /backpack [<offline player>] [<text>]:
  2. trigger:
  3. if arg 1 is not set:
  4. open virtual chest inventory with size 3 named "Your Backpack" to player
  5. loop {backpack::%uuid of player%::*}:
  6. add loop-value to current inventory of player
  7. play sound "CHEST_OPEN" with volume 100 and pitch 1 at player for player
  8. else:
  9. if player does not have permission "rank.srmod":
  10. message "&cYou do not have permission to edit the backpack of others."
  11. stop
  12. set {-backpack::opened::%uuid of player%} to arg 1
  13. play sound "CHEST_OPEN" with volume 100 and pitch 1 at player for player
  14. open virtual chest inventory with size 3 named "Backpack: %player%" to player
  15. loop {backpack::%uuid of arg-1%::*}:
  16. add loop-value to current inventory of player
  17.  
  18. on inventory click:
  19. if name of current inventory of player contains "Backpack":
  20. 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.
  21. cancel event
  22. message "&cYou cannot add this item to your backpack."
  23.  
  24.  
  25. on inventory close:
  26. if name of event-inventory is "Your Backpack":
  27. clear {backpack::%uuid of player%::*}
  28. loop all items in event-inventory:
  29. set {_l} to loop-item
  30. if loop-item is any sword or any boots or any leggings or any chestplate or any helmet:
  31. remove loop-item from event-inventory
  32. add {_l} to {_give-back-items::*}
  33. send "&cYou cannot add this item to your backpack."
  34. else:
  35. add loop-item to {backpack::%uuid of player%::*}
  36. send "&aYour backpack has been saved."
  37. wait 1 tick
  38. loop {_give-back-items::*}:
  39. give player loop-value
  40. play sound "CHEST_CLOSE" with volume 100 and pitch 1 at player for player
  41. else if name of event-inventory contains "Backpack: ":
  42. set {_u} to uuid of {-backpack::opened::%uuid of player%}
  43. clear {backpack::%{_u}%::*}
  44. loop all items in event-inventory:
  45. add loop-item to {backpack::%{_u}%::*}
  46. send "&aBackpack of &7%{-backpack::opened::%uuid of player%}% &ahas been saved."
  47. play sound "CHEST_CLOSE" with volume 100 and pitch 1 at player for player
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement