Locations, .5

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

Marsbar

Active Member
Mar 31, 2019
131
4
18
18
Hi im having an issue with this cell skript im making. When you claim with the stick, it set coordinates.
The issue is that it changes the coordinate depending on the server. It claims wrongly (Is that a word?). Sometimes it adds 1 more or 1 less on the z or x coordinate.
Code:
on click:
    player's tool is blaze rod named colored "&c&lCeller":
        if {cells.claiming.%player%} is not true:
            set {cells.claiming12.%player%} to location of targeted block
            set {cells.claiming.%player%} to true
            send "&6&lClaiming: &6Position 1 set: (%x coordinate of {cells.claiming12.%player%}%, %y coordinate of {cells.claiming12.%player%}%, %z coordinate of {cells.claiming12.%player%}%)"
            cancel event
            stop
        else if {cells.claiming.%player%} is true:
            set {cells.claiming22.%player%} to location of targeted block
            set {cells.claiming.%player%} to false
        if y coordinate of {cells.claiming12.%player%} is bigger than y coordinate of {cells.claiming22.%player%}:
            set {cells.claiming2.%player%} to {cells.claiming12.%player%}
            set {cells.claiming1.%player%} to {cells.claiming22.%player%}
        else:
            set {cells.claiming2.%player%} to {cells.claiming22.%player%}
            set {cells.claiming1.%player%} to {cells.claiming12.%player%}
        if y coordinate of {cells.claiming22.%player%} is equal to y coordinate of {cells.claiming12.%player%}:
            set {cells.claiming1.%player%} to {cells.claiming12.%player%}
            set {cells.claiming2.%player%} to {cells.claiming22.%player%}
        send "&6&lClaiming &a&l✔ &6Positions: (%x coordinate of {cells.claiming1.%player%}%, %y coordinate of {cells.claiming1.%player%}%, %z coordinate of {cells.claiming1.%player%}%) (%x coordinate of {cells.claiming2.%player%}%, %y coordinate of {cells.claiming2.%player%}%, %z coordinate of {cells.claiming2.%player%}%)"
        cancel event
Thats when you claim the coordinates.
Code:
            set {_1} to "%x coordinate of {cells.claiming1.%player%}%"
            set {_2} to "%y coordinate of {cells.claiming1.%player%}%"
            set {_3} to "%z coordinate of {cells.claiming1.%player%}%"
            set {_4} to "%x coordinate of {cells.claiming2.%player%}%"
            set {_5} to "%y coordinate of {cells.claiming2.%player%}%"
            set {_6} to "%z coordinate of {cells.claiming2.%player%}%"
            loop 6 times:
                replace all ",5" in {_%loop-number%} with ""
                replace all ".5" in {_%loop-number%} with ""
                set {_%loop-number%} to {_%loop-number%} parsed as an integer
            wait 1 tick
            remove 1 from {_3}
            remove 1 from {_6}
            set {_p1} to "%({_1})%,%({_2})%,%({_3})%"
            set {_p2} to "%({_4})%,%{_5}%,%({_6})%"
            execute player command "//pos1 %{_p1}%"
            execute player command "//pos2 %{_p2}%"
            wait 1 tick
            clear {cell.%arg-2%.owner}
            set {cell.%arg-2%.world} to world of targeted block
            clear {cell.%arg-2%.Members::*}
            set {cell.%arg-2%.signcoords} to targeted block
            set {cell.%arg-2%} to arg-2
            set {cell.%arg-2%.l1} to {cells.claiming1.%player%}
            set {cell.%arg-2%.l2} to {cells.claiming2.%player%}
            clear {cells.claiming1.%player%}
            clear {cells.claiming2.%player%}
            add arg-2 to {cells.all::*}
            execute player command "/rg d %arg-2%"
            wait 2 ticks
            execute player command "//sel"
I can't understand why it changes coordinates depending on the server.
And is it possible to get the coordinate of a block without the 0.5?
 
Status
Not open for further replies.