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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    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.

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

Discussion in 'Skript' started by Natalciuu, Oct 4, 2021.

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

    Natalciuu Member

    Joined:
    Nov 12, 2020
    Messages:
    20
    Likes Received:
    0
    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 (Text):
    1. on bed enter:
    2.     if %{sleeping::*}% doesn't contain %player%:
    3.         add %player% to {sleeping::*}
    4.         if {playercount} is less than or equal to 2:
    5.             broadcast "&e%player% &7is now sleeping"
    6.             wait 35 ticks
    7.             set time to 7:00
    8.             clear {sleeping::*}
    9.             set weather to clear
    10.         else if {sleeping::*} = 1:
    11.             broadcast "&e%player% &7is now sleeping [1/2]"
    12.  
    13.         else if {sleeping::*} = 2:
    14.             broadcast "&e%player% &7is now sleeping [2/2]"
    15.             wait 35 ticks
    16.             set time to 7:00
    17.             clear {sleeping::*}
    18.             set weather to clear
    19.  
    20. on bed leave:
    21.     if player's name is %{sleeping::*}%:
    22.         remove %player% from {sleeping::*}
     
  2. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    142
    Likes Received:
    5
    Code (Text):
    1. on bed enter:
    2.     set {sleep::%player's uuid%} to player's uuid
    3.     broadcast "&e%player% &7is now sleeping [%size of {sleep::*}%/%size of all players / 2%]"
    4.     if size of {sleep::*} = (size of all players / 2):
    5.         wait 1.5 seconds
    6.         set time to 7:00
    7.         set weather to clear
    8.         delete {sleep::*}
    9.  
    10. on bed leave:
    11.     delete {sleep::%player's uuid%}
    You can try this, I haven't tested it at all though
     
Thread Status:
Not open for further replies.

Share This Page

Loading...