Skyblock AntiAFK Mine

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

Jun 7, 2017
15
0
0
43
So I am trying to make a skript that opens up a deluxe menu gui which would prevent players from afk mining on skript basically the way im trying to do it is if the player is standing still but im not so sure how to do this efficiently here's what I have right now:
Code:
on mine:
    if event-block is stone or diamond ore or emerald ore or cobblestone or coal ore or iron ore or gold ore or redstone ore or lapis ore:
        if {mining.%player%} is not set:
            set {mining.%player%} to true
        if {mining.%player%} is true:
            if {mining.%player%.counter} is not set:
                set {mining.%player%.counter} to 1
            if {mining.%player%.counter} is set:
                if {mining.%player%.counter} is more than or equal to 64:
                    set {_x-check} to x-coords of player
                    set {_z-check} to z-coords of player
                    if {_x-check} isn't {_x}:
                        set {mining.%player%} to false
                        set {mining.%player%.counter} to 0
                    if {_z-check} isn't {_z}:
                        set {mining.%player%} to false
                        set {mining.%player%.counter} to 0
                    if {_x-check} is {_x}:
                        if {_z-check} is {_z}:
                            make console execute command "dm open afkmine %player%"
                            set {mining.%player%} to false
                            set {mining.%player%.counter} to 0
                            stop
                if {mining.%player%.counter} is less than or equal to 1:
                    add 1 to {mining.%player%.counter}
                    set {_x} to x-coords of player
                    set {_z} to z-coords of player
                    stop
                if {mining.%player%.counter} is more than or equal to 2:
                    add 1 to {mining.%player%.counter}
                    stop
        if {mining.%player%} is false:
            set {mining.%player%} to true
            stop

Not sure what's wrong with it but it's not working been trying to troubleshoot trying different things for an hour and I feel very stupid right now because it's probably a simple mistake.
[doublepost=1554067002,1553658434][/doublepost]bump
 
Try this:
Code:
on mine:
    event-block is stone or diamond ore or emerald ore or cobblestone or coal ore or iron ore or gold ore or redstone ore or lapis ore
    if {mining::%player%} is not set:
        set {mining::%player%::counter} to 0 if {mining::%player%::counter} is not set
        add 1 to {mining::%player%::counter}
        set {_v} to velocity of player
        delete {mining::%player%::counter} if abs(x of {_v})+z of {_v} != 0
        {mining::%player%::counter} >= 64
        make console execute command "dm open afkmine %player%"
        set {mining::%player%} to false
        delete {mining::%player%::counter}
    else:
        delete {mining::%player%}