1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Disable commands on specific regions

Discussion in 'Skript' started by FireRoz, Jun 24, 2020.

Thread Status:
Not open for further replies.
  1. FireRoz

    FireRoz Active Member

    Joined:
    May 28, 2020
    Messages:
    134
    Likes Received:
    5
    Yo whatsup I wanna create a skript that when you enter a __global__ region you cannot do /fly anymore, and I know what you're thinking:
    BUT YOU STUPID IDIOT YOU CAN DO IT ON WORLDGUARD AND ADD TO ADMINS WORLDGUARD.REGION.BYPASS.__GLOBAL__
    well, here is the thing! I don't want normal players to fly there, But I want moderators to fly there and if they can bypass the region rules, then they will be able to build. I want that once you enter a specific region without the permission region.fly you will not be able to do /fly anymore.
    thanks lmao
     
  2. rick_Kraut

    rick_Kraut Member

    Joined:
    Feb 20, 2020
    Messages:
    12
    Likes Received:
    1
    Should work, untested, but may need some tweaks.
    (could probably be cleaner, but hey, its a 10 min thing.
    replace {forbidden region} with what ever, this is mostly copy paste from the docs.
    Code (Skript):
    1.  
    2. on region enter:
    3.      region is {forbidden region}
    4.      if player does not has permission "region.fly":
    5.          make player execute command "/fly"
    6. on command:
    7.     if region is {forbidden region} is true:
    8.         if the command is "fly":
    9.             if player does not has permission "region.fly":
    10.                 cancel event
     
  3. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    Code (Skript):
    1. on region enter:
    2.     if "%region at player%" contains "NoFlyRegion":
    3.         if player's flight mode is true:
    4.             set player's flight mode to false
    5. on command "/fly":
    6.     if "%region at player%" contains "NoFlyRegion":
    7.         if player does not have permission "staff.fly":
    8.             cancel event
    9.             send "§cYou cant use this command in this region." to player
    10.         else:
    11.             uncancel event
    Didnt tested.
     
  4. rick_Kraut

    rick_Kraut Member

    Joined:
    Feb 20, 2020
    Messages:
    12
    Likes Received:
    1
    While It may not be great practice, I don't think you need the additional else statement there couger
    Otherwise, I would prob recommend couger's code over mine.
     
  5. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    What? The creator of the post has the option to choose. I just commented on what I think the code he asks for would be.
     
  6. rick_Kraut

    rick_Kraut Member

    Joined:
    Feb 20, 2020
    Messages:
    12
    Likes Received:
    1
    I mean ya, but with my code untweaked some brilliant lad could go, wait, it just sends the command, I could just pop in there without fly and get flight again. But ya, they do have the option to choose.
     
  7. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    I don't speak perfect English, so I don't fully understand what you're trying to tell me, but the code I sent is based on one I made a long time ago when I had a server.
    upload_2020-6-24_22-56-3.png
     
  8. rick_Kraut

    rick_Kraut Member

    Joined:
    Feb 20, 2020
    Messages:
    12
    Likes Received:
    1
    Oh, apologies, haven't really been using this community's forums for that long, I was just pointing out that there was a major flaw in my code that could be abused to get flight in regions that they are not supposed to.
     
    • Like Like x 1
  9. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    No problem. As I said earlier, I don't understand English perfectly nor its "idioms", so it's not your fault.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...