Solved unbrakable blocks

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

    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.

jelen51

Member
Feb 19, 2022
11
0
1
hi i am making a server and i need to have blocks that are unbrekable
but if you are the one that placed them or you have special tool you can break them
also i need them to dissapear after time of 30min
 
I made it right now, it will prob wont work like this, but thats what you will need


Code:
on break:
    if event-block is dirt:
        cancel event
    else if player's item is stick:
        stop

on place:
    if event-block is dirt
        wait 30 minutes
        set event-block to air
 
I made it right now, it will prob wont work like this, but thats what you will need


Code:
on break:
    if event-block is dirt:
        cancel event
    else if player's item is stick:
        stop

on place:
    if event-block is dirt
        wait 30 minutes
        set event-block to air

That wouldn't work, yes.
But as I said, this is more of a request
 
hi i am making a server and i need to have blocks that are unbrekable
but if you are the one that placed them or you have special tool you can break them
also i need them to dissapear after time of 30min
with this code you can remove blocks every 30 minutes
Code:
#If you want the to disapear 1 by one
on place:
    set {_blockloc} to location of event-block
    add {_blockloc} to {blocks::*}
    wait 30 minute
    set event-block to air
    remove {_blockloc} from {blocks::*}

#remove all blocks on unload
on unload:
    loop {blocks::*}:
        set block at location at loop-value to air
        remove loop-value from {blocks::*}
        wait a tick #small delay because else it will remove all blocks at once and this may cause lag

#If you just want to remove all blocks every 30 minutes'
on place:
    set {_blockloc} to location of event-block
    add {_blockloc} to {blocks::*}

every 30 minutes:
    loop {blocks::*}:
        set block at location at loop-value to air
        remove loop-value from {blocks::*}
        wait a tick #small delay because else it will remove all blocks at once and this may cause lag
 
Code:
options:
    stayTime: 30
    specialTool: barrier

function removeBlock(loc: location):
    set block at {_loc} to air
    remove {_loc} from {block::all::*}
    delete {block::owner::%{_loc}%}
    delete {block::timeleft::%{_loc}%}

on place:
    add location of block to {block::all::*}
    set {block::owner::%location of block%} to player
    set {block::timeleft::%location of block%} to {@stayTime}
    
on block break:
    if {block::owner::%location of event-block%} is player:
        removeBlock(location of block)
    else if tool of player is {@specialTool}:
        removeBlock(location of event-block)
    else:
        cancel event
        
every 1 minute:
    loop {block::all::*}:
        remove 1 from {block::timeleft::%loop-value%}
        if {block::timeleft::%loop-value%} is less than 0:
            removeBlock(loop-value)
 
Status
Not open for further replies.