Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.87 KB | None | 0 0
  1. # Funkcje by: Knugi, Dajszadoua i co tam Supcio ? :)
  2.  
  3. function getMoney(integer: number) :: string:
  4. if length of "%{_integer}%" is smaller than 4:
  5. return "%{_integer}%"
  6. if "%{_integer}%" contains ".":
  7. set {_first} to subtext of "%{_integer}%" between index 0 and index index of "." in "%{_integer}%" - 1
  8. set {_end} to subtext of "%{_integer}%" between index index of "." in "%{_integer}%" and length of "%{_integer}%"
  9. else:
  10. set {_first} to "%{_integer}%"
  11. set {_end} to ""
  12. loop length of {_first} times:
  13. add subtext of {_first} between index length of {_first} - loop-number + 1 and length of {_first} - loop-number + 1 to {_return::*}
  14. if "%loop-number / 3%" doesn't contain ".":
  15. add " " to {_return::*}
  16. set {_return} to ""
  17. loop {_return::*}:
  18. set {_return} to "%{_return::%loop-index%}%%{_return}%"
  19. if first character of {_return} is " ":
  20. set {_return} to subtext of {_return} between index 2 and length of {_return}
  21. set {_return} to "%{_return}%%{_end}%"
  22. return {_return}
  23.  
  24. function strToInt(s: text) :: integer:
  25. replace all " " with "" in {_s}
  26. return ({_s} parsed as integer)
  27.  
  28. function getMoney(integer: number) :: string:
  29. if length of "%{_integer}%" is smaller than 4:
  30. return "%{_integer}%"
  31.  
  32. if "%{_integer}%" contains ".":
  33. set {_first} to subtext of "%{_integer}%" between index 0 and index index of "." in "%{_integer}%" - 1
  34. set {_end} to subtext of "%{_integer}%" between index index of "." in "%{_integer}%" and length of "%{_integer}%"
  35.  
  36. else:
  37. set {_first} to "%{_integer}%"
  38. set {_end} to ""
  39.  
  40. loop length of {_first} times:
  41. add subtext of {_first} between index length of {_first} - loop-number + 1 and length of {_first} - loop-number + 1 to {_return::*}
  42. if "%loop-number / 3%" doesn't contain ".":
  43. add " " to {_return::*}
  44.  
  45. set {_return} to ""
  46. loop {_return::*}:
  47. set {_return} to "%{_return::%loop-index%}%%{_return}%"
  48.  
  49. if first character of {_return} is " ":
  50. set {_return} to subtext of {_return} between index 2 and length of {_return}
  51. set {_return} to "%{_return}%%{_end}%"
  52.  
  53. return {_return}
  54.  
  55. # Kupiec by: DajSzadoua, i co tam supcio? :)
  56. # Zmieniany na kupca z my psc by: Mirejdz, i co tam supcio? :)
  57.  
  58. variables:
  59. {podatek::%player%} = 0
  60. {globalprzychodydzis} = 0
  61. {globalprzychodygeneral} = 0
  62.  
  63. command /dajlvl [<integer>]:
  64. trigger:
  65. set {lv::%player%} to arg 1
  66.  
  67. command /dajpodatek [<integer>]:
  68. trigger:
  69. set {podatek::%player%} to arg 1
  70.  
  71. command /
  72.  
  73. on rightclick on entity:
  74. if uncoloured entity's name is "Kupiec":
  75. set {podatek::%player%} to {lv::%player%} / 10
  76. set {hajs.kupiec::%player%} to 0
  77. delete {itemy.kupiec::%player%::*}
  78. open chest with 3 rows named "Menu Kupca" to player
  79. wait 1 tick
  80. set player's current inventory's slot 7 to ladder named " "
  81. 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."
  82. set player's current inventory's slot 16 to ladder named " "
  83. set player's current inventory's slot 25 to ladder named " "
  84. 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$"
  85. wait 1 tick
  86. set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%getMoney({hajs.kupiec::%player%})%$"
  87.  
  88. function addItem(i: item, p: player, s: integer):
  89. remove {_i} from {_p}
  90. loop 27 times:
  91. if {_p}'s current inventory's slot ((loop-number -1)) is air:
  92. set {_p}'s current inventory's slot ((loop-number -1)) to {_i}
  93. exit loop
  94. stop
  95.  
  96. command /adminkupiec:
  97. permission: da.da
  98. trigger:
  99. send "&3» &fSpis komend do &6Kupca &fdla administratora:" to player
  100. send "&3» &6/kupiecadditemsell <cena itemu> &f- Dodaje do kupca dowolny przedmiot ktory trzymasz w rece za okreslana cene ktora zapiszesz!" to player
  101. send "&3» &6/kupiecresetitems &f- Usuwa wszystkie przedmioty z kupca ktore dodales :(" to player
  102. send "&3» &6/spisitemowkupca &f- Wypisuje wszystkie przedmioty ktore sa dodane do kupca!" to player
  103.  
  104. command /spisitemowkupca:
  105. permission: da.da
  106. trigger:
  107. send "&3» &fSpis przedmiotow dodanych do &6Kupca:" to player
  108. send "&3» %{spisitemowkupca::*}%" to player
  109.  
  110. command /kupiecresetitems [<text>]:
  111. permission: group.admin
  112. permission message: &cTa komenda nie istnieje, badz nie masz uprawnien!
  113. trigger:
  114. clear {kupiec.koszty::*}
  115. clear {spisitemowkupca::*}
  116. send "&3» &cAdmin zresetowal wszystkie itemki u kupca! :("
  117. stop
  118.  
  119.  
  120. command /kupiecadditemsell [<text>]:
  121. permission: group.admin
  122. permission message: &cTa komenda nie istnieje, badz nie masz uprawnien!
  123. trigger:
  124. if player's tool is not air:
  125. if amount of item player's tool is equal to 1:
  126. if arg 1 is set:
  127. set {_number} to ("%arg 1%" parsed as number)
  128. set {kupiec.koszty::%name of player's tool%::*} to {_number}
  129. add name of player's tool to {spisitemowkupca::*}
  130. send "&6Kupiec &3» &fAdministrator &e%player% &fdodal nowy itemek do kupca!" to all players
  131. send "&6Kupiec &3» &fMozecie go sprzedac za: &a%getMoney({_number})%$" to all players
  132. send "&6Kupiec &3» &fJest to taki item: %name of player's tool%" to all players
  133. stop
  134. else:
  135. send "&cBlad &3» &fPodaj cene!"
  136. stop
  137. else:
  138. send "&cBlad &3» &fMozesz jedynie x1 wkladac itemki, ale..."
  139. send "&cBlad &3» &fCena sie mnozy * liczba itemkow, ktore chce wlozyc! :)"
  140. stop
  141. else:
  142. send "&cBlad &3» &fNie trzymasz nic w reku!"
  143. stop
  144.  
  145. function removeItem(i: item, p: player):
  146. give {_i} to {_p}
  147. stop
  148.  
  149. on inventory click:
  150. if inventory name of current inventory of player is "Menu Kupca":
  151. cancel event
  152. if clicked inventory is player's inventory:
  153. if player's current inventory's slot 24 is air:
  154. if clicked item is sword:
  155. play sound "wood_click" to player with volume 1 and pitch 3
  156. set {_blad.sharpness} to enchant level of sharpness of clicked item
  157. set {_sharpness} to enchant level of sharpness of clicked item
  158. set {_sharpness2} to enchant level of sharpness of clicked item
  159. set {_sharpness} to {_sharpness} * 1000 / {podatek::%player%}
  160. set {_sharpness} to {_sharpness2} * 1000 - {_sharpness}
  161. add {_sharpness} to {hajs.kupiec::%player%}
  162. add clicked item to {itemy.kupiec::%player%::*}
  163. set {_item} to clicked item
  164. set {_p} to player
  165. loop 27 times:
  166. set {_slot} to loop-number -1
  167. wait 1 tick
  168. enchant {_item} with "Sharpness %{_blad.sharpness}%" parsed as enchantment type
  169. addItem({_item}, {_p}, {_slot})
  170. set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
  171. stop
  172. else:
  173. send "&eKupiec &3» &cZa duzo itemow juz wlozyles!"
  174. stop
  175. if player's current inventory's slot 24 is air:
  176. if clicked item is helmet or chestplate or leggings or boots:
  177. play sound "wood_click" to player with volume 1 and pitch 3
  178. set {_blad.protection} to enchant level of protection of clicked item
  179. set {_protection} to enchant level of protection of clicked item
  180. set {_protection2} to enchant level of protection of clicked item
  181. set {_protection} to {_protection} * 1000 / {podatek::%player%}
  182. set {_protection} to {_protection2} * 1000 - {_protection}
  183. add {_protection} to {hajs.kupiec::%player%}
  184. add clicked item to {itemy.kupiec::%player%::*}
  185. set {_item} to clicked item
  186. set {_p} to player
  187. loop 27 times:
  188. set {_slot} to loop-number -1
  189. wait 1 tick
  190. set {_prot} to enchant level of protection of clicked item
  191. enchant {_item} with "Protection %{_blad.protection}%" parsed as enchantment type
  192. addItem({_item}, {_p}, {_slot})
  193. set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
  194. stop
  195. if player's current inventory's slot 24 is air:
  196. loop {kupiec.koszty::%name of clicked item%::*}:
  197. play sound "wood_click" to player with volume 1 and pitch 3
  198. set {_kupiec.add} to ("%{kupiec.koszty::%name of clicked item%::*}%" parsed as number)
  199. set {_kupiec.add2} to ("%{kupiec.koszty::%name of clicked item%::*}%" parsed as number)
  200. set {_kupiec.items} to amount of item clicked item
  201. set {_kupiec.add} to {_kupiec.add} * {_kupiec.items} / {podatek::%player%}
  202. set {_kupiec.add} to {_kupiec.add2} * {_kupiec.items} - {_kupiec.add}
  203. add {_kupiec.add} to {hajs.kupiec::%player%}
  204. set {_item} to clicked item
  205. add clicked item to {itemy.kupiec::%player%::*}
  206. set {_p} to player
  207. loop 27 times:
  208. set {_slot} to loop-number -1
  209. wait 1 tick
  210. addItem({_item}, {_p}, {_slot})
  211. set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
  212. stop
  213. else:
  214. send "&eKupiec &3» &cZa duzo itemow juz wlozyles!"
  215. stop
  216. if clicked inventory isn't player's inventory:
  217. if "%slot%" isn't "17":
  218. if clicked item is sword:
  219. play sound "wood_click" to player with volume 1 and pitch 3
  220. set {_sharpness} to enchant level of sharpness of clicked item
  221. set {_sharpness2} to enchant level of sharpness of clicked item
  222. set {_sharpness} to {_sharpness} * 1000 / {podatek::%player%}
  223. set {_sharpness} to {_sharpness2} * 1000 - {_sharpness}
  224. remove {_sharpness} from {hajs.kupiec::%player%}
  225. remove clicked item from {itemy.kupiec::%player%::*}
  226. set {_item} to clicked item
  227. set {_p} to player
  228. wait 1 tick
  229. removeItem({_item}, {_p})
  230. set {_click} to clicked slot
  231. set {_p}'s current inventory's slot {_click} to air
  232. set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
  233. stop
  234. if clicked item is helmet or chestplate or leggings or boots:
  235. play sound "wood_click" to player with volume 1 and pitch 3
  236. set {_protection} to enchant level of protection of clicked item
  237. set {_protection2} to enchant level of protection of clicked item
  238. set {_protection} to {_protection} * 1000 / {podatek::%player%}
  239. set {_protection} to {_protection2} * 1000 - {_protection}
  240. remove {_protection} from {hajs.kupiec::%player%}
  241. remove clicked item from {itemy.kupiec::%player%::*}
  242. set {_item} to clicked item
  243. set {_p} to player
  244. wait 1 tick
  245. removeItem({_item}, {_p})
  246. set {_click} to clicked slot
  247. set {_p}'s current inventory's slot {_click} to air
  248. set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
  249. stop
  250. else:
  251. loop {kupiec.koszty::%name of clicked item%::*}:
  252. play sound "wood_click" to player with volume 1 and pitch 3
  253. set {_kupiec.sell} to ("%{kupiec.koszty::%name of clicked item%::*}%" parsed as number)
  254. set {_kupiec.sell2} to ("%{kupiec.koszty::%name of clicked item%::*}%" parsed as number)
  255. set {_kupiec.items} to amount of item clicked item
  256. set {_kupiec.sell} to {_kupiec.sell} * {_kupiec.items} / {podatek::%player%}
  257. set {_kupiec.sell} to {_kupiec.sell2} * {_kupiec.items} - {_kupiec.sell}
  258. remove {_kupiec.sell} from {hajs.kupiec::%player%}
  259. remove clicked item from {itemy.kupiec::%player%::*}
  260. set {_item} to clicked item
  261. set {_p} to player
  262. removeItem({_item}, {_p})
  263. set {_click} to clicked slot
  264. set {_p}'s current inventory's slot {_click} to air
  265. set player's current inventory's slot 17 to glowing sunflower named "&6&lSprzedaj" with lore "&aZarobek: &e%{hajs.kupiec::%player%}%$"
  266. stop
  267. else:
  268. if {itemy.kupiec::%player%::*} is set:
  269. play sound "note_pling" to player with volume 1 and pitch 5
  270. delete {itemy.kupiec::%player%::*}
  271. add {hajs.kupiec::%player%} to {monety::%player%}
  272. add {hajs.kupiec::%player%} to {globalprzychodydzis}
  273. add {hajs.kupiec::%player%} to {globalprzychodygeneral}
  274. close player's inventory
  275. if {hajs.kupiec::%player%} is smaller than 100:
  276. send "&eKupiec &3» &fTrzymaj te drobniaki &2(+%getMoney({hajs.kupiec::%player%})%$)"
  277. stop
  278. if {hajs.kupiec::%player%} is smaller than 1000:
  279. send "&eKupiec &3» &fOto twoja wyplata &2(+%getMoney({hajs.kupiec::%player%})%$)"
  280. stop
  281. if {hajs.kupiec::%player%} is smaller than 10000:
  282. send "&eKupiec &3» &fMilo sie z toba robi interesy &2(+%getMoney({hajs.kupiec::%player%})%$)"
  283. stop
  284. if {hajs.kupiec::%player%} is smaller than 100000:
  285. send "&eKupiec &3» &fTrzymaj te walizke z pieniedzmi &2(+%getMoney({hajs.kupiec::%player%})%$)"
  286. stop
  287. if {hajs.kupiec::%player%} is smaller than 1000000:
  288. send "&eKupiec &3» &fOto zawartosc sejfu &2(+%getMoney({hajs.kupiec::%player%})%$)"
  289. stop
  290. if {hajs.kupiec::%player%} is more than 1000000:
  291. send "&eKupiec &3» &fProsze, to jest calosc ciezarowki. &2(+%getMoney({hajs.kupiec::%player%})%$)"
  292. stop
  293. else:
  294. play sound "enderman_teleport" to player with volume 1 and pitch 5
  295. close player's inventory
  296. send "&eKupiec &3» &fNie wlozyles zadnych przedmiotow!"
  297. stop
  298. every 60 seconds:
  299. if "%hour%" is "12":
  300. set {globalprzychodydzis} to 0
  301. broadcast "&eKupiec &3» &fWyczyscilem wlasnie przychody dzienne, mozna znow pobijac rekordy! :D"
  302. on inventory close:
  303. if inventory name of current inventory of player is "Menu Kupca":
  304. give player {itemy.kupiec::%player%::*}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement