#Gen error

1 messages · Page 1 of 1 (latest)

main temple
#

So if a player places a gen on the road they get an error message saying "You cant build here!" and it spawns wheat on the road

#

So how do i make so it checks if its able to place or not and it cancel?

#
    if lore of player's held item contains "&bShift + Right-Click to upgrade!":
        if {gens::placed::%player's uuid%} >= {gens::max::%player's uuid%}:
            cancel event
            send "&c&lERROR: &7You don't have enough generator slots." to player 
            play sound "entity.villager.no" with volume 100 and pitch 2 to player 
        else:
            add 1 to {gens::placed::%player's uuid%}
            send "&a&lSUCCESS: &7You have placed your &eWheat Generator" to player 
            add location of event-block to {gens::drop::%player's uuid%::1::*} 
            play sound "block.note_block.bell" with volume 100 and pitch 1 to player 
            set {gen.by.%event-block's location%} to player's uuid ```
jaunty rune
#

Uncancel event

jovial urchin
#

Bro my discord is buggin

jaunty rune
#

Oh wait

main temple
#

Where should i add cancel event?

jaunty rune
#

Just check if the event is cancelled

#

canceled

main temple
#

How do i do that?

jaunty rune
#

stop if event is canceled

#

Put that right under the on right click line

jovial urchin
#

👍

main temple
#

u mean on place of hay bal?

jaunty rune
#

oh yeah

#

oops lol

main temple
#

i just checked and it didnt fix 😦

jaunty rune
#

How

#

Send code

#

oh

main temple
#
    stop if event is canceled
    if lore of player's held item contains "&bShift + Right-Click to upgrade!":
        if {gens::placed::%player's uuid%} >= {gens::max::%player's uuid%}:
            cancel event
            send "&c&lERROR: &7You don't have enough generator slots." to player 
            play sound "entity.villager.no" with volume 100 and pitch 2 to player 
        else:
            add 1 to {gens::placed::%player's uuid%}
            send "&a&lSUCCESS: &7You have placed your &eWheat Generator" to player 
            add location of event-block to {gens::drop::%player's uuid%::1::*} 
            play sound "block.note_block.bell" with volume 100 and pitch 1 to player 
            set {gen.by.%event-block's location%} to player's uuid ```
jaunty rune
#

maybe wait a tick

#

wait 1 tick
stop if event is canceled

#

Event Priority can also work I think

main temple
#
    wait 1 tick
    stop if event is canceled
    if lore of player's held item contains "&bShift + Right-Click to upgrade!":
        if {gens::placed::%player's uuid%} >= {gens::max::%player's uuid%}:
            cancel event
            send "&c&lERROR: &7You don't have enough generator slots." to player 
            play sound "entity.villager.no" with volume 100 and pitch 2 to player 
        else:
            add 1 to {gens::placed::%player's uuid%}
            send "&a&lSUCCESS: &7You have placed your &eWheat Generator" to player 
            add location of event-block to {gens::drop::%player's uuid%::1::*} 
            play sound "block.note_block.bell" with volume 100 and pitch 1 to player 
            set {gen.by.%event-block's location%} to player's uuid ```
#

wait why did that turn into a error?

jaunty rune
#

Yeah um I think thats a problem

#

Try event priority

main temple
#

What is that?

jaunty rune
#

Which idk the syntax for skript so maybe try googling

#

It's like the order

#

Which events get fired

#

right nkw

#

Your skript code is running before the plots code

main temple
#

oh

jaunty rune
#

here actually

#

Try this

#

Let me right it

#

Brb

main temple
#

alright

jaunty rune
#
    stop if event is canceled
    if lore of player's held item contains "&bShift + Right-Click to upgrade!":
        if {gens::placed::%player's uuid%} >= {gens::max::%player's uuid%}:
            cancel event
            send "&c&lERROR: &7You don't have enough generator slots." to player 
            play sound "entity.villager.no" with volume 100 and pitch 2 to player
            stop
        wait 1 tick
        stop if event is canceled
        add 1 to {gens::placed::%player's uuid%}
        send "&a&lSUCCESS: &7You have placed your &eWheat Generator" to player 
        add location of event-block to {gens::drop::%player's uuid%::1::*} 
        play sound "block.note_block.bell" with volume 100 and pitch 1 to player 
        set {gen.by.%event-block's location%} to player's uuid```
#

Does this work

main temple
#

lemme see

#

IT WORKS!!!!!!!!!

#

Also

#

another error from before

#

The wheat is still spawning

#

From nowhere

#

it should maybe check if the gen is placed or not

#

@jaunty rune

jaunty rune
#

Yo what

#

How

main temple
#

idkk

#

its from before

jaunty rune
#

Oh just delete the variable associated with them

main temple
#

and replace?

#

maybe i should delete whole skript and then paste it in again?

jaunty rune
#

Nono

#

Your server is still in testing phase right

#

You can just wipe all the gens

main temple
#

how do i do that?

jaunty rune
#

delete {gens::drop::%player's uuid%::1::*}
delete {gen.by.%event-block's location%}

main temple
#

okay nice

#

should i make it as an command?

#

or use !

#

nvm i cant use !

jaunty rune
#

U can edym

#

you just can't use it for the 2nd ljne

#

line

main temple
#

yea

#

so imma make it a command

#
    permission: cmd.resetall
    trigger:
        loop all players:
            delete {gens::drop::%loop-player's uuid%::1::*}
            delete {gen.by.%event-block's location%}```
#

is this looking good?

#

@jaunty rune

jaunty rune
#

no

#

%event-block% doesn't exist

#

what you can do is loop {gens::drop::...*} because it stores all the block locations

main temple
#

i think only the first "delete" had everything stored