Yes or No variable skript

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Reveals

Member
Jan 7, 2020
1
0
0
24
Hey! I am trying to write a skript where when you run the command /break and you have the perm admin.break you can either disable the ability to break / place blocks or enable it.

Code:
options:
    BlockRegenMSG: &cYou have building disabled!
    BlockBreakMSG: &cYou have breaking disabled!
    cbreak: true

command /break:
    permission: admin.break
    trigger:
    if {@cbreak} = true:
        set {@cbreak} to false
    if {@cbreak} = false:
        set {@cbreak} to true
        else:
            send "&cYou do not have the permission!"
on break:
    if {@cbreak} = true
    cancel event
    message "{@BlockBreakMSG}"
on place:
    if {@cbreak} = true
    cancel event
    message "{@BlockRegenMSG}"
 
Last edited:
try this
Code:
options:
    BlockRegenMSG: &cYou have building disabled!
    BlockBreakMSG: &cYou have breaking disabled!

command /break:
    permission: admin.break
    permission message: &cYou do not have permission!
    trigger:
        if {cbreak} is true:
            set {cbreak} to false
        else:
            set {cbreak} to true
on break:
    if {cbreak} is true:
        cancel event
        message "{@BlockBreakMSG}"
on place:
    if {cbreak} is true:
        cancel event
        message "{@BlockRegenMSG}"
[doublepost=1581957221,1581957121][/doublepost]Also there is an issue with this skript, first of all use local variables and second all please use player specific variables. I'll edit your code to fix the issues but take it from me, you'll WANT to use local and player specific variables

Code:
options:
    BlockRegenMSG: &cYou have building disabled!
    BlockBreakMSG: &cYou have breaking disabled!

command /break:
    permission: admin.break
    permission message: &cYou do not have permission!
    trigger:
        if {_cbreak::%player%} is true:
            set {_cbreak::%player%} to false
        else:
            set {_cbreak::%player%} to true
on break:
    if {_cbreak::%player%} is true:
        cancel event
        message "{@BlockBreakMSG}"
on place:
    if {_cbreak::%player%} is true:
        cancel event
        message "{@BlockRegenMSG}"
 
Status
Not open for further replies.