Help With Player Vars

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

HonestlyPanda

Member
May 19, 2021
38
0
6
23
Im making a partical command for all players but my code doesnt work.. what is wrong with it??


Code:
command /raincloud:
    trigger:
        if {raincloud::%player's uuid%} is false:
            set {rancloud::%player's uuid%} to true
            send "&aRaincloud Enabled!"
        else if {raincloud::%player's uuid%} is true:
            send "&cRaincloud Disabled!"
            set {raincloud::%player's uuid%} to false
        
every 1 second:
    if {raincloud::%player's uuid%} is set to true:
        play cloud above player
 
Code:
if {raincloud::%player's uuid%} is set to true:
should be
Code:
if {raincloud::%player's uuid%} is true:
 
Code:
if {raincloud::%player's uuid%} is set to true:
should be
Code:
if {raincloud::%player's uuid%} is true:
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...
 
When trying to check all players for something, you need to loop them like this.

Code:
every 1 second:
    loop all players:
        if {raincloud::%loop-player's uuid%} is set to true:
            play cloud above loop-player

Not tested
 
When trying to check all players for something, you need to loop them like this.

Code:
every 1 second:
    loop all players:
        if {raincloud::%loop-player's uuid%} is set to true:
            play cloud above loop-player

Not tested
You should avoid using loop all players, and especially this often. Instead use the all players expression

Code:
every second:
  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
 
Last edited:
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??
 
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??
This should work without addons. Ill test it out and see if I can fix it
[doublepost=1648247087,1648246713][/doublepost]My response works for me, but the particle spawns inside the player.
[doublepost=1648247228][/doublepost]Here is what i did to make it above the player
Code:
every second:
  play cloud 2.4 above all players where [{raincloud::%input%} is true]
[doublepost=1648256194][/doublepost]
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??
Ive just realised its because youre using uuids. All you have to do is change %input% to %input's uuid%
 
Im making a partical command for all players but my code doesnt work.. what is wrong with it??


Code:
command /raincloud:
    trigger:
        if {raincloud::%player's uuid%} is false:
            set {rancloud::%player's uuid%} to true
            send "&aRaincloud Enabled!"
        else if {raincloud::%player's uuid%} is true:
            send "&cRaincloud Disabled!"
            set {raincloud::%player's uuid%} to false
       
every 1 second:
    if {raincloud::%player's uuid%} is set to true:
        play cloud above player
you have to loop for players and use loop player
 
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:"
Code:
#You tried this?
every 1 second:
    loop all players:
        if {raincloud::%loop-player's uuid%} is set to true:
            play cloud above loop-player
 
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
 
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:
command /raincloud:
  trigger:
    if {players::%uuid of player%::raincloud} is false:
      set {players::%uuid of player%::raincloud} to true
      message "&a[!] Raincloud successfully enabled."
      applyEffect(player)
      exit
    set {players::%uuid of player%::raincloud} to false
    message "&c[!] Raincloud successfully disabled."

function applyEffect(p: player):
  if {players::%uuid of {_p}%::raincloud} isn't set:
    stop
  while true is true:
    if {players::%uuid of {_p}%::raincloud} is false:
      stop
    play CLOUD above {_p}
    loop 20 times:
      wait tick

on join:
  applyEffect(player)
 
Status
Not open for further replies.