How to stop negative durability?

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

Lokito

Member
Apr 12, 2023
1
0
1
25
Code:
on break of any log:
   if {timber::%player%} is true:
        if player is holding axe:
            loop blocks upwards:
                if loop-block is any log:
                   drop loop-block-1 at event-block
                    set loop-block to air
                    loop blocks in radius 3 around loop-block:
                        if loop-block-2 is any log:
                           drop loop-block-2 at event-block
                            set loop-block-2 to air
                            add 2 to the player's held item's damage
            loop blocks below:
                if loop-block is any log:
                   drop loop-block-1 at event-block
                    set loop-block to air
                    loop blocks in radius 3 around loop-block:
                        if loop-block-2 is log:
                           drop loop-block-2 at event-block
                            set loop-block-2 to air

on break of any wood:
   if {timber::%player%} is true:
        if player is holding axe:
            loop blocks upwards:
                if loop-block is any log:
                   drop loop-block-1 at event-block
                    set loop-block to air
                    loop blocks in radius 3 around loop-block:
                        if loop-block-2 is any log:
                           drop loop-block-2 at event-block
                            set loop-block-2 to air
                            add 2 to the player's held item's damage
            loop blocks below:
                if loop-block is any log:
                   drop loop-block-1 at event-block
                    set loop-block to air
                    loop blocks in radius 3 around loop-block:
                        if loop-block-2 is log:
                           drop loop-block-2 at event-block
                            set loop-block-2 to air

These are my current arguments for when a player goes up to a tree to use the plugin, currently what seems to happen is when the player has timber mode on, it will allow their axe to go into negative durability, but once they disable timber and try to break a tree the axe disappears.

Would greatly appreciate any kind of code line that can help me get the tool to break if it reaches 0 durability.
 
Code:
on break of any log:
   if {timber::%player%} is true:
        if player is holding axe:
            loop blocks upwards:
                if loop-block is any log:
                   drop loop-block-1 at event-block
                    set loop-block to air
                    loop blocks in radius 3 around loop-block:
                        if loop-block-2 is any log:
                           drop loop-block-2 at event-block
                            set loop-block-2 to air
                            add 2 to the player's held item's damage
            loop blocks below:
                if loop-block is any log:
                   drop loop-block-1 at event-block
                    set loop-block to air
                    loop blocks in radius 3 around loop-block:
                        if loop-block-2 is log:
                           drop loop-block-2 at event-block
                            set loop-block-2 to air

on break of any wood:
   if {timber::%player%} is true:
        if player is holding axe:
            loop blocks upwards:
                if loop-block is any log:
                   drop loop-block-1 at event-block
                    set loop-block to air
                    loop blocks in radius 3 around loop-block:
                        if loop-block-2 is any log:
                           drop loop-block-2 at event-block
                            set loop-block-2 to air
                            add 2 to the player's held item's damage
            loop blocks below:
                if loop-block is any log:
                   drop loop-block-1 at event-block
                    set loop-block to air
                    loop blocks in radius 3 around loop-block:
                        if loop-block-2 is log:
                           drop loop-block-2 at event-block
                            set loop-block-2 to air

These are my current arguments for when a player goes up to a tree to use the plugin, currently what seems to happen is when the player has timber mode on, it will allow their axe to go into negative durability, but once they disable timber and try to break a tree the axe disappears.

Would greatly appreciate any kind of code line that can help me get the tool to break if it reaches 0 durability.
this isn't really a 'fix' but just make a function, that would damage the tool, and in that function check if the durability is below 0 if so remove the tool
 
Status
Not open for further replies.