Executing skript only for online players

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

RaXeD

Member
May 2, 2020
3
0
0
25
I have the following skript:

https://pastebin.com/b9xnBAKw

It's basically an item generator where a specified item will generate on top of a specified block that players place, the problem is that this gets extremely laggy as more and more generators are placed, is there any way to eliminate the lag?

I was thinking of only making the item spawn if the player that placed the generator is online and I'm new to skript but not coding in general so I would assume that I have to check a list with all online players against the saved uuid's of the players that have placed a generator but wouldn't that get laggy as well after a while?

anyway, not sure what I can do about this any help would be greatly appreciated.
 
You could make it so that when the players right-click the generator, a gui will be opened that allows you to take the generated items out of it, such that no items will be dropped on the ground
 
You could make it so that when the players right-click the generator, a gui will be opened that allows you to take the generated items out of it, such that no items will be dropped on the ground
That doesn't exactly fit with the theme of the server and plus I know that what I'm asking is possible so why compromise?
 
Code:
loop all players:
    if player is online:
        #do stuff
    else:
        stop

I don't think that can work since I have the locations saved in drops1
Code:
every 5 real seconds:
    drop 1 coal named "&0Coal &e($5)" at {drops1::*}
    drop 1 iron ingot named "&fIron Ingot &e($7.5)" at {drops2::*}
    drop 1 diamond named "&bDiamond &e($10)" at {drops3::*}
    drop 1 emerald named "&aEmerald &e($12.5)" at {drops4::*}
    drop 1 nether quartz named "&fNether Quartz &e($15)" at {drops5::*}
    drop 1 nether star named "&8Nether Star &e($17.5)" at {drops6::*}
    drop 1 obsidian named "&5Obsidian &e($20)" at {drops7::*}
    stop
 
Instead of every 5 seconds,
Put
Code:
on join:
        while player is online:
                wait 5 seconds
                #code
 
Status
Not open for further replies.