Solved loop-player only working for me, not other 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 community!

    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.

Bradisswag

Member
Apr 14, 2018
4
0
0
www.zerodegreemc.com
Okay, i have spent a bunch of time wondering what have i done wrong and i have given up.
My problem is, when i run the command /zd restart 1 (restarting server in 1 minute) it will display a action bar, and a side bar to everyone in the loop all players list that gets updated every second, But it wont send the information to the player only me, i have even given the other player Op permissions and it still gets put on my screen, not theirs.

Here is the code:
http://www.hatebin.com/yamovqwdcy

Seriously, i do not know what i am doing wrong.
Please help!
The addons i am using are:
SkQuery-Lime https://cdn.skunity.com/2017/11/2479_44faa4528ff3b4fec01152e7a77e7278.jar
Umbaska 3.0: http://umbaska.co.uk/
Umbaska Core Module: http://nfell2009.uk/testing/umbaska/Core.jar (Make sure you place "Core.jar" in the plugins/Umbaska/modules folder!!!)
SkRayFall https://media.forgecdn.net/files/2531/555/skRayFall+v1.9.12.jar
 
are you referring to this part?
code_language.skript:
if arg 2 = 1:
                        message "{@p} &bRestart scheduled for %arg-2% minute."
                    if arg 2 > 1:
                        message "{@p} &bRestart scheduled for %arg-2% minutes."
Because if Im not mistaken, message only sends a message to the person who ran the command
 
are you referring to this part?
code_language.skript:
if arg 2 = 1:
                        message "{@p} &bRestart scheduled for %arg-2% minute."
                    if arg 2 > 1:
                        message "{@p} &bRestart scheduled for %arg-2% minutes."
Because if Im not mistaken, message only sends a message to the person who ran the command

No, i am referring to this part
code_language.skript:
#TIMER BEGINS               
every 1 second:
    loop all players:
        if {Timer.zerodegree.enabled} is true:
            if {Timer.zerodegree.check} is less than {Timer.zerodegree.timer}:
                if {@actionbar} is true:
                    set action bar of loop-player to "&cRestarting in: &b&l%{Timer.zerodegree.notify}% Seconds"
                if {@sidebar} is true:
                    set name of sidebar of loop-player to "{@p}"
                    set score "&aTime until restart:" in sidebar of loop-player to {Timer.zerodegree.notify}
                subtract 1 from {Timer.zerodegree.notify}
                add 1 to {Timer.zerodegree.check}
                stop
            else:
                if {Timer.zerodegree.check} = {Timer.zerodegree.timer}:
                    set action bar of loop-player to ""
                    wipe loop-player sidebar
                    set {Timer.zerodegree.enabled} to false
                    send "{@p} &c&lRESTARTING SERVER!." to loop-player
                    delete {Timer.zerodegree.start}
                    delete {Timer.zerodegree.check}
                    delete {Timer.zerodegree.timer}
                    stop
I know that
code_language.skript:
if arg 2 = 1:
                        message "{@p} &bRestart scheduled for %arg-2% minute."
                    if arg 2 > 1:
                        message "{@p} &bRestart scheduled for %arg-2% minutes."
Will send end the message to the player who did the command, that's the whole point of that.
But like the title suggests, the "loop all players" is not looping all players, instead is targeting me for some reason.
 
well what im confused by is you said
" it will display a action bar, and a side bar to everyone in the loop all players list that gets updated every second, But it wont send the information to the player only me,"
so it is sending them the actionbar/sidebar?
What do you mean by it won't send the information to the player?
What information?
 
well what im confused by is you said
" it will display a action bar, and a side bar to everyone in the loop all players list that gets updated every second, But it wont send the information to the player only me,"
so it is sending them the actionbar/sidebar?
What do you mean by it won't send the information to the player?
What information?
Let me explain what this piece of code is doing.
code_language.skript:
#TIMER BEGINS              
every 1 second:
    loop all players:
        if {Timer.zerodegree.enabled} is true:
            if {Timer.zerodegree.check} is less than {Timer.zerodegree.timer}:
                if {@actionbar} is true:
                    set action bar of loop-player to "&cRestarting in: &b&l%{Timer.zerodegree.notify}% Seconds"
                if {@sidebar} is true:
                    set name of sidebar of loop-player to "{@p}"
                    set score "&aTime until restart:" in sidebar of loop-player to {Timer.zerodegree.notify}
                subtract 1 from {Timer.zerodegree.notify}
                add 1 to {Timer.zerodegree.check}
                stop
            else:
                if {Timer.zerodegree.check} = {Timer.zerodegree.timer}:
                    set action bar of loop-player to ""
                    wipe loop-player sidebar
                    set {Timer.zerodegree.enabled} to false
                    send "{@p} &c&lRESTARTING SERVER!." to loop-player
                    delete {Timer.zerodegree.start}
                    delete {Timer.zerodegree.check}
                    delete {Timer.zerodegree.timer}
                    stop

Okay, so first it loops all players,
then finds out if one of the variables is true, (if its true it will move onto the next trigger)
then if check variable is less that the timer variable (check should be 0 by default, and timer variable is the time that the player inputs into the command.) If the check value is less than the timer value,
it will send out the action bar and side bar to all the players in the loop (if they are true, in this case they are.)
Then it subtracts a seconds (1) from the notify value (the value of however many seconds the player put in the command) by 1 second, and adds a second (1),
then runs through that process until the timer value is not enabled,
the timer value will be false when the check value is the same as the value the player put into the command.
When it is the same, it wipes the side and action bars, deletes values they are not needed anymore (resets them) and does whatever else like /restart.

What it is not doing is sending out the action bar and side bar to the players in the loop.
 
OHHHH i think i figured it out

Take out STOP
code_language.skript:
every 1 second:
    loop all players:
        if {Timer.zerodegree.enabled} is true:
            if {Timer.zerodegree.check} is less than {Timer.zerodegree.timer}:
                if {@actionbar} is true:
                    set action bar of loop-player to "&cRestarting in: &b&l%{Timer.zerodegree.notify}% Seconds"
                if {@sidebar} is true:
                    set name of sidebar of loop-player to "{@p}"
                    set score "&aTime until restart:" in sidebar of loop-player to {Timer.zerodegree.notify}
                subtract 1 from {Timer.zerodegree.notify}
                add 1 to {Timer.zerodegree.check}
                stop <<<<<-----------HERE

That is stopping your loop I think
 
OHHHH i think i figured it out

Take out STOP
code_language.skript:
every 1 second:
    loop all players:
        if {Timer.zerodegree.enabled} is true:
            if {Timer.zerodegree.check} is less than {Timer.zerodegree.timer}:
                if {@actionbar} is true:
                    set action bar of loop-player to "&cRestarting in: &b&l%{Timer.zerodegree.notify}% Seconds"
                if {@sidebar} is true:
                    set name of sidebar of loop-player to "{@p}"
                    set score "&aTime until restart:" in sidebar of loop-player to {Timer.zerodegree.notify}
                subtract 1 from {Timer.zerodegree.notify}
                add 1 to {Timer.zerodegree.check}
                stop <<<<<-----------HERE

That is stopping your loop I think

Okay, so Ive played round for a bit and have this,
code_language.skript:
every 1 second:
    loop all players:
        if {Timer.zerodegree.enabled} is true:
            if {Timer.zerodegree.check} is less than {Timer.zerodegree.timer}:
                subtract 1 from {Timer.zerodegree.notify}
                add 1 to {Timer.zerodegree.check}
                stop
            else:
                if {Timer.zerodegree.check} = {Timer.zerodegree.timer}:
                    set action bar of loop-player to ""
                    wipe loop-player sidebar
                    set {Timer.zerodegree.enabled} to false
                    execute console command "/bc &c&lRESTARTING SERVER!"
                    delete {Timer.zerodegree.start}
                    delete {Timer.zerodegree.check}
                    delete {Timer.zerodegree.timer}
                    wait 1 second
                    set action bar of loop-player to ""
                    wipe loop-player sidebar
                    set {Timer.zerodegree.enabled} to false
                    delete {Timer.zerodegree.start}
                    delete {Timer.zerodegree.check}
                    delete {Timer.zerodegree.timer}
                    execute console command "/bc Restart will be replaced with this text"
                    stop
every 1 second:
    loop all players:
        if {Timer.zerodegree.enabled} is true:
            if {@actionbar} is true:
                set action bar of loop-player to "&cRestarting in: &b&l%{Timer.zerodegree.notify}% Seconds"
            if {@sidebar} is true:
                set name of sidebar of loop-player to "{@p}"
            set score "&aTime until restart:" in sidebar of loop-player to {Timer.zerodegree.notify}
It is now working, to an extent,
The problem i now face, is the side bar stays on my character, not anyone Else's, just mine,
However, I can deal with that since the sever will restart and because its restarting the sidebar gets cleared from everyone, so i guess this is solved :emoji_slight_smile:
 
Okay, you made one major mistake. In a loop event, if you use the effect stop, you stop the entire "stanza". So when it comes to the next player, the "stanza" has already stopped.

I recommend you not use the stop effect when it comes to looping. Only use stop when you don't want things to go further. Like a single loop, or a randomizer. But in this case, never use stop for looping. Either use stop the loop (in this case, you don't) or just delete all the stops.

In this case, you want to remove ALL stop effects...

code_language.skript:
every 1 second:
    loop all players:
        if {Timer.zerodegree.enabled} is true:
            if {Timer.zerodegree.check} is less than {Timer.zerodegree.timer}:
                subtract 1 from {Timer.zerodegree.notify}
                add 1 to {Timer.zerodegree.check}
            else:
                if {Timer.zerodegree.check} = {Timer.zerodegree.timer}:
                    set action bar of loop-player to ""
                    wipe loop-player sidebar
                    set {Timer.zerodegree.enabled} to false
                    execute console command "/bc &c&lRESTARTING SERVER!"
                    delete {Timer.zerodegree.start}
                    delete {Timer.zerodegree.check}
                    delete {Timer.zerodegree.timer}
                    wait 1 second
                    set action bar of loop-player to ""
                    wipe loop-player sidebar
                    set {Timer.zerodegree.enabled} to false
                    delete {Timer.zerodegree.start}
                    delete {Timer.zerodegree.check}
                    delete {Timer.zerodegree.timer}
                    execute console command "/bc Restart will be replaced with this text"

Other people have already responded to this post, but I would:
1. Like to elaborate why.
2. How to fix it, and why this is important.
3. Make the poster realize the mistake.

Remember next time when you do this! :emoji_slight_smile:
 
Status
Not open for further replies.