# ##################### # SEKCJA KONFIGURACYJNA # ##################### options: # NAZWA GUI AUKCJI nameGui: &cAUKCJE # vault / zmienna, # vault wymaga pluginu vault oraz pluginu do ekonomii, np. essentails # zmienna nie wymaga żadnego pluginu ekonomia: "zmienna" # jeśli wybrałeś zmienna to: # pieniądze na start: startMoney: 100 # PERMISJE: # - wymagać permisję do użycia komendy /aukcje? ("true" - wymaga, "false" - nie wymaga) requirePermission: false # - jeśli powyżej true, to jaka permisja? cmdPermission: aukcje.gracz # - permisja dla admina, do czyszczenia aukcji (debug) adminPermission: aukcje.* # WIADOMOSCI: # - wiadomość o braku uprawnienia noPermission: &cNie masz uprawnienia do używania tej komendy! # - brak aukcji: noAuctions: &cAktualnie nie ma zadnych aukcji! # - gracz chce wystawic powietrze: itemIsAir: &cNie mozesz wystawic niczego! # - gracz podal niepoprawna cene: invalidPrice: &cPodaj poprawną cenę! # - wiadomosc, gdy item jest nieaktualny soldItem: &cTen przedmiot jest nieaktualny! # - gracz usunal przedmiot ze sklepu itemRemoved: &cUsunales przedmiot ze sklepu! # - gracz nie ma tyle srodkow noMoney: &cNie masz tyle kasy! # - niepoprawna ilosc przedmiotow invalidAmount: &cPodales niepoprawna ilosc przedmiotow # - gracz nie ma tyle przedmiotow noItems: &cNie masz tyle itemow, by je wystawic! # - gracz podal nie swoją aukcję podczas usuwania otherUserAuction: &cPodana aukcja nie nalezy do Ciebie! # ################################ # KOD, NIE ZALECAM NIC TU ZMIENIAC # ################################ version: v1.0 function openGui(p:player,page:integer): # page to aktualna strona if size of {aukcje::*} = 0: send "{@noAuctions}" to {_p} if name of {_p}'s inventory = "{@nameGui}": close {_p}'s inventory stop open chest inventory named "{@nameGui}" with 6 rows to {_p} set slot (integers between 0 and 44) of {_p}'s current inventory to air set {_lore::1} to {_page}-1 set slot (integers between 45 and 53) of {_p}'s current inventory to gray stained glass pane named " " if {_lore::1} > 0: set slot 45 of {_p}'s current inventory to green stained glass pane named "&7<-- &epoprzednia strona" with lore "%{_lore::1}%" set slot 49 of {_p}'s current inventory to yellow stained glass pane named "&eaktualna strona" with lore "%{_page}%" set {_lore::2} to {_page}+1 if (size of {aukcje::*}) > {_page}*45: set slot 53 of {_p}'s current inventory to green stained glass pane named "&enastepna strona &7-->" with lore "%{_lore::2}%" # if {_page} is 1: set {_sloty} to 0 set {_loop} to 0 set {_itemy} to ({_page}-1)*45 loop {aukcje::*}: add 1 to {_loop} if {_loop} > {_itemy}: if {aukcje::%loop-index%::status} is true: {_sloty} < 45 set slot {_sloty} of {_p}'s current inventory to {aukcje::%loop-index%::item} with lore "" and "&7Wystawiajacy: &e%{aukcje::%loop-index%::player}%" and "&7Cena: &e%{aukcje::%loop-index%::cost}%" and "&7ID: &e%loop-index%" and "&7Status: &aaktywne" add 1 to {_sloty} function zakup(p:player,id:integer): set {_it} to {aukcje::%{_id}%::item} # na początku naprawiane jest lore, bo w Skripcie jest chyba jakiś błąd, że gracz dostawał item z opisem z GUI (Wystawiający, cena, ID itp.) delete lore of {_it} give {_it} with lore {aukcje::%{_id}%::itemlore::*} to {_p} if {@ekonomia} = "vault": add {aukcje::%{_id}%::cost} to {aukcje::%{_id}%::player}'s balance remove {aukcje::%{_id}%::cost} from {_p}'s balance else if {@ekonomia} != "vault": add {aukcje::%{_id}%::cost} to {balance::%{_p}%} remove {aukcje::%{_id}%::cost} from {balance::%{_p}%} if {aukcje::%{_id}%::player} is {_p}: send "{@itemRemoved}" to {_p} else: send formatted "&aGracz &e%{_p}% &akupil przedmiot &e##%{_id}% &aod &e%{aukcje::%{_id}%::player}%!" to all players delete {aukcje::%{_id}%::*} delete {aukcje::%{_id}%} on load: wait 1 tick send "Korzystasz ze Skryptu gAukcje v1.0" to console if {@ekonomia} = "vault": send "&cKorzystasz z ekonomii Vault, jeśli podczas ładowania skryptu wyskakuje błąd:" to console send "&c""can't understand this condition: player's balance""" to console send "&cUpewnij się, że posiadasz plugin Vault oraz jakiś inny do zarządzania ekonomią (np. Essentials)" to console else: send "&cKorzystasz z ekonomii w Skript" to console send "&cAby dodać komendę /money odkomentuj ją w skrypcie" to console send "&cZnajduje się ona na końcu kodu" to console send "&cjeśli podczas ładowania skryptu wyskakuje błąd:" to console send "&c""can't understand this condition: player's balance""" to console send "&cmożesz go zignorować, jeśli chcesz go usunąć zakomentuj linijkę z wyrażeniem player's balance" to console on join: {balance::%player%} is not set set {balance::%player%} to {@startMoney} command /aukcja [] [] []: aliases: /aukcje, / trigger: if {@requirePermission} is true: if player doesn't have permission "{@cmdPermission}" or "{@adminPermission}": send "{@noPermission}" stop if arg-1 = "dodaj" or "add": if (arg-2 parsed as integer) is not integer: send "{@invalidPrice}" stop if player's tool = air: send "{@itemIsAir}" stop if (arg-3 parsed as integer) is not integer: send "{@invalidAmount}" if item amount of player's tool < (arg-3 parsed as integer): send "{@noItems}" stop if (arg-3 parsed as integer) < 1: send "{@noItems}" stop set {_num} to (last element out of all indexes of {aukcje::*}) parsed as integer + 1 set {aukcje::%{_num}%::item} to (arg-3 parsed as integer) of player's held item set {aukcje::%{_num}%::itemlore::*} to lore of player's held item set {aukcje::%{_num}%::player} to player set {aukcje::%{_num}%::cost} to (arg-2 parsed as integer) set {aukcje::%{_num}%::status} to true set {aukcje::%{_num}%} to true send formatted "&aGracz &e%player% &awystawil przedmiot &e##%{_num}%&7 (najedź myszką)!" to all players set player's tool to (item amount of player's tool - (arg-3 parsed as integer)) of player's tool else if arg-1 = "debug": player has permission "{@adminPermission}" loop {aukcje::*}: add loop-index to {_l::*} send "%{_l::*}%" if arg-2 = "reset": clear {aukcje::*} send "&7Wyczyszczono!" else if arg-1 = "lista": loop {aukcje::*}: if {aukcje::%loop-index%::player} is player: send "&7=-=-=-=-=-=--=-=--=-=-=-=-=" to player send "&7przedmiot: &e%{aukcje::%loop-index%::item}%" to player send "&7cena: &e%{aukcje::%loop-index%::cost}%" to player send "&7id: &e%loop-index%" to player send formatted "&7&eKliknij, aby usunac!" else if arg-1 = "usun" or "remove": if (arg-2 parsed as integer) is not set: send "{@otherUserAuction}" stop if {aukcje::%arg-2%::player} != player: send "{@otherUserAuction}" stop zakup(player,arg-2 parsed as integer) else if arg-1 is not set: openGui(player,1) else: send "&7=-=-=-=-=-=-=-=-=-=-=" send "&e/aukcje dodaj &7- dodaje item z łapki, podanie ilości jest opcjonalne" send "&e/aukcje usun &7- usuwa item z danym ID" send "&e/aukcje lista &7- pokazuje wszystkie Twoje aukcje" if player has permission "{@adminPermission}": send "&c/aukcje debug &7- pokazuje wszystkie id aukcji na chacie" send "&c/aukcje debug reset &7- usuwa wszystkie aukcje (UWAGA! Nie oddaje itemów graczom)" send "&7=-=-=-=-=-=-=-=-=-=-=" on inventory click: name of player's inventory = "{@nameGui}" clicked inventory is not player's inventory cancel event clicked slot is set clicked slot is not air if index of clicked slot is 45 or 49 or 53: set {_line1} to line 1 of lore of clicked slot parsed as integer {_line1} is set openGui(player,{_line1}) stop index of clicked slot is between 0 and 44 set {_lore::*} to lore of clicked slot loop {_lore::*}: if "%loop-value%" contains "&7ID: &e": set {_linijka} to loop-index set {_lore::%{_linijka}%::*} to uncoloured {_lore::%{_linijka}%} split at " " set {_lore::%{_linijka}%::2} to {_lore::%{_linijka}%::2} parsed as integer if {aukcje::%{_lore::%{_linijka}%::2}%::status} is not true: send "{@soldItem}" set slot (index of clicked slot) of player's current inventory to air stop if {@ekonomia} = "vault": if player's balance < {aukcje::%{_lore::%{_linijka}%::2}%::cost}: send "{@noMoney}" stop if {@ekonomia} != "vault": if {balance::%player%} < {aukcje::%{_lore::%{_linijka}%::2}%::cost}: send "{@noMoney}" stop zakup(player,{_lore::%{_linijka}%::2}) set slot (index of clicked slot) of player's current inventory to air # JEŚLI KORZYSTASZ Z VAULT NIECH PONIŻSZE LINIE ZOSTANĄ ZAKOMENTOWANE # JEŚLI KORZYSTASZ ZE ZMIENNEJ - ODKOMENTUJ JE!!! (usuń #) #command /money: # aliases: /kasa, /pieniadze, /stankonta, /saldo # trigger: # send "&cStan konta: &e%{balance::%player%}%"