Machine wont shut off after i log off server

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

Mattllama987

Active Member
Aug 5, 2018
225
7
18
24
Hello, im working on a machine that will add +1 to my rings while im online. Rings are my currency. But i have the machine do a few things. When you go afk, it will stop the machine. That works. When you come back from being afk, it turns on. That works. But when i log out of the server, i want the machine to shut off. But it still continues to add +1 after i logout of the server. Ive tried a few ways to get it to work, and all ways do the same. It wont shut off when i logout. If anyone knows how to get it to work, please let me know asap.

Thanks!
~Matt

CODE:
Code:
import:
    org.bukkit.Bukkit
    net.ess3.api.events.AfkStatusChangeEvent
on load:
    set {Essentials} to Bukkit.getPluginManager().getPlugin("Essentials")
on AfkStatusChangeEvent:
    wait 1 tick
    set {p} to "%event.getAffected().getName()%" parsed as player
    if {Essentials}.getUser({p}).isAfk() = true:
        set {autorings::on::%{p}%} to false
    if {Essentials}.getUser({p}).isAfk() = false:
        set {autorings::on::%{p}%} to true
on place of end rod:
    if name of player's held item contains "&cRings Machine":
        if {autorings::placed::%player%} isn't set:
            set {autorings::placed::%player%} to location of event-block
            send "&aYou have placed your Rings Machine!" to player
            set {autorings::on::%player%} to true
            while {autorings::on::%player%} is true:
                loop blocks in radius {autorings::upgrades::%player%} of player:
                    if loop-block is end rod:
                        if location at loop-block is {autorings::placed::%player%}:
                            if {Essentials}.getUser(player).isAfk() = false:
                                if {autorings::on::%player%} is true:
                                    add 1 to {autorings::%player%}
                wait "%{autorings::speed::%player%}% seconds" parsed as time span
        else:
            cancel event
            send "&cYou already have a auto rings machine placed down! Pickup your machine to place a new one."
on quit:
    wait 1 seconds
    set {autorings::on::%player%} to false
on join:
    wait 1 seconds
    set {autorings::on::%player%} to true
 
Last edited:
Status
Not open for further replies.