Files
drop.sk
kody.sk
Code
2 247
kody.sk
options:
prefix: &6[Kody]&r
admin-permission: kody.admin
function kodySplit(input: text) :: texts:
set {_parts::*} to {_input} split at " "
return {_parts::*}
command /kod [<text>]:
trigger:
if arg-1 is not set:
if player has permission "{@admin-permission}":
send ""
send "&6&l⋆ &e&lSYSTEM KODÓW &6&l⋆"
send ""
send "&e/kod stwórz <nazwa> <nagroda|drop> &7- Tworzy nowy kod"
send "&e/kod usuń <nazwa> &7- Usuwa kod"
send "&e/kod lista &7- Lista wszystkich kodów"
send "&e/kod <nazwa> &7- Użyj kod"
send ""
else:
send ""
send "&6&l⋆ &e&lSYSTEM KODÓW &6&l⋆"
send ""
send "&e/kod <nazwa> &7- Użyj kod premiowy"
send ""
stop
set {_args::*} to kodySplit(arg-1)
set {_cmd} to {_args::1}
set {_arg2} to {_args::2}
set {_arg3} to {_args::3}
if {_arg2} is "drop":
if player does not have permission "{@admin-permission}":
send "{@prefix} &cNie masz uprawnień!"
stop
if player's tool is air:
send "{@prefix} &cMusisz trzymać przedmiot w ręce!"
stop
if {kod::%{_cmd}%} is set:
send "{@prefix} &cKod &e%{_cmd}% &cjuż istnieje!"
stop
set {kod::%{_cmd}%} to player's tool
set {kod.typ::%{_cmd}%} to "item"
send "{@prefix} &aPomyślnie utworzono kod!"
send "&e┃ &7Nazwa: &e%{_cmd}%"
send "&e┃ &7Nagroda: &6%player's tool%"
stop
if {_cmd} is "stwórz" or "stworz" or "create":
if player does not have permission "{@admin-permission}":
send "{@prefix} &cNie masz uprawnień!"
stop
if {_arg2} is not set:
send "{@prefix} &cPodaj nazwę kodu!"
send "&eUżycie: /kod stwórz <nazwa> <nagroda|drop>"
stop
if {_arg3} is "drop":
if player's tool is air:
send "{@prefix} &cMusisz trzymać przedmiot w ręce!"
stop
if {kod::%{_arg2}%} is set:
send "{@prefix} &cKod &e%{_arg2}% &cjuż istnieje!"
stop
set {kod::%{_arg2}%} to player's tool
set {kod.typ::%{_arg2}%} to "item"
send "{@prefix} &aPomyślnie utworzono kod!"
send "&e┃ &7Nazwa: &e%{_arg2}%"
send "&e┃ &7Nagroda: &6%player's tool%"
stop
if {_arg3} is not set:
send "{@prefix} &cPodaj nagrodę (liczbę) lub 'drop'!"
send "&eUżycie: /kod stwórz <nazwa> <nagroda|drop>"
stop
set {_ilosc} to {_arg3} parsed as integer
if {_ilosc} is not set:
send "{@prefix} &cNagroda musi być liczbą lub 'drop'!"
stop
if {kod::%{_arg2}%} is set:
send "{@prefix} &cKod &e%{_arg2}% &cjuż istnieje!"
stop
set {kod::%{_arg2}%} to {_ilosc}
set {kod.typ::%{_arg2}%} to "money"
send "{@prefix} &aPomyślnie utworzono kod!"
send "&e┃ &7Nazwa: &e%{_arg2}%"
send "&e┃ &7Nagroda: &6%{_ilosc}%"
stop
if {_cmd} is "usuń" or "usun" or "delete":
if player does not have permission "{@admin-permission}":
send "{@prefix} &cNie masz uprawnień!"
stop
if {_arg2} is not set:
send "{@prefix} &cPodaj nazwę kodu!"
send "&eUżycie: /kod usuń <nazwa>"
stop
if {kod::%{_arg2}%} is not set:
send "{@prefix} &cKod &e%{_arg2}% &cnie istnieje!"
stop
delete {kod::%{_arg2}%}
delete {kod.typ::%{_arg2}%}
delete {kod.uzyci::%{_arg2}%::*}
send "{@prefix} &aPomyślnie usunięto kod &e%{_arg2}%&a!"
stop
if {_cmd} is "lista" or "list":
if player does not have permission "{@admin-permission}":
send "{@prefix} &cNie masz uprawnień!"
stop
if {kod::*} is not set:
send "{@prefix} &cBrak utworzonych kodów!"
stop
send ""
send "&6&l⋆ &e&lLISTA KODÓW &6&l⋆"
send ""
loop {kod::*}:
set {_count} to 0
loop {kod.uzyci::%loop-index%::*}:
add 1 to {_count}
if {kod.typ::%loop-index%} is "item":
send "&e%loop-index% &7- Nagroda: &6%loop-value% &7| Użyć: &a%{_count}%"
else:
send "&e%loop-index% &7- Nagroda: &6%loop-value% diamentów &7| Użyć: &a%{_count}%"
send ""
stop
set {_kodNazwa} to {_cmd}
if {kod::%{_kodNazwa}%} is not set:
send "{@prefix} &cKod &e%{_kodNazwa}% &cnie istnieje!"
stop
if {kod.uzyci::%{_kodNazwa}%::%player's uuid%} is set:
send "{@prefix} &cTen kod został już przez Ciebie użyty!"
stop
set {kod.uzyci::%{_kodNazwa}%::%player's uuid%} to true
set {_nagroda} to {kod::%{_kodNazwa}%}
if {kod.typ::%{_kodNazwa}%} is "item":
give {_nagroda} to player
send ""
send "&6&l⋆ &a&lKOD WYKORZYSTANY &6&l⋆"
send ""
send "&7Pomyślnie wykorzystano kod: &e%{_kodNazwa}%"
send "&7Otrzymano: &6%{_nagroda}%"
send ""
else:
give player {_nagroda} of diamond
send ""
send "&6&l⋆ &a&lKOD WYKORZYSTANY &6&l⋆"
send ""
send "&7Pomyślnie wykorzystano kod: &e%{_kodNazwa}%"
send "&7Otrzymano: &6%{_nagroda}% diamentów"
send ""
broadcast "{@prefix} &7Gracz &e%player% &7wykorzystał kod premiowy!"
on script load:
send "{@prefix} &aSystem kodów został załadowany!" to console