Files
phoenixduel-ranking.sk
Code
1 94
phoenixduel-ranking.sk
options:
prefix: &6&l[Duels]&r
function assignDuelRank(p: player):
set {_wins} to placeholder "phoenixduels_wins" from {_p}
if {_wins} is not set:
set {_wins} to 0
set {_oldRank} to {duel.rank.%{_p}'s uuid%}
run console command "lp user %{_p}% parent remove duel_unranked"
run console command "lp user %{_p}% parent remove duel_lt1"
run console command "lp user %{_p}% parent remove duel_lt2"
run console command "lp user %{_p}% parent remove duel_lt3"
run console command "lp user %{_p}% parent remove duel_ht1"
run console command "lp user %{_p}% parent remove duel_ht2"
run console command "lp user %{_p}% parent remove duel_ht3"
if {_wins} >= 750:
run console command "lp user %{_p}% parent add duel_ht3"
set {_newRank} to "HT3"
set {_color} to "&c&l"
else if {_wins} >= 500:
run console command "lp user %{_p}% parent add duel_ht2"
set {_newRank} to "HT2"
set {_color} to "&6&l"
else if {_wins} >= 300:
run console command "lp user %{_p}% parent add duel_ht1"
set {_newRank} to "HT1"
set {_color} to "&e&l"
else if {_wins} >= 150:
run console command "lp user %{_p}% parent add duel_lt3"
set {_newRank} to "LT3"
set {_color} to "&b&l"
else if {_wins} >= 75:
run console command "lp user %{_p}% parent add duel_lt2"
set {_newRank} to "LT2"
set {_color} to "&3&l"
else if {_wins} >= 25:
run console command "lp user %{_p}% parent add duel_lt1"
set {_newRank} to "LT1"
set {_color} to "&9&l"
else:
run console command "lp user %{_p}% parent add duel_unranked"
set {_newRank} to "UNRANKED"
set {_color} to "&7"
if {_oldRank} is set:
if {_oldRank} is not {_newRank}:
send "{@prefix} &aYou ranked up to %{_color}%{_newRank}&a! &7(%{_wins}% wins)" to {_p}
play sound "entity.player.levelup" with volume 1 and pitch 1 to {_p}
set {duel.rank.%{_p}'s uuid%} to {_newRank}
on join:
wait 3 seconds
assignDuelRank(player)
every 5 minutes:
loop all players:
assignDuelRank(loop-player)
command /duelrank [<offline player>]:
permission: duels.rank.check
permission message: {@prefix} &cYou don't have permission to use this command!
trigger:
if arg-1 is set:
set {_target} to arg-1
else:
set {_target} to player
set {_wins} to placeholder "phoenixduels_wins" from {_target}
if {_wins} is not set:
set {_wins} to 0
set {_rank} to {duel.rank.%{_target}'s uuid%} ? "UNRANKED"
send "{@prefix} &e%{_target}%'s Rank: &f%{_rank}% &7(%{_wins}% wins)" to player
send "{@prefix} &7Next rank thresholds:" to player
send " &925 wins &8→ &9&lLT1" to player
send " &375 wins &8→ &3&lLT2" to player
send " &b150 wins &8→ &b&lLT3" to player
send " &e300 wins &8→ &e&lHT1" to player
send " &6500 wins &8→ &6&lHT2" to player
send " &c750 wins &8→ &c&lHT3" to player
command /duelrankrefresh:
permission: duels.rank.admin
permission message: {@prefix} &cYou don't have permission to use this command!
trigger:
send "{@prefix} &eRefreshing duel ranks for all online players..." to player
loop all players:
assignDuelRank(loop-player)
send "{@prefix} &aRank refresh complete!" to player