Solved Im noob with loops and how I can do this better

  • 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.
Feb 24, 2017
191
7
0
23
foroendertheth.foroactivo.com
code_language.skript:
options:
    -: &9&l&m--------------------
    survival: {s.survival}
    pvp: {s.pvp}
    psurvival: {s.survival%loop-player%}
    ppvp: {s.pvp%loop-player%}
    online: {s.online}
    ponline {s.online%loop-player%}
command /stats:
    aliases: /ss
    trigger:
        send "{@-}"
        send "&7Survival: &a{@survival}"
        send "&7PvP: &a {@pvp}"
every 5 second:
    loop players:
        if {@ponline} is true:
            stop
        else:
            add 1 to {@online}
every 5 second:
    loop players in world "survival"
    if {@ppvp} is true:
        subtract 1 from {@pvp}
        if {@psurvival} is true:
            stop
        else:
            add 1 to {@survival}
    else:
        if {psurvival} is true:
            stop
        else:
            add 1 to {@survival}       
every 5 second:
    loop players in world "pvp":
        if {@psurvival} is true:
            subtract 1 from {@survival}
            if {@ppvp} is true:
                stop
            else:
                add 1 to {@pvp}
        else:
            if {@ppvp} is true:
                stop
            else:
                add 1 to {@pvp}
on quit: #This sometimes work sometimes not: sometimes like does not subtract or something
    if {s.online%player%} is true:
        subtract 1 from {@online}
        if {s.survival%player%} is true:
            subtract 1 from {@survival}
            if {s.pvp%player%} is true:
                subtract 1 from {@pvp}
        else:
            if {s.pvp%player%} is true:
                subtract 1 from {@pvp}
                if {s.survival%player%} is true:
                    subtract 1 from {@survival}
 
requires SharpSK

code_language.skript:
on join:
    add 1 to {wrld.%player's world}
    
    
on quit:
    remove 1 from {wrld.%player's world}
    
    
    
on world change:
    remove 1 from {wrld.%former event-world%}
    add 1 to {wrld.%future event-world%}
    
    
command /stats:
    trigger:
        send "-"
        send "pvp: %{wrld.pvp}%"
        send "pvp: %{wrld.survival}%"
        send "-"
 
Wait , that's only for the number of players online?

Just do:
code_language.skript:
%size of all players in world "world"%
 

Attachments

  • Screenshot (17).png
    Screenshot (17).png
    947.8 KB · Views: 161
code_language.skript:
command /stats:
    trigger:
        send "&7Online: &a%size of all players in world ""world""%"
code_language.skript:
options:
    -: &9&l&m--------------------
command /stats:
    aliases: /ss
    trigger:
        send "{@-}"
        send "&7Online: &a%number of all players%"
        send "&7survival: &a%size of all players in world ""survival""%"
        send "&7pvp: &a%size of all players in world ""pvp""%"
        send "&7Lobby: &a%size of all players in world ""Lobby""%"
        send "{@-}"
2017-08-04_11.30.18.png
 
Status
Not open for further replies.