Hello, im working on a fishing skript, and when the contest is over, it should send the top 3 fishers with the biggest fish. But when the contest is over, it will send the most recent fish the player caught. So, lets say i caught a fish thats 12.43cm and after i go that fish, i caught another one thats 4.65cm, it should send the 12.43cm fish because its the biggest one. But it will send the 4.65cm one because it was the most recent fish. It was working just fine not to long ago, and just starting not working the other day. Ive been scratching my head at this for a long time, and not sure what is wrong with it? If anyone can help me, it will be very much appreciated!
Thanks!
~Matt
Skript version: 2.4
Skript-Mirror version: 2.0.0 snapshot
Server version: Paper Spigot 1.14.4
Code:
[doublepost=1586965473,1586194287][/doublepost]bump
Thanks!
~Matt
Skript version: 2.4
Skript-Mirror version: 2.0.0 snapshot
Server version: Paper Spigot 1.14.4
Code:
Code:
function pigeonhole(indices: objects, values: numbers, ascending: boolean = false) :: objects:
loop {_indices::*}:
set {_v} to "%(loop-index parsed as integer)th element out of {_values::*}%"
set {_split::*} to {_v} split at "."
add length of {_split::2} ? 0 to {_p::*}
add loop-value to {_temp::%{_v}%::*}
set {_prec} to 10^(max({_p::*})+1)
loop all integers from min({_values::*})*{_prec} to (max({_values::*})+1)*{_prec}:
set {_v} to loop-value / {_prec}
if {_temp::%{_v}%::*} is set:
loop {_temp::%{_v}%::*}:
add loop-value-2 to {_sorted::*}
if {_ascending} is true:
return {_sorted::*}
else:
return reversed ({_sorted::*})
command /contestcaughtfishtop:
trigger:
set {_indices::*} to indices of {size::fish::*}
set {_sorted-fish::*} to pigeonhole({_indices::*}, {size::fish::*})
set {_topfisher} to first element out of {_sorted-fish::*}
broadcast "&b[Fishing] &fThe fishing contest has ended!"
loop {_sorted-fish::*}:
set {_i} to loop-index parsed as integer
stop loop if {_i} > 3
broadcast "&e%{_i}%: &a%loop-value%, &b%{size::fish::%loop-value%}%cm"