Auto Miner

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

Tropical

Member
Jan 29, 2017
19
0
1
29
Category: Misc

Suggested name: AutoMiner

What I want:
Staff do /autominer give <username> to give that user a Dropper (named "&c&lAuto Miner") Users place that dropper, and whatever block is in front of the mouth of the Dropper, is automatically mined every second. The item is broken like Vanilla Minecraft. It's broken, the item is dropped.

Ideas for commands:
/autominer give <username> - Gives that user a Auto Miner.

Ideas for permissions:
autominer.admin - Access to /autominer give

When I'd like it by: A reasonable time
 
Shouldn't be hard. I coding it under 5min.

i didn't tested it. cuz i gonna get now sleep.


code_language.skript:
command /autominer [<text>] [<player>]:
    trigger:
        if arg-1 is set:
            if arg-2 is set:
                give dropper named "Auto Miner" to arg-2
                send "he got it"
                send "You got it" to arg-2
            else:
                send "arg-2 missed"
        else:
            send "arg-1 missed"
           
on place of dropper:
    if name of event-item is "Auto Miner":
        set {AutoMiner::%player%::%location of event-block%} to true
        set {AutoMinerL::%location of event-block%} to player
        send "please Rejoin to active the Autominer!"
       
on break of dropper:
    if {AutoMinerL::%location of event-block%} is set:
        if {AutoMinerL::%location of event-block%} is not player:
            cancel event
            send "nah you can't"
        else:
            delete {AutoMinerL::%location of event-block%}
            delete {AutoMiner::%player%::%location of event-block%}
            cancel event
            set event-block to air
            give dropper named "Auto Miner" to player
            send "you breaking your miner"
       
on join:
    while player is online:
        if {AutoMiner::%player%::*} is set:
            wait a seconds
            loop {AutoMiner::%player%::*}:
                set {_l} to loop-index parsed as location
                block in front of {_l} is set
                drop block at front of {_l} to front of {_l}
                set block at front of {_l} to air  
        else:
            stop loop

#edit:

There may maybe can be smaller. But my brain is death. need to sleep. :x
 
Shouldn't be hard. I coding it under 5min.

i didn't tested it. cuz i gonna get now sleep.


code_language.skript:
command /autominer [<text>] [<player>]:
    trigger:
        if arg-1 is set:
            if arg-2 is set:
                give dropper named "Auto Miner" to arg-2
                send "he got it"
                send "You got it" to arg-2
            else:
                send "arg-2 missed"
        else:
            send "arg-1 missed"
          
on place of dropper:
    if name of event-item is "Auto Miner":
        set {AutoMiner::%player%::%location of event-block%} to true
        set {AutoMinerL::%location of event-block%} to player
        send "please Rejoin to active the Autominer!"
      
on break of dropper:
    if {AutoMinerL::%location of event-block%} is set:
        if {AutoMinerL::%location of event-block%} is not player:
            cancel event
            send "nah you can't"
        else:
            delete {AutoMinerL::%location of event-block%}
            delete {AutoMiner::%player%::%location of event-block%}
            cancel event
            set event-block to air
            give dropper named "Auto Miner" to player
            send "you breaking your miner"
      
on join:
    while player is online:
        if {AutoMiner::%player%::*} is set:
            wait a seconds
            loop {AutoMiner::%player%::*}:
                set {_l} to loop-index parsed as location
                block in front of {_l} is set
                drop block at front of {_l} to front of {_l}
                set block at front of {_l} to air 
        else:
            stop loop

#edit:

There may maybe can be smaller. But my brain is death. need to sleep. :x
There's no loop that matches 'loop-index parsed as location' (AutoMiner.sk, line 37: set {_l} to loop-index parsed as location')

[18:18:57 ERROR]: '{_l} to front' is not a number (AutoMiner.sk, line 39: drop block at front of {_l} to front of {_l}')

[18:18:57 ERROR]: 'front' is not a number (AutoMiner.sk, line 40: set block at front of {_l} to air')