Jump to content

this skrpt is not working properly


maffiebaasha

Recommended Posts

 
 
hello this script works fine but i don't know how to put voucher list in that command is at the very bottomoptions:
    prefix: &3&lVouchers &8&l» &7

command /voucher [<string>] [<string>] [<string>]:
    permission: voucher.admin
    trigger:
        if arg 1 is set:
            if arg 1 = "create":
                if arg 2 is set:
                    if {vouchers::list::*} contains arg-2:
                        message "{@prefix} This does already exist!"
                        stop

                    add arg-2 to {vouchers::list::*}
                    message "{@prefix} Created the voucher &b%arg-2%"
                    stop

                else:
                    message "{@prefix} Specify a name for the voucher!"
                    stop
            
            if arg 1 = "delete":
                if arg 2 is set:
                    if {vouchers::list::*} doesn't contain arg-2:
                        message "{@prefix} This voucher does not exist!"
                        stop
                    
                    remove arg-2 from {vouchers::list::*}
                    message "{@prefix} Deleted voucher &b%arg-2%"

                    delete {voucher::%arg-2%::*}
                    stop
                
                else:
                    message "{@prefix} Specify the name of the voucher you want to delete!"
                    stop

            if arg 1 = "setcommand":
                if arg 2 is set:
                    if arg 3 is set:
                        if {vouchers::list::*} doesn't contain arg-2:
                            message "{@prefix} This voucher does not exist!"
                            stop

                        set {voucher::%arg-2%::command} to arg-3
                        message "{@prefix} Set the command of voucher &b%arg-2% &7to &b%arg-3%"
                        stop
                    else:
                        message "{@prefix} Please specify a command!"
                        stop
                else:
                    message "{@prefix} Please specify the name of the voucher."
                    stop
            
            if arg 1 = "setmessage":
                if arg 2 is set:
                    if arg 3 is set:
                        if {vouchers::list::*} doesn't contain arg-2:
                            message "{@prefix} This voucher does not exist!"
                            stop

                        set {voucher::%arg-2%::message} to arg-3
                        message "{@prefix} Set the message of voucher &b%arg-2% &7to &b%arg-3%"
                        stop
                    else:
                        message "{@prefix} Please specify a message!"
                        stop
                else:
                    message "{@prefix} Please specify the name of the voucher."
                    stop
            
            if arg 1 = "give":
                if arg 2 is set:
                    if {vouchers::list::*} doesn't contain arg-2:
                        message "{@prefix} This voucher does not exist!"
                        stop
                    
                    give 1 of paper named "&7%arg-2%" with lore "&7Click to claim" to the player
                    message "{@prefix} Gave you the voucher!"
                    stop
                else:
                    message "{@prefix} Please specify the name of the voucher."
                    stop
        else:
            message "{@prefix} Usage: /voucher ( create / delete / give / setcommand / setmessage ) ( arguments ) "


on rightclick:
    if type of player's tool = compass:
        set {&6Main Menu} to name of player's tool
        replace all "&7" with "" in {&6Main Menu}
        if {vouchers::list::*} contains "%{&6Main Menu}%":
            if lore of player's tool = "&7Click to Open":
                set {_name} to {&6Main Menu}
                remove 1 of player's tool from player's inventory
                # Changing {player} with %player%
                set {_replace} to ReplacePlaceholder({voucher::%{_name}%::command}, "{player}", "%player%")
                execute console command "%{_replace}%"
                message "{@prefix} %{voucher::%{_name}%::message}%"

on load:
    if {vouchers::list::*} is not set:
        add "" to {vouchers::list::*}

 

options:
    prefix: &3&lVouchers &8&l» &7

command /voucher [<string>] [<string>] [<string>]:
    permission: voucher.admin
    trigger:
        if arg 1 is set:
            if arg 1 = "create":
                if arg 2 is set:
                    if {vouchers::list::*} contains arg-2:
                        message "{@prefix} This does already exist!"
                        stop

                    add arg-2 to {vouchers::list::*}
                    message "{@prefix} Created the voucher &b%arg-2%"
                    stop

                else:
                    message "{@prefix} Specify a name for the voucher!"
                    stop
            
            if arg 1 = "delete":
                if arg 2 is set:
                    if {vouchers::list::*} doesn't contain arg-2:
                        message "{@prefix} This voucher does not exist!"
                        stop
                    
                    remove arg-2 from {vouchers::list::*}
                    message "{@prefix} Deleted voucher &b%arg-2%"

                    delete {voucher::%arg-2%::*}
                    stop
                
                else:
                    message "{@prefix} Specify the name of the voucher you want to delete!"
                    stop

            if arg 1 = "setcommand":
                if arg 2 is set:
                    if arg 3 is set:
                        if {vouchers::list::*} doesn't contain arg-2:
                            message "{@prefix} This voucher does not exist!"
                            stop

                        set {voucher::%arg-2%::command} to arg-3
                        message "{@prefix} Set the command of voucher &b%arg-2% &7to &b%arg-3%"
                        stop
                    else:
                        message "{@prefix} Please specify a command!"
                        stop
                else:
                    message "{@prefix} Please specify the name of the voucher."
                    stop
            
            if arg 1 = "setmessage":
                if arg 2 is set:
                    if arg 3 is set:
                        if {vouchers::list::*} doesn't contain arg-2:
                            message "{@prefix} This voucher does not exist!"
                            stop

                        set {voucher::%arg-2%::message} to arg-3
                        message "{@prefix} Set the message of voucher &b%arg-2% &7to &b%arg-3%"
                        stop
                    else:
                        message "{@prefix} Please specify a message!"
                        stop
                else:
                    message "{@prefix} Please specify the name of the voucher."
                    stop
            
            if arg 1 = "give":
                if arg 2 is set:
                    if {vouchers::list::*} doesn't contain arg-2:
                        message "{@prefix} This voucher does not exist!"
                        stop
                    
                    give 1 of paper named "&7%arg-2%" with lore "&7Click to claim" to the player
                    message "{@prefix} Gave you the voucher!"
                    stop
                else:
                    message "{@prefix} Please specify the name of the voucher."
                    stop
        else:
            message "{@prefix} Usage: /voucher ( create / delete / give / setcommand / setmessage ) ( arguments ) "


on rightclick:
    if type of player's tool = compass:
        set {&6Main Menu} to name of player's tool
        replace all "&7" with "" in {&6Main Menu}
        if {vouchers::list::*} contains "%{&6Main Menu}%":
            if lore of player's tool = "&7Click to Open":
                set {_name} to {&6Main Menu}
                remove 1 of player's tool from player's inventory
                # Changing {player} with %player%
                set {_replace} to ReplacePlaceholder({voucher::%{_name}%::command}, "{player}", "%player%")
                execute console command "%{_replace}%"
                message "{@prefix} %{voucher::%{_name}%::message}%"

on load:
    if {vouchers::list::*} is not set:
        add "" to {vouchers::list::*}

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...