Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Funkcje by: Knugi, Dajszadoua i co tam Supcio ? :)
- function getMoney(integer: number) :: string:
- if length of "%{_integer}%" is smaller than 4:
- return "%{_integer}%"
- if "%{_integer}%" contains ".":
- set {_first} to subtext of "%{_integer}%" between index 0 and index index of "." in "%{_integer}%" - 1
- set {_end} to subtext of "%{_integer}%" between index index of "." in "%{_integer}%" and length of "%{_integer}%"
- else:
- set {_first} to "%{_integer}%"
- set {_end} to ""
- loop length of {_first} times:
- add subtext of {_first} between index length of {_first} - loop-number + 1 and length of {_first} - loop-number + 1 to {_return::*}
- if "%loop-number / 3%" doesn't contain ".":
- add " " to {_return::*}
- set {_return} to ""
- loop {_return::*}:
- set {_return} to "%{_return::%loop-index%}%%{_return}%"
- if first character of {_return} is " ":
- set {_return} to subtext of {_return} between index 2 and length of {_return}
- set {_return} to "%{_return}%%{_end}%"
- return {_return}
- function strToInt(s: text) :: integer:
- replace all " " with "" in {_s}
- return ({_s} parsed as integer)
- function getMoney(integer: number) :: string:
- if length of "%{_integer}%" is smaller than 4:
- return "%{_integer}%"
- if "%{_integer}%" contains ".":
- set {_first} to subtext of "%{_integer}%" between index 0 and index index of "." in "%{_integer}%" - 1
- set {_end} to subtext of "%{_integer}%" between index index of "." in "%{_integer}%" and length of "%{_integer}%"
- else:
- set {_first} to "%{_integer}%"
- set {_end} to ""
- loop length of {_first} times:
- add subtext of {_first} between index length of {_first} - loop-number + 1 and length of {_first} - loop-number + 1 to {_return::*}
- if "%loop-number / 3%" doesn't contain ".":
- add " " to {_return::*}
- set {_return} to ""
- loop {_return::*}:
- set {_return} to "%{_return::%loop-index%}%%{_return}%"
- if first character of {_return} is " ":
- set {_return} to subtext of {_return} between index 2 and length of {_return}
- set {_return} to "%{_return}%%{_end}%"
- return {_return}
- # Kupiec by: DajSzadoua, i co tam supcio? :)
- # Zmieniany na kupca z my psc by: Mirejdz, i co tam supcio? :)
- variables:
- {podatek::%player%} = 0
- {globalprzychodydzis} = 0
- {globalprzychodygeneral} = 0
- command /dajlvl [<integer>]:
- trigger:
- set {lv::%player%} to arg 1
- command /dajpodatek [<integer>]:
- trigger:
- set {podatek::%player%} to arg 1
- command /
- on rightclick on entity:
- if uncoloured entity's name is "Kupiec":
- set {podatek::%player%} to {lv::%player%} / 10
- set {hajs.kupiec::%player%} to 0
- delete {itemy.kupiec::%player%::*}
- open chest with 3 rows named "Menu Kupca" to player
- wait 1 tick
- set player's current inventory's slot 7 to ladder named " "
- set player's current inventory's slot 8 to redstone torch on named "&c&lPodatek: &e&l%{podatek::%player%}%%%" with lore "&6Podatek zalezy od poziomu gracza."
- set player's current inventory's slot 16 to ladder named " "
- set player's current inventory's slot 25 to ladder named " "
- set player's current inventory's slot 26 to emerald named "&2&lWygenerowane Przychody:" with lore " &8- &6Dzisiejsze:|| &b» &e%getMoney({globalprzychodydzis})%&a&l$|| &8- &6Generalne:|| &b» &e%getMoney({globalprzychodygeneral})%&a&l$"
- wait 1 tick
- set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%getMoney({hajs.kupiec::%player%})%$"
- function addItem(i: item, p: player, s: integer):
- remove {_i} from {_p}
- loop 27 times:
- if {_p}'s current inventory's slot ((loop-number -1)) is air:
- set {_p}'s current inventory's slot ((loop-number -1)) to {_i}
- exit loop
- stop
- command /adminkupiec:
- permission: da.da
- trigger:
- send "&3» &fSpis komend do &6Kupca &fdla administratora:" to player
- send "&3» &6/kupiecadditemsell <cena itemu> &f- Dodaje do kupca dowolny przedmiot ktory trzymasz w rece za okreslana cene ktora zapiszesz!" to player
- send "&3» &6/kupiecresetitems &f- Usuwa wszystkie przedmioty z kupca ktore dodales :(" to player
- send "&3» &6/spisitemowkupca &f- Wypisuje wszystkie przedmioty ktore sa dodane do kupca!" to player
- command /spisitemowkupca:
- permission: da.da
- trigger:
- send "&3» &fSpis przedmiotow dodanych do &6Kupca:" to player
- send "&3» %{spisitemowkupca::*}%" to player
- command /kupiecresetitems [<text>]:
- permission: group.admin
- permission message: &cTa komenda nie istnieje, badz nie masz uprawnien!
- trigger:
- clear {kupiec.koszty::*}
- clear {spisitemowkupca::*}
- send "&3» &cAdmin zresetowal wszystkie itemki u kupca! :("
- stop
- command /kupiecadditemsell [<text>]:
- permission: group.admin
- permission message: &cTa komenda nie istnieje, badz nie masz uprawnien!
- trigger:
- if player's tool is not air:
- if amount of item player's tool is equal to 1:
- if arg 1 is set:
- set {_number} to ("%arg 1%" parsed as number)
- set {kupiec.koszty::%name of player's tool%::*} to {_number}
- add name of player's tool to {spisitemowkupca::*}
- send "&6Kupiec &3» &fAdministrator &e%player% &fdodal nowy itemek do kupca!" to all players
- send "&6Kupiec &3» &fMozecie go sprzedac za: &a%getMoney({_number})%$" to all players
- send "&6Kupiec &3» &fJest to taki item: %name of player's tool%" to all players
- stop
- else:
- send "&cBlad &3» &fPodaj cene!"
- stop
- else:
- send "&cBlad &3» &fMozesz jedynie x1 wkladac itemki, ale..."
- send "&cBlad &3» &fCena sie mnozy * liczba itemkow, ktore chce wlozyc! :)"
- stop
- else:
- send "&cBlad &3» &fNie trzymasz nic w reku!"
- stop
- function removeItem(i: item, p: player):
- give {_i} to {_p}
- stop
- on inventory click:
- if inventory name of current inventory of player is "Menu Kupca":
- cancel event
- if clicked inventory is player's inventory:
- if player's current inventory's slot 24 is air:
- if clicked item is sword:
- play sound "wood_click" to player with volume 1 and pitch 3
- set {_blad.sharpness} to enchant level of sharpness of clicked item
- set {_sharpness} to enchant level of sharpness of clicked item
- set {_sharpness2} to enchant level of sharpness of clicked item
- set {_sharpness} to {_sharpness} * 1000 / {podatek::%player%}
- set {_sharpness} to {_sharpness2} * 1000 - {_sharpness}
- add {_sharpness} to {hajs.kupiec::%player%}
- add clicked item to {itemy.kupiec::%player%::*}
- set {_item} to clicked item
- set {_p} to player
- loop 27 times:
- set {_slot} to loop-number -1
- wait 1 tick
- enchant {_item} with "Sharpness %{_blad.sharpness}%" parsed as enchantment type
- addItem({_item}, {_p}, {_slot})
- set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
- stop
- else:
- send "&eKupiec &3» &cZa duzo itemow juz wlozyles!"
- stop
- if player's current inventory's slot 24 is air:
- if clicked item is helmet or chestplate or leggings or boots:
- play sound "wood_click" to player with volume 1 and pitch 3
- set {_blad.protection} to enchant level of protection of clicked item
- set {_protection} to enchant level of protection of clicked item
- set {_protection2} to enchant level of protection of clicked item
- set {_protection} to {_protection} * 1000 / {podatek::%player%}
- set {_protection} to {_protection2} * 1000 - {_protection}
- add {_protection} to {hajs.kupiec::%player%}
- add clicked item to {itemy.kupiec::%player%::*}
- set {_item} to clicked item
- set {_p} to player
- loop 27 times:
- set {_slot} to loop-number -1
- wait 1 tick
- set {_prot} to enchant level of protection of clicked item
- enchant {_item} with "Protection %{_blad.protection}%" parsed as enchantment type
- addItem({_item}, {_p}, {_slot})
- set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
- stop
- if player's current inventory's slot 24 is air:
- loop {kupiec.koszty::%name of clicked item%::*}:
- play sound "wood_click" to player with volume 1 and pitch 3
- set {_kupiec.add} to ("%{kupiec.koszty::%name of clicked item%::*}%" parsed as number)
- set {_kupiec.add2} to ("%{kupiec.koszty::%name of clicked item%::*}%" parsed as number)
- set {_kupiec.items} to amount of item clicked item
- set {_kupiec.add} to {_kupiec.add} * {_kupiec.items} / {podatek::%player%}
- set {_kupiec.add} to {_kupiec.add2} * {_kupiec.items} - {_kupiec.add}
- add {_kupiec.add} to {hajs.kupiec::%player%}
- set {_item} to clicked item
- add clicked item to {itemy.kupiec::%player%::*}
- set {_p} to player
- loop 27 times:
- set {_slot} to loop-number -1
- wait 1 tick
- addItem({_item}, {_p}, {_slot})
- set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
- stop
- else:
- send "&eKupiec &3» &cZa duzo itemow juz wlozyles!"
- stop
- if clicked inventory isn't player's inventory:
- if "%slot%" isn't "17":
- if clicked item is sword:
- play sound "wood_click" to player with volume 1 and pitch 3
- set {_sharpness} to enchant level of sharpness of clicked item
- set {_sharpness2} to enchant level of sharpness of clicked item
- set {_sharpness} to {_sharpness} * 1000 / {podatek::%player%}
- set {_sharpness} to {_sharpness2} * 1000 - {_sharpness}
- remove {_sharpness} from {hajs.kupiec::%player%}
- remove clicked item from {itemy.kupiec::%player%::*}
- set {_item} to clicked item
- set {_p} to player
- wait 1 tick
- removeItem({_item}, {_p})
- set {_click} to clicked slot
- set {_p}'s current inventory's slot {_click} to air
- set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
- stop
- if clicked item is helmet or chestplate or leggings or boots:
- play sound "wood_click" to player with volume 1 and pitch 3
- set {_protection} to enchant level of protection of clicked item
- set {_protection2} to enchant level of protection of clicked item
- set {_protection} to {_protection} * 1000 / {podatek::%player%}
- set {_protection} to {_protection2} * 1000 - {_protection}
- remove {_protection} from {hajs.kupiec::%player%}
- remove clicked item from {itemy.kupiec::%player%::*}
- set {_item} to clicked item
- set {_p} to player
- wait 1 tick
- removeItem({_item}, {_p})
- set {_click} to clicked slot
- set {_p}'s current inventory's slot {_click} to air
- set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
- stop
- else:
- loop {kupiec.koszty::%name of clicked item%::*}:
- play sound "wood_click" to player with volume 1 and pitch 3
- set {_kupiec.sell} to ("%{kupiec.koszty::%name of clicked item%::*}%" parsed as number)
- set {_kupiec.sell2} to ("%{kupiec.koszty::%name of clicked item%::*}%" parsed as number)
- set {_kupiec.items} to amount of item clicked item
- set {_kupiec.sell} to {_kupiec.sell} * {_kupiec.items} / {podatek::%player%}
- set {_kupiec.sell} to {_kupiec.sell2} * {_kupiec.items} - {_kupiec.sell}
- remove {_kupiec.sell} from {hajs.kupiec::%player%}
- remove clicked item from {itemy.kupiec::%player%::*}
- set {_item} to clicked item
- set {_p} to player
- removeItem({_item}, {_p})
- set {_click} to clicked slot
- set {_p}'s current inventory's slot {_click} to air
- set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
- stop
- else:
- if {itemy.kupiec::%player%::*} is set:
- play sound "note_pling" to player with volume 1 and pitch 5
- delete {itemy.kupiec::%player%::*}
- add {hajs.kupiec::%player%} to {monety::%player%}
- add {hajs.kupiec::%player%} to {globalprzychodydzis}
- add {hajs.kupiec::%player%} to {globalprzychodygeneral}
- close player's inventory
- if {hajs.kupiec::%player%} is smaller than 100:
- send "&eKupiec &3» &fTrzymaj te drobniaki &2(+%getMoney({hajs.kupiec::%player%})%$)"
- stop
- if {hajs.kupiec::%player%} is smaller than 1000:
- send "&eKupiec &3» &fOto twoja wyplata &2(+%getMoney({hajs.kupiec::%player%})%$)"
- stop
- if {hajs.kupiec::%player%} is smaller than 10000:
- send "&eKupiec &3» &fMilo sie z toba robi interesy &2(+%getMoney({hajs.kupiec::%player%})%$)"
- stop
- if {hajs.kupiec::%player%} is smaller than 100000:
- send "&eKupiec &3» &fTrzymaj te walizke z pieniedzmi &2(+%getMoney({hajs.kupiec::%player%})%$)"
- stop
- if {hajs.kupiec::%player%} is smaller than 1000000:
- send "&eKupiec &3» &fOto zawartosc sejfu &2(+%getMoney({hajs.kupiec::%player%})%$)"
- stop
- if {hajs.kupiec::%player%} is more than 1000000:
- send "&eKupiec &3» &fProsze, to jest calosc ciezarowki. &2(+%getMoney({hajs.kupiec::%player%})%$)"
- stop
- else:
- play sound "enderman_teleport" to player with volume 1 and pitch 5
- close player's inventory
- send "&eKupiec &3» &fNie wlozyles zadnych przedmiotow!"
- stop
- every 60 seconds:
- if "%hour%" is "12":
- set {globalprzychodydzis} to 0
- broadcast "&eKupiec &3» &fWyczyscilem wlasnie przychody dzienne, mozna znow pobijac rekordy! :D"
- on inventory close:
- if inventory name of current inventory of player is "Menu Kupca":
- give player {itemy.kupiec::%player%::*}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement