Solved Check if a player is between a location?

  • 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.

MixedNoob

Member
Apr 10, 2020
10
1
3
Does anyone know how to check if a player is within a location without using worldguard?

I tried using '''if event-player's location is between {_loc1} and {_loc2}:''' but that did not work.
I tried to do it without variables and tried the location function it did not work either.

obviously the attempts I posted above aren't the only ones I've tried they are just my latest attempts unfortunately I can't list them all because there are too many.
 
Split the position into coordinates and compare them separately, like so:

B05887_7_5.jpg


Code:
if event-player's x coord is between {_loc1} x coord and {_loc2} x coord:
        if event-player's y coord is between {_loc1} y coord and {_loc2} y coord:
            if event-player's z coord is between {_loc1} z coord and {_loc2} z coord:

Note: This works for Axis Aligned Box only. For transformed boxes you will need to use other maths.
 
Last edited:
Split the position into coordinates and compare them separately, like so:

B05887_7_5.jpg


Code:
if event-player's x coord is between {_loc1} x coord and {_loc2} x coord:
        if event-player's y coord is between {_loc1} y coord and {_loc2} y coord:
            if event-player's z coord is between {_loc1} z coord and {_loc2} z coord:

Note: This should work, but I haven't tested it.
you're a GENIUS how did I not think of that? thank you for everything xD

it worked by the way
 
Status
Not open for further replies.