1. 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!


    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Machine wont shut off after i log off server

Discussion in 'Skript' started by Mattllama987, Nov 5, 2020.

Thread Status:
Not open for further replies.
  1. Mattllama987

    Mattllama987 Active Member

    Aug 5, 2018
    Likes Received:
    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.


    Code (Text):
    1. import:
    2.     org.bukkit.Bukkit
    3.     net.ess3.api.events.AfkStatusChangeEvent
    4. on load:
    5.     set {Essentials} to Bukkit.getPluginManager().getPlugin("Essentials")
    6. on AfkStatusChangeEvent:
    7.     wait 1 tick
    8.     set {p} to "%event.getAffected().getName()%" parsed as player
    9.     if {Essentials}.getUser({p}).isAfk() = true:
    10.         set {autorings::on::%{p}%} to false
    11.     if {Essentials}.getUser({p}).isAfk() = false:
    12.         set {autorings::on::%{p}%} to true
    13. on place of end rod:
    14.     if name of player's held item contains "&cRings Machine":
    15.         if {autorings::placed::%player%} isn't set:
    16.             set {autorings::placed::%player%} to location of event-block
    17.             send "&aYou have placed your Rings Machine!" to player
    18.             set {autorings::on::%player%} to true
    19.             while {autorings::on::%player%} is true:
    20.                 loop blocks in radius {autorings::upgrades::%player%} of player:
    21.                     if loop-block is end rod:
    22.                         if location at loop-block is {autorings::placed::%player%}:
    23.                             if {Essentials}.getUser(player).isAfk() = false:
    24.                                 if {autorings::on::%player%} is true:
    25.                                     add 1 to {autorings::%player%}
    26.                 wait "%{autorings::speed::%player%}% seconds" parsed as time span
    27.         else:
    28.             cancel event
    29.             send "&cYou already have a auto rings machine placed down! Pickup your machine to place a new one."
    30. on quit:
    31.     wait 1 seconds
    32.     set {autorings::on::%player%} to false
    33. on join:
    34.     wait 1 seconds
    35.     set {autorings::on::%player%} to true
    #1 Mattllama987, Nov 5, 2020
    Last edited: Nov 5, 2020
Thread Status:
Not open for further replies.

Share This Page