#trying to add a limit of a certain block someone can place

1 messages · Page 1 of 1 (latest)

errant stone
#

You can store in a variable the times that block was placed and remove 1 from that variable when that same block is broken... like this:

on place of chest:
    if {limit-chest::%player's uuid%} + 1 > 10:
        cancel event
        send "&cLimit reached for this block. &7(%{limit-chest::%player's uuid%}%/10)" to player
        stop
    add 1 to {limit-chest::%player's uuid%}
    send "&aBlock placed. &7(%{limit-chest::%player's uuid%}%/10)" to player


on break of chest:
    remove 1 from {limit-chest::%player's uuid%}
sterile marsh
#

and also, i assume that skript doesnt really function as its supposed to since if someone else breaks your placed block your counter wont go down

errant stone
#

In fact you could make that block can only be broken by the player who put it, skript works fine, you just have to code well.

Answering your first question, I don't know of a plugin that does that.

sterile marsh
#

and it to remove the max blocks from the person who placed it

errant stone
#

you can also do it, you could check if the block the player breaks was placed by another player (specifically their coordinates) and then remove 1 from the variable of the player who placed the block

sterile marsh
errant stone
#

In this case you will have to do it like this

on place of stone:
    if (size of {stoneLimit::%player's uuid%::*}) + 1 > 10:
        cancel event
        send "&cFALSE" to player
        stop
    add location((block's x coord), (block's y coord), (block's z coord), (block's world)) to {stoneLimit::%player's uuid%::*}
    send "&aTRUE &7(%size of {stoneLimit::%player's uuid%::*}%/10)" to player

on break of stone:
    set {_location} to location((block's x coord), (block's y coord), (block's z coord), (block's world))
    if {stoneLimit::%player's uuid%::*} contains {_location}:
        remove {_location} from {stoneLimit::%player's uuid%::*}
    else:
        loop (all offlineplayers):
            {stoneLimit::%loop-offlineplayer's uuid%::*} contains {_location}
            remove {_location} from {stoneLimit::%loop-offlineplayer's uuid%::*}
            send "&aTRUE &7(%size of {stoneLimit::%loop-offlineplayer's uuid%::*}%/10)" to (loop-offlineplayer, player)
            stop
#

ignore the message that is shown when another player breaks the block, I should have modified it

sterile marsh
#

also is there a way to make it work for example all shulker boxes?

sterile marsh
#

nvm i found it

sterile marsh
errant stone
#

I meant that you can detect if the exploded block is on any player's list, and if so then you remove those coordinates from the list

sterile marsh
#

u helped me greatly 😄