Sorting {score.%player%}

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

iGniSs

Member
May 3, 2017
18
0
0
24
Skript Version: Skript 2.2 (dev20c)
Skript Author: Bensku
Minecraft Version: 1.11.2

Full code:
code_language.skript:
# BasicLand.cz // OreRush // by iGniSsak
options:


    author: iGniSsak

    Version: 1.0.1


#Spravy
    nopermission: &cNedostatek opravneni!
    youbreakadiamondore: &aVykopal jsi diamond ore!
    youbreakaredstoneore: &aVykopal jsi redstone ore!
    youbreakaemeraldore:  &aVykopal jsi emerald ore!
    youbreakgoldore: &aVykopal jsi gold ore!
    tagserver: &cBASICLAND.cz&7 //&f
    permissionowners: basicland.orerush

variables:
    {mineddiamond.%player%} = 0
    {mineemerald.%player%} = 0
    {totalminedblocks.%player%} = 0
    {minedreds.%player%} = 0
    {minedgold.%player%} = 0
    {score.%player%} = 0
    


on break of Diamond Ore:
    send "{@tagserver} {@youbreakadiamondore}"
    add 1 to {mineddiamond.%player%}
    add 1 to {totalminedblocks.%player%}
    add 10 to {score.%player%}
    send "{@tagserver} &7(+10 score) &e(Aktualni score: %{score.%player%}%&e)"
    play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to player with volume 5 and pitch 2

on break of Coal Ore:
  send "{@tagserver} {@youbreakaredstoneore}"
  add 1 to {totalminedblocks.%player%}
  add 1 to {minedreds.%player%}
  add 3 to {score.%player%}
  send "{@tagserver} &7(+3 score) &e(Aktualni score: %{score.%player%}%&e)"
  play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to player with volume 5 and pitch 2
    
on break of Emerald Ore:
    send "{@tagserver} {@youbreakaemeraldore}"
    add 1 to {mineemerald.%player%}
    add 1 to {totalminedblocks.%player%}
    add 8 to {score.%player%}
    send "{@tagserver} &7(+8 score) &e(Aktualni score: %{score.%player%}%&e)"
    play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to player with volume 5 and pitch 2   
on break of Gold Ore:
    send "{@tagserver} {@youbreakgoldore}"
    add 1 to {minedgold.%player%}
    add 1 to {totalminedblocks.%player%}
    add 5 to {score.%player%}
    send "{@tagserver} &7(+5 score) &e(Aktualni score: %{score.%player%}%&e)"
    play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to player with volume 5 and pitch 2

I want to:
After 5 sec - loop all players - broadcast first largest score of players
How can i do it?
 
They made the docs for a reason http://skunity.com/search?search=sorting

Also this part of your code:
code_language.skript:
variables:
    {mineddiamond.%player%} = 0
    {mineemerald.%player%} = 0
    {totalminedblocks.%player%} = 0
    {minedreds.%player%} = 0
    {minedgold.%player%} = 0
    {score.%player%} = 0
wont work because how would it know what to fill in for player? it cant magically make a variable for all the players that have joined or will join in the future. This reads as:
code_language.skript:
variables:
    {mineddiamond.<none>} = 0
    {mineemerald.<none>} = 0
    {totalminedblocks.<none>} = 0
    {minedreds.<none>} = 0
    {minedgold.<none>} = 0
    {score.<none>} = 0
You should be doing something like this instead:
code_language.skript:
on first join:
    #set variables

#or

on join:
    if {variable.%player%} isn't set:
        #set the variable
 
code_language.skript:
command /orerush-score:
    trigger:
        loop all players:
            add "{score.%loop-player%} %loop-player%" to {score_konec::*}
        wait 5 seconds
        play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to player with volume 5 and pitch 2
        broadcast " %{score_konec::*} sorted from highest to lowest%"
        stop

Error:
GFumDsoVR2S3rz492W8Big.png


I want to adding score+name of player to the {score_konec::*}
and then i want to broadcast sorted score+player names
 
its not like that here is one example code.

code_language.skript:
command /topkills:
    trigger:
        set {_toplist::*} to sorted {sesionkills::*} from highest to lowest with output "&6@index &7with &6@value &7kills"
        set {_x} to 1
        send "&aLoading Top 5 Players..."
        send "&cTop 5 Kills&7:"
        loop 5 times:
            set {_v} to "%{_toplist::%{_x}%}%"
            replace all ".0" in {_v} with ""
            send "&e⇀ %{_v}%" to player
            add 1 to {_x}
 
Status
Not open for further replies.