Solved Autopickup script not working

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

Mesure73L

New Member
Feb 10, 2024
8
0
1
meusre.x10.mx
Hello! I am making a server and I need an autopickup plugin. I tried this script:
code_language.skript:
on mine:
    if event-block is dirt block:
        give player 1 dirt block
    else if event-block is stone block:
        give player 1 cobblestone
    else if event-block is coal ore:
        give player 1 coal
    else if event-block is iron ore:
        give player 1 iron ingot
    else if event-block is emerald ore:
        give player 1 emerald
    else if event-block is lapis ore:
        give player 1 lapis lazuli
    else if event-block is redstone ore:
        give player 1 redstone dust
    else if event-block is diamond ore:
        give player 1 diamond
It works for dirt but not for stone, coal, iron, emerald, lapis, redstone, or diamond.
 
Big problem with this tho, When a player mines a block, they get the item and the dropped item. So when you write
Code:
on mine:
just after that write
Code:
clear all drops

full code:
Code:
on mine:
    clear all drops
    give player 1 event-block

and then add any "if" statements for specific items like ores
 
Big problem with this tho, When a player mines a block, they get the item and the dropped item. So when you write
Code:
on mine:
just after that write
Code:
clear all drops

full code:
Code:
on mine:
    clear all drops
    give player 1 event-block

and then add any "if" statements for specific items like ores
Don't worry, I disabled the doTileDrops gamerule before writing this script
 
Try:


code_language.skript:
on mine:
    give player drops
    clear drops

This will give the player the exact drops.
 
Try:


code_language.skript:
on mine:
    give player drops
    clear drops

This will give the player the exact drops.
I do not want it to be the exact drops. I want it to be the drops that I listed in my original post.

So have u tested my skript yet. You can remove "clear all drops"
I don’t need help with that part of it. I need help with checking what block was mined and giving something based upon that. It works for the dirt mine but nothing else. That’s all I’m trying to fix.
 
this should work
Code:
on mine:
    if event-block is dirt block:
        give player 1 dirt block
        clear drops
    else if event-block is stone block:
        give player 1 cobblestone block
        clear drops
    else if event-block is coal ore:
        give player 1 coal
        clear drops
    else if event-block is iron ore:
        give player 1 iron ingot
        clear drops
    else if event-block is emerald ore:
        give player 1 emerald
        clear drops
    else if event-block is lapis ore:
        give player 1 lapis lazuli
        clear drops
    else if event-block is redstone ore:
        give player 1 redstone
        clear drops
    else if event-block is diamond ore:
        give player 1 diamond
        clear drops
this may lag your server if you have multiple people mining at once as its checking so much
 
Code:
on mine:
    clear drops
    if event-block is diamond ore:
        give player (random integer between 1 and 3) diamonds
    else:
        give player drops

This is potential code, copy and paste the "if" part for other blocks
 
this should work
Code:
on mine:
    if event-block is dirt block:
        give player 1 dirt block
        clear drops
    else if event-block is stone block:
        give player 1 cobblestone block
        clear drops
    else if event-block is coal ore:
        give player 1 coal
        clear drops
    else if event-block is iron ore:
        give player 1 iron ingot
        clear drops
    else if event-block is emerald ore:
        give player 1 emerald
        clear drops
    else if event-block is lapis ore:
        give player 1 lapis lazuli
        clear drops
    else if event-block is redstone ore:
        give player 1 redstone
        clear drops
    else if event-block is diamond ore:
        give player 1 diamond
        clear drops
this may lag your server if you have multiple people mining at once as its checking so much
I'll try it later, but just letting you know, you can put the clear drops outside of the if statements to make the code smaller.
Either way, I don't need the clear drops because I set a gamerule to prevent blocks from being dropped.

Code:
on mine:
    clear drops
    if event-block is diamond ore:
        give player (random integer between 1 and 3) diamonds
    else:
        give player drops

This is potential code, copy and paste the "if" part for other blocks
I'll try it later, but I just want to repeat:
I know how to do the if statements and stuff. The only thing I need help with is only dirt blocks work.

Thanks for the help!