Solved Bug machine

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

TDragon_

Active Member
Jul 19, 2018
86
1
0
22
Skript Version: Skript 2.2
Skript Author: Bensku
Minecraft Version: 1.8 (spigot)

---

code_language.skript:
on left-click on iron block:
    if player's tool is a lever of silk touch 1 named "&8Ferramenta":
        set {_p} to "%player%" parsed as player
        wait 3 ticks
        open chest with 3 rows named "Painel" to player
        format slot 13 of player with gray dye named "&7Ligar/Desligar" with lore "&7Status: &cDesligada" to close
        format slot 15 of player with skull of {_p} named "&cDono" with lore "&e%player%" to close
        format slot 11 of player with iron block named "&"

on left-click on iron block:
    if player's tool is a diamond pickaxe of silk touch 1 named "&2Quebradora de MAQUINAS":
        send "&aMaquina quebrada com sucesso"
        drop 1 stone named "&eMaquina de &7Pedra"
        set the block to air

on right-click on iron block:
    if player's tool is a coal named "&7Combustivel" with lore "&f1 minuto":
        send "&aMaquina ligada com sucesso!"
        remove 1 coal from the player
        loop 10 times:
            wait 5 seconds
            drop 1 stone
            wait a tick
        send "&cO combustivel da sua maquina acabou!"

Errors on Reload:

code_language.skript:
I tested but forgot

Console Errors:

code_language.skript:
I tested but forgot

Other Useful Info:

Addons using (including versions):
None

Troubleshooting:

Have you tried searching the docs? Yes
Have you tried searching the forums? Yes

Well, recently I'm doing a skript of machines, but there's a problem I'm facing that's wrecking everything. In all machine skrips you have ways to circumvent the skript, taking the machine without having to buy. I even created a pick to break machines, but if the player buys and uses in a block that is the same as the machine, he can pick it up, without even, as I said, buying it. And there is the problem of fuel, which has as its catch and put it in any block that is equal to the block of the machine, as said before, to generate items. Can someone help me? Do you know why, I know, a variable in it? So there are no bugs like the ones I said?
 
Last edited:
1. 'on left click' no -
2. for tool named use like 'if player's tool's display name is "YourName":' and test lore on another line
From the tool, right?
[doublepost=1533345702,1533343659][/doublepost]
1. 'on left click' no -
In case, you should be talking about the part that presses left button with the pick in the block, well it is to drop the machine
[doublepost=1534645390][/doublepost]
Hey, can you detect when the player moves? Type an on move?
 
There is an event ON MOVE ON (or on stop on) which could work, but i personally find it a pain in the butt to work with. I find that sometimes it doenst capture the event properly. BUT give it a try and see if it works out for you
Is there a way to create a delay when I right-click a block holding an item? Like a machine, when you press the right button on the machine with a coal, you have to wait until the fuel runs out so you can put it on again?
 
Yeah... just create a variable on your first click that = now
ie:
code_language.skript:
set {variable::%player%} to now
then for subsequent clicks after that, just check the difference between the variable and now,
code_language.skript:
if difference between {variable::%player%} and now >= 15 seconds:
    #proceed with code here
else:
    cancel event
    send "NOPE"
 
Do I need to be under the "if difference between {variable::%player%} and now >= 15 seconds:"?
Im not sure what you mean by "Do I need to be under"
The code is basically saying if the difference between the variable and now is greater than or equal to 15, proceed with your code.... else cancel and send a NO type message
 
Im not sure what you mean by "Do I need to be under"
The code is basically saying if the difference between the variable and now is greater than or equal to 15, proceed with your code.... else cancel and send a NO type message
I asked if it was necessary to .-.
 
If what is necessary?
Never mind, my friend
[doublepost=1535854563,1535851193][/doublepost]
If what is necessary?
Hey pal, could you fix it for me? I am dumb ;-;
code_language.skript:
on rightclick on {@bloco}:
    if player is holding coal named "&7Combustivel" with lore "&f1 minuto":
        if difference between {cooldown1::%player%} and now >= 15 seconds:
            set {cooldown1::%player%} to now
            if {maquina.%location at block%} is set:
                if {d.%event-location%} is true:
                set {d.%event-location%} to true
                send "&aMaquina funcionando!"
                remove 1 coal from the player's inventory
                loop 5 times:
                    wait 5 seconds
                    drop {@drop1} {@drop}
                    wait a tick
                send "&cO combustivel da sua maquina acabou!"
        else:
            cancel event
            send "&cVocê precisa esperar &f%{cooldown1::%player%}% s &cpara por mais combustivel"
 
Never mind, my friend
[doublepost=1535854563,1535851193][/doublepost]
Hey pal, could you fix it for me? I am dumb ;-;
code_language.skript:
on rightclick on {@bloco}:
    if player is holding coal named "&7Combustivel" with lore "&f1 minuto":
        if difference between {cooldown1::%player%} and now >= 15 seconds:
            set {cooldown1::%player%} to now
            if {maquina.%location at block%} is set:
                if {d.%event-location%} is true:
                set {d.%event-location%} to true
                send "&aMaquina funcionando!"
                remove 1 coal from the player's inventory
                loop 5 times:
                    wait 5 seconds
                    drop {@drop1} {@drop}
                    wait a tick
                send "&cO combustivel da sua maquina acabou!"
        else:
            cancel event
            send "&cVocê precisa esperar &f%{cooldown1::%player%}% s &cpara por mais combustivel"
fix what? What exactly is broken?
 
fix what? What exactly is broken?
When I right click on the machine it will not, the message after the else
[doublepost=1536002418,1535856336][/doublepost]
fix what? What exactly is broken?
Does it fix for me?
[doublepost=1536441936][/doublepost]
fix what? What exactly is broken?
Hey, man? Could you help me with something? Is that I used this code but it is giving an error

Code:
code_language.skript:
if player is holding coal named "&7Combustivel" with lore "&f1 minuto":

Error:
code_language.skript:
[18:20:40 ERROR]: Can't compare a player with 'holding coal named "&7Combustivel" with lore "&f1 minuto"' (testebloco.sk, line 16: if player is holding coal named "&7Combustivel" with lore "&f1 minuto":')
 
Status
Not open for further replies.