Advertisement
NotKaizo

Simple Voucher Skript

Sep 22nd, 2021
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. # _____________________________ #
  2. # #
  3. # Simple Voucher Skript! #
  4. # #
  5. # Skript made by NotKaizo#0001 #
  6. # #
  7. # ----------------------------- #
  8.  
  9. options: #! Config
  10.  
  11. voucher_admin_perm: voucher.admin # Permission to access all /voucher command
  12.  
  13. voucher_lore: &7Right click to redeem this voucher! # Set the item lore when players receive a Voucher
  14.  
  15. voucher_item: paper # The Voucher item players use to redeem
  16.  
  17. # Voucher Group Command
  18.  
  19. #! Placeholders:
  20.  
  21. #! %{_p}% = player
  22. #! %{_rank}% = group
  23.  
  24. voucher_group_command: lp user %{_p}% parent add %{_rank}%
  25.  
  26. #! DO NOT TOUCH ANYTHING DOWN HERE IF YOU DON'T KNOW WHAT YOU ARE DOING!!
  27.  
  28. function VoucherUse(p: player, i: item, rank: string):
  29. remove 1 of {_i} from {_p}
  30. execute console command "{@voucher_group_command}"
  31. play sound "entity.firework_rocket.launch" to {_p}
  32. play sound "entity.firework_rocket.large_blast" to {_p}
  33. send "&aSuccessfully redeemed this voucher!" to {_p}
  34.  
  35. function voucherGive(p: player, name: string, rank: string, i: item):
  36. setItemVoucher({_i}, {_rank}, {_name})
  37. give 1 of {_i} named "%{_name}%" with lore "" and "{@voucher_lore}" to {_p}
  38.  
  39. function setItemVoucher(i: item, rank: string, name: string) :: item:
  40. add "{voucher:""%{_rank}%""}" to nbt of {_i}
  41. return {_i}
  42.  
  43. function getItemVoucher(i: item) :: string:
  44. return (tag "voucher" of nbt of {_i}) ? 0
  45.  
  46. on right click:
  47. if player is op:
  48. if {voucher::%getItemVoucher(tool)%} is set:
  49. VoucherUse(player, tool, getItemVoucher(tool))
  50.  
  51. command /voucher [<string>] [<string>] [<string>]:
  52. permission: {@voucher_admin_perm}
  53. trigger:
  54. if arg-1 is "create":
  55. if arg-2 is set:
  56. if arg-3 is set:
  57. if {voucher::%arg-2%} is not set:
  58. setItemVoucher({@voucher_item}, arg-2, arg-3)
  59. set {voucher::%arg-2%} to arg-3
  60. play sound "block.note_block.pling" to the player
  61. send "&aSuccessfully created new voucher with group &c%arg-2% &anamed %arg-3%!"
  62. else:
  63. send "&cThis voucher has already been made!"
  64. else:
  65. send "&aDo &c/voucher help&a for a list of command!"
  66. else:
  67. send "&aDo &c/voucher help&a for a list of command!"
  68. else if arg-1 is "give":
  69. if arg-2 is set:
  70. if arg-3 is set:
  71. if {voucher::%arg-3%} is set:
  72. voucherGive((arg-2 parsed as player), (formatted {voucher::%arg-3%}), arg-3, {@voucher_item})
  73. send "&aGave %arg-2% &aa &c%arg-3%&a Voucher!"
  74. else:
  75. send "&cThis voucher does not exist!"
  76. else:
  77. send "&aDo &c/voucher help&a for a list of command!"
  78. else:
  79. send "&aDo &c/voucher help&a for a list of command!"
  80. else if arg-1 is "delete":
  81. if arg-2 is set:
  82. if {voucher::%arg-2%} is set:
  83. delete {voucher::%arg-2%}
  84. send "&aSuccessfully delete voucher with group &c%arg-2%"
  85. else:
  86. send "&cThis voucher does not exist!"
  87. else:
  88. send "&aDo &c/voucher help&a for a list of command!"
  89. else:
  90. send "&6&l======================================="
  91. send ""
  92. send "&c/voucher give <player> <group name>"
  93. send ""
  94. send "&c/voucher create <group name> <voucher name>"
  95. send ""
  96. send "&c/voucher delete <group name>"
  97. send ""
  98. send "&c/voucher help"
  99. send ""
  100. send "&eVersion: 1.0"
  101. send "&eSkript made by NotKaizo##0001"
  102. send "&6&l======================================="
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement