I can't figure out how to find if a player's name is in a list var

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

Natalciuu

Member
Nov 12, 2020
20
0
1
21
I'm trying to make a one player sleep system, but its a little more complex. I could probably just find something to do the job but i'd rather not.

Code:

Code:
on bed enter:
    if %{sleeping::*}% doesn't contain %player%:
        add %player% to {sleeping::*}
        if {playercount} is less than or equal to 2:
            broadcast "&e%player% &7is now sleeping"
            wait 35 ticks
            set time to 7:00
            clear {sleeping::*}
            set weather to clear
        else if {sleeping::*} = 1:
            broadcast "&e%player% &7is now sleeping [1/2]"

        else if {sleeping::*} = 2:
            broadcast "&e%player% &7is now sleeping [2/2]"
            wait 35 ticks
            set time to 7:00
            clear {sleeping::*}
            set weather to clear

on bed leave:
    if player's name is %{sleeping::*}%:
        remove %player% from {sleeping::*}
 
I'm trying to make a one player sleep system, but its a little more complex. I could probably just find something to do the job but i'd rather not.

Code:

Code:
on bed enter:
    if %{sleeping::*}% doesn't contain %player%:
        add %player% to {sleeping::*}
        if {playercount} is less than or equal to 2:
            broadcast "&e%player% &7is now sleeping"
            wait 35 ticks
            set time to 7:00
            clear {sleeping::*}
            set weather to clear
        else if {sleeping::*} = 1:
            broadcast "&e%player% &7is now sleeping [1/2]"

        else if {sleeping::*} = 2:
            broadcast "&e%player% &7is now sleeping [2/2]"
            wait 35 ticks
            set time to 7:00
            clear {sleeping::*}
            set weather to clear

on bed leave:
    if player's name is %{sleeping::*}%:
        remove %player% from {sleeping::*}
Code:
on bed enter:
    set {sleep::%player's uuid%} to player's uuid
    broadcast "&e%player% &7is now sleeping [%size of {sleep::*}%/%size of all players / 2%]"
    if size of {sleep::*} = (size of all players / 2):
        wait 1.5 seconds
        set time to 7:00
        set weather to clear
        delete {sleep::*}

on bed leave:
    delete {sleep::%player's uuid%}
You can try this, I haven't tested it at all though
 
Status
Not open for further replies.