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.

Help With Player Vars

Discussion in 'Skript' started by HonestlyPanda, Mar 5, 2022.

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

    HonestlyPanda Member

    Joined:
    May 19, 2021
    Messages:
    38
    Likes Received:
    0
    Im making a partical command for all players but my code doesnt work.. what is wrong with it??


    Code (Text):
    1. command /raincloud:
    2.     trigger:
    3.         if {raincloud::%player's uuid%} is false:
    4.             set {rancloud::%player's uuid%} to true
    5.             send "&aRaincloud Enabled!"
    6.         else if {raincloud::%player's uuid%} is true:
    7.             send "&cRaincloud Disabled!"
    8.             set {raincloud::%player's uuid%} to false
    9.        
    10. every 1 second:
    11.     if {raincloud::%player's uuid%} is set to true:
    12.         play cloud above player
     
  2. Jacob105

    Jacob105 Member

    Joined:
    Aug 7, 2020
    Messages:
    48
    Likes Received:
    1
    Code (Text):
    1. if {raincloud::%player's uuid%} is set to true:
    2.  
    should be
    Code (Text):
    1. if {raincloud::%player's uuid%} is true:
    2.  
     
    • Agree Agree x 1
  3. HonestlyPanda

    HonestlyPanda Member

    Joined:
    May 19, 2021
    Messages:
    38
    Likes Received:
    0
    hey i know im a bit late, but for
    1. if {raincloud::%player's uuid%} is true:

    it says "theres no player in a periodical event!"

    idk if i need an addon or something else but it just doesnt work...
     
  4. Orangesanta8415

    Joined:
    Nov 21, 2020
    Messages:
    38
    Likes Received:
    0
    When trying to check all players for something, you need to loop them like this.

    Code (Text):
    1.  
    2. every 1 second:
    3.     loop all players:
    4.         if {raincloud::%loop-player's uuid%} is set to true:
    5.             play cloud above loop-player
    Not tested
     
    • Agree Agree x 1
  5. HonestlyPanda

    HonestlyPanda Member

    Joined:
    May 19, 2021
    Messages:
    38
    Likes Received:
    0
    hmm.. still doesnt work. same error message... do i need an addon maybe?
     
  6. yea rite

    yea rite Active Member

    Joined:
    Jul 11, 2021
    Messages:
    73
    Likes Received:
    5
    You should avoid using loop all players, and especially this often. Instead use the all players expression

    Code (Text):
    1. every second:
    2.   play cloud above all players where [{raincloud::%input%} is true]
    basically what my code does is play the particle at the all players with the variable set to true
     
    #6 yea rite, Mar 25, 2022
    Last edited: Mar 25, 2022
  7. HonestlyPanda

    HonestlyPanda Member

    Joined:
    May 19, 2021
    Messages:
    38
    Likes Received:
    0
    this had the best result but still doesnt work. there is no error message but this time the toggle doesnt work and no particals show up.. do you use an addon that i might not have??
     
  8. yea rite

    yea rite Active Member

    Joined:
    Jul 11, 2021
    Messages:
    73
    Likes Received:
    5
    This should work without addons. Ill test it out and see if I can fix it
    --- Double Post Merged, Mar 25, 2022, Original Post Date: Mar 25, 2022 ---
    My response works for me, but the particle spawns inside the player.
    --- Double Post Merged, Mar 25, 2022 ---
    Here is what i did to make it above the player
    Code (Text):
    1.  
    2. every second:
    3.   play cloud 2.4 above all players where [{raincloud::%input%} is true]
    --- Double Post Merged, Mar 26, 2022 ---
    Ive just realised its because youre using uuids. All you have to do is change %input% to %input's uuid%
     
  9. HonestlyPanda

    HonestlyPanda Member

    Joined:
    May 19, 2021
    Messages:
    38
    Likes Received:
    0
    huh still doesnt work. the particals dont show up...
     
  10. yea rite

    yea rite Active Member

    Joined:
    Jul 11, 2021
    Messages:
    73
    Likes Received:
    5
    make sure your particles are set to the proper setting in video setting
     
  11. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    145
    Likes Received:
    5
    you have to loop for players and use loop player
     
  12. HonestlyPanda

    HonestlyPanda Member

    Joined:
    May 19, 2021
    Messages:
    38
    Likes Received:
    0
    nope, same error message: There's no player in a periodical event
    btw the problem is in "if {raincloud::%player's uuid%} is set to true:"
     
  13. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    145
    Likes Received:
    5
    Code (Text):
    1. #You tried this?
    2. every 1 second:
    3.     loop all players:
    4.         if {raincloud::%loop-player's uuid%} is set to true:
    5.             play cloud above loop-player
     
  14. Orangesanta8415

    Joined:
    Nov 21, 2020
    Messages:
    38
    Likes Received:
    0
    uuid of player not player's uuid

    also have you set the variable to false because if it hasnt been set to anything it cant compare
     
  15. EtoNikei

    EtoNikei New Member

    Joined:
    Oct 19, 2020
    Messages:
    3
    Likes Received:
    0
    I would prefer such a code due to performance savings, if it works, of course, I did not carry out checks. It would also not hurt to add checks for the presence of rights, if you require it.

    Code (Text):
    1. command /raincloud:
    2.   trigger:
    3.     if {players::%uuid of player%::raincloud} is false:
    4.       set {players::%uuid of player%::raincloud} to true
    5.       message "&a[!] Raincloud successfully enabled."
    6.       applyEffect(player)
    7.       exit
    8.     set {players::%uuid of player%::raincloud} to false
    9.     message "&c[!] Raincloud successfully disabled."
    10.  
    11. function applyEffect(p: player):
    12.   if {players::%uuid of {_p}%::raincloud} isn't set:
    13.     stop
    14.   while true is true:
    15.     if {players::%uuid of {_p}%::raincloud} is false:
    16.       stop
    17.     play CLOUD above {_p}
    18.     loop 20 times:
    19.       wait tick
    20.  
    21. on join:
    22.   applyEffect(player)
     
  16. HonestlyPanda

    HonestlyPanda Member

    Joined:
    May 19, 2021
    Messages:
    38
    Likes Received:
    0
    I got it to work :emoji_slight_smile: Thanks guys
     
Thread Status:
Not open for further replies.

Share This Page

Loading...