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.

How do I check if the player is in a region?

Discussion in 'Skript' started by sourlemonzyt, Apr 19, 2020.

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

    sourlemonzyt New Member

    Joined:
    Apr 19, 2020
    Messages:
    5
    Likes Received:
    0
    so i have this skript here:
    Code (Text):
    1. command /test69:
    2.     trigger:
    3.         message "success!"
    and i would like to check if the player is in a world guard region called "test".
    if this check returns true, it will run the message command. if the check returns false, it will
    run a message command saying "failed". How would i go about doing this?

    Little bit of background info this is my first time touching Skript. Please help me in a way that is
    crystal clear for me to understand :emoji_grin:
    Thank you!
     
  2. informerpuppy

    informerpuppy New Member

    Joined:
    Apr 19, 2020
    Messages:
    8
    Likes Received:
    1
    Same here, I'm trying to let a skript work if the player is in a specific world guard region only. Can't seem to find a way...
     
  3. sourlemonzyt

    sourlemonzyt New Member

    Joined:
    Apr 19, 2020
    Messages:
    5
    Likes Received:
    0
  4. Jerooski

    Jerooski Member

    Joined:
    Apr 19, 2020
    Messages:
    16
    Likes Received:
    0
    try:
    Code (Text):
    1. Trigger:
    2.    if "%region at player%" contains "region_spawn"
    region_spawn being the example name of the World Guard Region
     
  5. sourlemonzyt

    sourlemonzyt New Member

    Joined:
    Apr 19, 2020
    Messages:
    5
    Likes Received:
    0
    Thank you for helping me, mate!

    I revived an error message saying it cannot understand the condition/effect if "%region at player%" contains "region_test".

    I also tried removing the "region" in the "region_test" section but i revived the same error message.

    Am I supposed to use an add-on? Or am I doing something completely wrong?
     
  6. Jerooski

    Jerooski Member

    Joined:
    Apr 19, 2020
    Messages:
    16
    Likes Received:
    0
    "region_test" should be the exact same name of your world guard region as how it appears in the region list

    if that isn't the case. Make a new region, in this case this one is called myregion and replace your code with
    Code (Text):
    1. on command "/test69":
    2.    if "%region at player%" contains "myregion":
    3.       message "&e&lSUCCESS!"
    Now a message should pop in chat after you do /test69 and are inside the myregion region
     
  7. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    @sourlemonzyt @informerpuppy

    For events:

    Code (Text):
    1. on region enter:
    2.     send "%region%" to player
    3.  
    Outside events: (U have to use regionS bc there could be multiple regionS on that location)

    Code (Text):
    1. set {_rg::*} to regions at player
    2. loop {_rg::*}:
    3.     if loop-value = "test in world world":
    4.         send "YES HE REGION JNSAASFJKFJJKASF"
    5.         stop
     
  8. sourlemonzyt

    sourlemonzyt New Member

    Joined:
    Apr 19, 2020
    Messages:
    5
    Likes Received:
    0
    it
    resulted with the same error :emoji_frowning:

    i created a new region called myregion that stretched from the bedrock to build height! The error says that it cannot understand the expression!
    --- Double Post Merged, Apr 20, 2020, Original Post Date: Apr 20, 2020 ---
    so this is very difficult to understand. may you please explain a little bit? thank you for helping me!
     
  9. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Uhm wenn u try to retrieve the region of the player u use “region” but a player can be in multiple regions. So the syntax is not “region” but “regions”.

    Only now it returns a list.
     
  10. sourlemonzyt

    sourlemonzyt New Member

    Joined:
    Apr 19, 2020
    Messages:
    5
    Likes Received:
    0
    hi. May you please tested the code for me? It does not seem to work on my server. Do I require a specific addon or anything? does it work with worldguard
     
    #10 sourlemonzyt, Apr 22, 2020
    Last edited: Apr 22, 2020
Thread Status:
Not open for further replies.

Share This Page

Loading...