Solved Most kills hologram

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

BrettPlayMC

Supporter
Jan 26, 2017
715
53
28
SkUnity Street
Category: Fun

Suggested name:
MostKillsHolo

What I want:
A not so simple script that I am about to explain. :emoji_slight_smile:

Basically I would like a script that at X Y and Z coordinates displays a hologram that looks exactly like the "Top Balances" picture on the LeaderHeads plugin page (scroll down to bottom). I would like this to display the top 10 players with the most kills in the "Survival" world. If someone could make this it would be amazing. If you have the desire to show off your work you can post it on SkUnity as an official resource! :emoji_grinning:
Ideas for commands:
What are needed? :emoji_stuck_out_tongue:
Ideas for permissions:
What are needed? :emoji_stuck_out_tongue:
When I'd like it by: Saturday? :emoji_stuck_out_tongue:
 
Tbh, i am not the best at skript. Most of the addons i readed didnt really show something up. Ask another person, but if you want it really quick i suggest just using a plugin.
I only know one plugin that does this but it is $12.50 and does way more than I want to. I am also a big user and fan of script. :emoji_slight_smile:
 
You want a script that shows the top kills and corresponding players?

Here's a free plugin, does exactly what you want, except it isn't a hologram.

However, I can do this in Skript with list variables. It may be hard, but I could do it if I worked for a while. I know for sure that I can make a list of the most kills, but without the corresponding player.
I can do it, most likely.
 
You want a script that shows the top kills and corresponding players?

Here's a free plugin, does exactly what you want, except it isn't a hologram.

However, I can do this in Skript with list variables. It may be hard, but I could do it if I worked for a while. I know for sure that I can make a list of the most kills, but without the corresponding player.
I can do it, most likely.
I help Brett's server out with his Skript needs and he specifically need a hologram. I can supply the ranking from one to ten if someone would be nice enough to supply an addon or example that would allow me to create a hologram.
 
I help Brett's server out with his Skript needs and he specifically need a hologram. I can supply the ranking from one to ten if someone would be nice enough to supply an addon or example that would allow me to create a hologram.
Ah.
I thought there was an addon to do this.
I guess not!
@Gatt could you maybe make an addon for this? :emoji_slight_smile:
 
You can use SkRayFall to create holograms through Holographic Displays.

Also, I have created the hologram script but I'm sure @mathhulk can probably create a better one.
 
This is what I have so far. It can likely be improved.

code_language.skript:
# Required addons:
# RandomSK, MundoSK, SkRayFall
# Plugins required: HolographicDisplays and ProtocolLib
on statistics increase:
    if event-statistic is player kills:
        remove {kills.%player%} from {TopKills::*}
        increase {kills.%player%} by 1
        loop {TopKills::*}:
            if {kills.%player%} is less than loop-index:
                insert {kills.%player%} after {TopKills::%loop-index%}
                stop
        loop all players:
            if {kills.%player%} = first element of {TopKills::*}
                set {pos.%loop-player%} to 1
            else:
                loop {TopKills::*}:
                    if {kills.%loop-player%} = loop-index:
                        set {pos.%loop-player%} to loop-value
                        set {PlayerIndic.%loop-value%} to name of loop-player
                        set {killsIndic.%loop-value%} to {kills.%loop-player%}


Command /topkillshere:
    Permission: KillsHolo.sethere
    Permission message: No permission
    Description: Set the location of Top Kills Hologram.
    Trigger:
        set {holoLoc} to location of player
        send "&7Hologram location updated."
        
every 5 seconds:
    create hologram "&9Top Player Kills;&aPlayer&5::&6Kills;&11. &a%{PlayerIndic.1}%::%{killsIndic.1}%;&12. &a%{PlayerIndic.2}%::%{killsIndic.2}%;&13. &a%{PlayerIndic.3}%::%{killsIndic.3}%;&14. &a%{PlayerIndic.4}%::%{killsIndic.4}%;&15. &a%{PlayerIndic.5}%::%{killsIndic.5}%;&16. &a%{PlayerIndic.6}%::%{killsIndic.6}%;&17. &a%{PlayerIndic.7}%::%{killsIndic.7}%;&18. &a%{PlayerIndic.8}%::%{killsIndic.8}%;&19. &a%{PlayerIndic.9}%::%{killsIndic.9}%;&110. &a%{PlayerIndic.10}%::%{killsIndic.10}%" at {holoLoc} for 5 seconds

Command /clearkills <player>:
    Permission: KillsHolo.clear
    Permission message: No permission
    Usage: /clearkills <player>
    Description: Clear kills of player
    Trigger:
        set {kills.%arg 1%} to 0
        send "&5%arg 1%&7's kills have been cleared."
[/SPOILER]
 
Do you have RandomSK? That's the on stats increase.

Also, does anybody know how to better use the "(add|insert) %objects% (before|after) (%listutil% %-number%|last %listutil%)[ (of|in) %-object/objects%]" from MundoSK's ListUtils.
code_language.skript:
# Required addons:
# RandomSK, MundoSK, SkRayFall
# Plugins required: HolographicDisplays and ProtocolLib
on statistics increase:
    if event-statistic is player kills:
        remove {kills.%player%} from {TopKills::*}
        increase {kills.%player%} by 1
        if {kills.%player%} > first element of  {TopKills::*}:
            insert {kills.%player%} before {TopKills::%loop-index%}
            wait 1 tick
            run codeblock UpdateList
            stop
        loop {TopKills::*}:
            if {kills.%player%} is less than loop-index:
                insert {kills.%player%} after {TopKills::%loop-index%}
                wait 1 tick
                run codeblock UpdateList
                stop

Codeblock UpdateList:
        loop all players:
            if {kills.%player%} > first element of {TopKills::*}
                set {pos.%loop-player%} to loop-value
                set {PlayerIndic.%1%} to name of loop-player
                set {killsIndic.%1%} to {kills.%loop-player%}
            else:
                loop {TopKills::*}:
                    if {kills.%loop-player%} = loop-index:
                        set {pos.%loop-player%} to loop-value
                        set {PlayerIndic.%loop-value%} to name of loop-player
                        set {killsIndic.%loop-value%} to {kills.%loop-player%}
 
 
Command /topkillshere:
    Permission: KillsHolo.sethere
    Permission message: No permission
    Description: Set the location of Top Kills Hologram.
    Trigger:
        set {holoLoc} to location of player
        send "&7Hologram location updated."
      
every 5 seconds:
    create hologram "&9Top Player Kills;&aPlayer&5::&6Kills;&11. &a%{PlayerIndic.1}%::%{killsIndic.1}%;&12. &a%{PlayerIndic.2}%::%{killsIndic.2}%;&13. &a%{PlayerIndic.3}%::%{killsIndic.3}%;&14. &a%{PlayerIndic.4}%::%{killsIndic.4}%;&15. &a%{PlayerIndic.5}%::%{killsIndic.5}%;&16. &a%{PlayerIndic.6}%::%{killsIndic.6}%;&17. &a%{PlayerIndic.7}%::%{killsIndic.7}%;&18. &a%{PlayerIndic.8}%::%{killsIndic.8}%;&19. &a%{PlayerIndic.9}%::%{killsIndic.9}%;&110. &a%{PlayerIndic.10}%::%{killsIndic.10}%" at {holoLoc} for 5 seconds
 
Command /clearkills <player>:
    Permission: KillsHolo.clear
    Permission message: No permission
    Usage: /clearkills <player>
    Description: Clear kills of player
    Trigger:
        set {kills.%arg 1%} to 0
        send "&5%arg 1%&7's kills have been cleared."
 
Do you have RandomSK? That's the on stats increase.

Also, does anybody know how to better use the "(add|insert) %objects% (before|after) (%listutil% %-number%|last %listutil%)[ (of|in) %-object/objects%]" from MundoSK's ListUtils.
code_language.skript:
# Required addons:
# RandomSK, MundoSK, SkRayFall
# Plugins required: HolographicDisplays and ProtocolLib
on statistics increase:
    if event-statistic is player kills:
        remove {kills.%player%} from {TopKills::*}
        increase {kills.%player%} by 1
        if {kills.%player%} > first element of  {TopKills::*}:
            insert {kills.%player%} before {TopKills::%loop-index%}
            wait 1 tick
            run codeblock UpdateList
            stop
        loop {TopKills::*}:
            if {kills.%player%} is less than loop-index:
                insert {kills.%player%} after {TopKills::%loop-index%}
                wait 1 tick
                run codeblock UpdateList
                stop

Codeblock UpdateList:
        loop all players:
            if {kills.%player%} > first element of {TopKills::*}
                set {pos.%loop-player%} to loop-value
                set {PlayerIndic.%1%} to name of loop-player
                set {killsIndic.%1%} to {kills.%loop-player%}
            else:
                loop {TopKills::*}:
                    if {kills.%loop-player%} = loop-index:
                        set {pos.%loop-player%} to loop-value
                        set {PlayerIndic.%loop-value%} to name of loop-player
                        set {killsIndic.%loop-value%} to {kills.%loop-player%}
 
 
Command /topkillshere:
    Permission: KillsHolo.sethere
    Permission message: No permission
    Description: Set the location of Top Kills Hologram.
    Trigger:
        set {holoLoc} to location of player
        send "&7Hologram location updated."
     
every 5 seconds:
    create hologram "&9Top Player Kills;&aPlayer&5::&6Kills;&11. &a%{PlayerIndic.1}%::%{killsIndic.1}%;&12. &a%{PlayerIndic.2}%::%{killsIndic.2}%;&13. &a%{PlayerIndic.3}%::%{killsIndic.3}%;&14. &a%{PlayerIndic.4}%::%{killsIndic.4}%;&15. &a%{PlayerIndic.5}%::%{killsIndic.5}%;&16. &a%{PlayerIndic.6}%::%{killsIndic.6}%;&17. &a%{PlayerIndic.7}%::%{killsIndic.7}%;&18. &a%{PlayerIndic.8}%::%{killsIndic.8}%;&19. &a%{PlayerIndic.9}%::%{killsIndic.9}%;&110. &a%{PlayerIndic.10}%::%{killsIndic.10}%" at {holoLoc} for 5 seconds
 
Command /clearkills <player>:
    Permission: KillsHolo.clear
    Permission message: No permission
    Usage: /clearkills <player>
    Description: Clear kills of player
    Trigger:
        set {kills.%arg 1%} to 0
        send "&5%arg 1%&7's kills have been cleared."
I didn't end up using the versions provided. Mathhulk wrote a custom version for my server with only 2 bugs in it.
One of them being SkQuery spamming an annoying message in console and the second being the hologram not staying on server restart.
 
I didn't end up using the versions provided. Mathhulk wrote a custom version for my server with only 2 bugs in it.
One of them being SkQuery spamming an annoying message in console and the second being the hologram not staying on server restart.
I'll fix that when I get the time.