Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # _____________________________ #
- # #
- # Simple Voucher Skript! #
- # #
- # Skript made by NotKaizo#0001 #
- # #
- # ----------------------------- #
- options: #! Config
- voucher_admin_perm: voucher.admin # Permission to access all /voucher command
- voucher_lore: &7Right click to redeem this voucher! # Set the item lore when players receive a Voucher
- voucher_item: paper # The Voucher item players use to redeem
- # Voucher Group Command
- #! Placeholders:
- #! %{_p}% = player
- #! %{_rank}% = group
- voucher_group_command: lp user %{_p}% parent add %{_rank}%
- #! DO NOT TOUCH ANYTHING DOWN HERE IF YOU DON'T KNOW WHAT YOU ARE DOING!!
- function VoucherUse(p: player, i: item, rank: string):
- remove 1 of {_i} from {_p}
- execute console command "{@voucher_group_command}"
- play sound "entity.firework_rocket.launch" to {_p}
- play sound "entity.firework_rocket.large_blast" to {_p}
- send "&aSuccessfully redeemed this voucher!" to {_p}
- function voucherGive(p: player, name: string, rank: string, i: item):
- setItemVoucher({_i}, {_rank}, {_name})
- give 1 of {_i} named "%{_name}%" with lore "" and "{@voucher_lore}" to {_p}
- function setItemVoucher(i: item, rank: string, name: string) :: item:
- add "{voucher:""%{_rank}%""}" to nbt of {_i}
- return {_i}
- function getItemVoucher(i: item) :: string:
- return (tag "voucher" of nbt of {_i}) ? 0
- on right click:
- if player is op:
- if {voucher::%getItemVoucher(tool)%} is set:
- VoucherUse(player, tool, getItemVoucher(tool))
- command /voucher [<string>] [<string>] [<string>]:
- permission: {@voucher_admin_perm}
- trigger:
- if arg-1 is "create":
- if arg-2 is set:
- if arg-3 is set:
- if {voucher::%arg-2%} is not set:
- setItemVoucher({@voucher_item}, arg-2, arg-3)
- set {voucher::%arg-2%} to arg-3
- play sound "block.note_block.pling" to the player
- send "&aSuccessfully created new voucher with group &c%arg-2% &anamed %arg-3%!"
- else:
- send "&cThis voucher has already been made!"
- else:
- send "&aDo &c/voucher help&a for a list of command!"
- else:
- send "&aDo &c/voucher help&a for a list of command!"
- else if arg-1 is "give":
- if arg-2 is set:
- if arg-3 is set:
- if {voucher::%arg-3%} is set:
- voucherGive((arg-2 parsed as player), (formatted {voucher::%arg-3%}), arg-3, {@voucher_item})
- send "&aGave %arg-2% &aa &c%arg-3%&a Voucher!"
- else:
- send "&cThis voucher does not exist!"
- else:
- send "&aDo &c/voucher help&a for a list of command!"
- else:
- send "&aDo &c/voucher help&a for a list of command!"
- else if arg-1 is "delete":
- if arg-2 is set:
- if {voucher::%arg-2%} is set:
- delete {voucher::%arg-2%}
- send "&aSuccessfully delete voucher with group &c%arg-2%"
- else:
- send "&cThis voucher does not exist!"
- else:
- send "&aDo &c/voucher help&a for a list of command!"
- else:
- send "&6&l======================================="
- send ""
- send "&c/voucher give <player> <group name>"
- send ""
- send "&c/voucher create <group name> <voucher name>"
- send ""
- send "&c/voucher delete <group name>"
- send ""
- send "&c/voucher help"
- send ""
- send "&eVersion: 1.0"
- send "&eSkript made by NotKaizo##0001"
- send "&6&l======================================="
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement