options:
czas: 300 # tu ustaw czas po jakim konkurs ma sie rozpoczac
ilosc: 1 # ilosc itemu po wpisaniu wlasciwego kodu
item: diamond # jaki item ma dostawac osoba bo wpisaniu kodu
gracze: 5 # ile graczy potrzeba do rozpoczencia konkursu
l: &8[&9KONKURS&8] # prefix
variables:
{konkurs} = 0
every {@czas} seconds:
if {@gracze} is smaller than number of players:
execute console command "konkurs"
command /konkurs:
trigger:
if sender has permission "sk.konkurs":
loop 6 times:
set {konkurs.znak%loop-number%} to 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or "a" or "A" or "b" or "B" or "c" or "C" or "d" or "D" or "e" or "E" or "f" or "F" or "g" or "G" or "h" or "H" or "k" or "K" or "l" or "L" or "m" or "M" or "n" or "N" or "o" or "O" or "p" or "P" or "q" or "Q" or "r" or "R" or "s" or "S" or "t" or "T" or "u" or "U" or "v" or "V" or "w" or "W" or "x" or "X" or "y" or "Y" or "z" or "Z"
set {konkurs.kod} to "%{konkurs.znak1}%%{konkurs.znak2}%%{konkurs.znak3}%%{konkurs.znak4}%%{konkurs.znak5}%%{konkurs.znak6}%"
broadcast "{@l} &7Za 3 sekundy rozpocznie sie konkurs! Kto pierwszy wpisze znaki na ekranie wygrywa {@ilosc} {@item}"
wait 1 second
broadcast "{@l} &73"
wait 1 second
broadcast "{@l} &72"
wait 1 second
broadcast "{@l} &71"
wait 1 second
set {konkurs} to 1
loop all players:
execute console command "playsound random.succesful_hit %loop-player%"
broadcast "{@l} &7Kod to &e%{konkurs.kod}%&7! Aby go wprowadzic wpisz kod na chacie!"
else:
message "&cNie masz uprawnien do tego!"
on chat:
if {konkurs} is 1:
if message contains "%{konkurs.kod}%":
cancel event
set {konkurs} to 0
broadcast "{@l} &7Gracz %player% wpisal jako pierwszy kod &e%{konkurs.kod}% &7i wygral {@ilosc} {@item}!"
add 1 to {wygrane::%player%}
give {@ilosc} {@item} to player
loop all players:
execute console command "playsound mob.wither.spawn %loop-player%"
command /topw [<integer=1>]:
trigger:
set {_strony} to rounded up (size of {wygrane::*} / 5)
arg is between 1 and {_strony}:
send "&6&m---&r &e&lTopka wygranych &6&m---"
loop {wygrane::*}:
set {_lista::%loop-index%} to loop-value
set {_num} to size of {_lista::*}
set {_max} to arg * 5
set {_min} to {_max} - 4
loop {_max} times:
loop {_lista::*}:
{_wartosc.%loop-number%} is not set:
set {_wartosc.%loop-number%} to loop-value
set {_nazwa.%loop-number%} to loop-index
loop-value is more than {_wartosc.%loop-number%}:
set {_wartosc.%loop-number%} to loop-value
set {_nazwa.%loop-number%} to loop-index
remove {_wartosc.%loop-number%} from {_lista::*}
loop {_max} times:
loop-number is between {_min} and {_max}
loop-number <= {_num}:
send "&6%loop-number%. %{nick::%{_nazwa.%loop-number%}%}% &7(&c%{_wartosc.%loop-number%}%&7)"
{_max} is more than {_num}:
set {_r} to {_num}
loop {_max} - {_num} times:
add 1 to {_r}
send "&6%{_r}%. Brak"
send "&6&lStrona: &c%arg% &6z &c%{_strony}%"
stop
{_strony} is 1:
send "&6&lWyniki mieszcza sie na &c1 &6&lstronie."
stop
send "&6&lWyniki mieszcza sie na &c%{_strony}% 6&lstronach."
on join:
{wygrane::%player%} is not set:
set {wygrane::%player%} to 0
{nick::%player%} is not set:
set {nick::%player%} to uncolored display name of player