Solved Items still spawn

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

SuperTommyDog

Member
Sep 2, 2019
14
0
1
So i am trying to make a generator for a farming server and when you destroy the generator it keeps on spawning the items. It has 0 errors and i have no idea why it still spawns or how to make it so it doesn't. Please help.
Code:
on join:
    set {genlimit::%player%} to 20
    set {gens::%player%} to 0

on place:
    if event-block is a hay_block:
        if name of player's tool is "&e&lWheat":
            if {gens::%player%} >= {genlimit::%player%}:
                send "&6&lGen &6>> &cYou cannot place over %{genlimit::%player%}% Generators!"
                cancel event
            else:
                add 1 to {gens::%player%}
                set {_loc} to location of event-block
                add 2 to the y-coordinate of {_loc}
                add {_loc} to {wheatgen::*}
                send "&6&lGen &8>> &aYou have succefully placed generator %{gens::%player%}%"

every 7 seconds in world "Plots":
    drop 1 wheat at {wheatgen::*}

on break:
    if event-block is a hay_block:
        set {_deleteloc} to location of event-block
        remove {_deleteloc} from {wheatgen::*}
        remove 1 from {gens::%player%}
        send "&6&LGen &8>> &cYou have destroyed a generator you now have %{gens::%player%}%"
 
Last edited:
When you set the location of the generator you get the location of the hay bale and then add 2 to it's y coordinate but then you forget to add 2 to it's y coordinate again when you remove it.
 
Status
Not open for further replies.