Jump to content

Hologram Leaderboard


No_Skittles

Recommended Posts

On 3/27/2020 at 9:36 PM, No_Skittles said:

Hello, ive seen many custom scripted servers have a hologram of the top 10 players on the server and i was just wondering how the skript for that works.

This is a level top hologram that we use for my server Multiples. First you'd want a way to create the hologram, so do something like this,

command /holoset [<text>]:
    permission: rank.admin
    trigger:
        if arg-1 is not set:
            send "&c/holoset <level>"

        else if arg-1 is "level":
            create new holo with line "&7» &c&lLevel Leaderboard &7«" and store in {lvl_lbs::*}
            send "&aCreated a new hologram with id &c%size of {lvl_lbs::*}%"

Basically all it does is sort everyone and their levels from a certain variable and displaying it, 

function refreshLevelLB():
    set {_slevels::*} to sorted {Level::*} from highest to lowest with format "@index"
    set {_ind} to 0
    loop {lvl_lbs::*}:
        loop {_slevels::*}:
            if {_ind} < 10:
                add 1 to {_ind}
                set {_pl} to "%loop-value-2 parsed as offline player%"
                set {_ul} to {Level::%loop-value-2%}
                set line (1 + {_ind}) of loop-value-1 to "&4&l%{_ind}%&7. &f%{_pl}%&7: [&c%{_ul}%&7]"

You could have a timed event for refreshing the leaderboard if you wanted, or you could do it manually, just run the function refreshLevelLB(player) 

Edited by Vinixs
  • Like 3
  • Haha 1

 

721034654735532112.gif.966bd6f1cb909ca87f1548614acb4131.gif

984d8967114f41b9e72bfd5c454fbd5d.png

achievement.png

Link to comment
Share on other sites

  • 1 month later...

command /holoset [<text>]:
    permission: rank.admin
    trigger:
        if arg-1 is not set:
            send "&c/holoset <level>"

        else if arg-1 is "level":
            create new hologram with line "&7» &b&lBodies Leaderboard &7«" and store in {body_lbs::*}
            send "&aCreated a new hologram with id &c%size of {body_lbs::*}%"
            refreshLevelLB(player)

 

Psalm 27:12

 

Link to comment
Share on other sites

On 3/29/2020 at 11:41 AM, Vinixs said:

function refreshLevelLB():
    set {_slevels::*} to sorted {Level::*} from highest to lowest with format "@index"
    set {_ind} to 0
    loop {lvl_lbs::*}:
        loop {_slevels::*}:
            if {_ind} < 10:
                add 1 to {_ind}
                set {_pl} to "%loop-value-2 parsed as offline player%"
                set {_ul} to {Level::%loop-value-2%}
                set line (1 + {_ind}) of loop-value-1 to "&4&l%{_ind}%&7. &f%{_pl}%&7: [&c%{_ul}%&7]"

@Waifer make sure you add this function, and make sure you run it in either a command or timed event

  • Like 3
  • Thanks 1
  • Confused 1

 

721034654735532112.gif.966bd6f1cb909ca87f1548614acb4131.gif

984d8967114f41b9e72bfd5c454fbd5d.png

achievement.png

Link to comment
Share on other sites

8 minutes ago, Vinixs said:

@Waifer make sure you add this function, and make sure you run it in either a command or timed event

What do you mean?

This is what I have @Vinixs

function refreshLevelLB():
    set {bodies::*} to sorted {Level::*} from highest to lowest with format "@index"
    set {_ind} to 0
    loop {body_lbs::*}:
        loop {_bodies::*}:
            if {_ind} < 10:
                add 1 to {_ind}
                set {_pl} to "%loop-value-2 parsed as offline player%"
                set {_ul} to {Bodies::%loop-value-2%}
                set line (1 + {_ind}) of loop-value-1 to "&4&l%{_ind}%&7. &f%{_pl}%&7: [&c%{_ul}%&7]"

command /holoset [<text>]:
    permission: rank.admin
    trigger:
        if arg-1 is not set:
            send "&c/holoset <level>"
        else if arg-1 is "level":
            create new hologram with line "&7» &b&lBodies Leaderboard &7«" and store in {body_lbs::*}
            send "&aCreated a new hologram with id &c%size of {body_lbs::*}%"
            refreshLevelLB(player)

Edited by Waifer

Psalm 27:12

 

Link to comment
Share on other sites

6 hours ago, FandF said:

What do you mean?

This is what I have @Vinixs

function refreshLevelLB():
    set {bodies::*} to sorted {Level::*} from highest to lowest with format "@index"
    set {_ind} to 0
    loop {body_lbs::*}:
        loop {_bodies::*}:
            if {_ind} < 10:
                add 1 to {_ind}
                set {_pl} to "%loop-value-2 parsed as offline player%"
                set {_ul} to {Bodies::%loop-value-2%}
                set line (1 + {_ind}) of loop-value-1 to "&4&l%{_ind}%&7. &f%{_pl}%&7: [&c%{_ul}%&7]"

command /holoset [<text>]:
    permission: rank.admin
    trigger:
        if arg-1 is not set:
            send "&c/holoset <level>"
        else if arg-1 is "level":
            create new hologram with line "&7» &b&lBodies Leaderboard &7«" and store in {body_lbs::*}
            send "&aCreated a new hologram with id &c%size of {body_lbs::*}%"
            refreshLevelLB(player)

You could create a command like /refreshlb that runs refreshLevelLB() and then also setup an event like every 5 minutes: refreshLevelLB()

to remove a hologram:

command /holoremove [<text>]:
	permission: somepermhere
	trigger:
        if arg-1 is not set:
            send "&c/holoremove <id>"
        else:
            delete hologram {body_lbs::%arg-2%}
            delete {body_lbs::%arg-2%}
            send "&aDeleted hologram with ID &c%arg-2%"

 

 


 

 

Link to comment
Share on other sites

21 minutes ago, Spiderlogical said:

You could create a command like /refreshlb that runs refreshLevelLB() and then also setup an event like every 5 minutes: refreshLevelLB()

to remove a hologram:


command /holoremove [<text>]:
	permission: somepermhere
	trigger:
        if arg-1 is not set:
            send "&c/holoremove <id>"
        else:
            delete hologram {body_lbs::%arg-2%}
            delete {body_lbs::%arg-2%}
            send "&aDeleted hologram with ID &c%arg-2%"

 

But this only says one line, the title.

Psalm 27:12

 

Link to comment
Share on other sites

function refreshLevelLB():
  set {bodies::*} to sorted {Level::*} from highest to lowest with format "@index"
  set {_ind} to 0
  loop {body_lbs::*}:
    loop {_bodies::*}:
      if {_ind} < 10:
        add 1 to {_ind}
        set {_pl} to "%loop-value-2 parsed as offline player%"
        set {_ul} to {Bodies::%loop-value-2%}
        set line (1 + {_ind}) of loop-value-1 to "&4&l%{_ind}%&7. &f%{_pl}%&7: [&c%{_ul}%&7]"

command /holoset [<text>]:
    permission: rank.admin
    trigger:
        if arg-1 is not set:
            send "&c/holoset <level>"
        else if arg-1 is "level":
            create new hologram with line "&7» &b&lBodies Leaderboard &7«" and store in {body_lbs::*}
            send "&aCreated a new hologram with id &c%size of {body_lbs::*}%"

command /refreshlb:
    trigger:
        refreshLevelLB()
        send "Done"

 

 

This is all I have

Psalm 27:12

 

Link to comment
Share on other sites

  • 5 months later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...