ShooterowyPL

PrivateTerrain

Feb 3rd, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.67 KB | None | 0 0
  1. options:
  2. poczatkowy_rozmiar: 20
  3. co_ile_powiekszac: 5
  4. maksymalny_rozmiar: 40
  5. Function tolowercase(string: string) :: string:
  6. replace all "A" with "a" in {_string}
  7. replace all "B" with "b" in {_string}
  8. replace all "C" with "c" in {_string}
  9. replace all "D" with "d" in {_string}
  10. replace all "E" with "e" in {_string}
  11. replace all "F" with "f" in {_string}
  12. replace all "G" with "g" in {_string}
  13. replace all "H" with "h" in {_string}
  14. replace all "I" with "i" in {_string}
  15. replace all "J" with "a" in {_string}
  16. replace all "K" with "k" in {_string}
  17. replace all "L" with "l" in {_string}
  18. replace all "M" with "m" in {_string}
  19. replace all "N" with "n" in {_string}
  20. replace all "O" with "o" in {_string}
  21. replace all "P" with "p" in {_string}
  22. replace all "Q" with "q" in {_string}
  23. replace all "R" with "r" in {_string}
  24. replace all "S" with "s" in {_string}
  25. replace all "T" with "t" in {_string}
  26. replace all "U" with "u" in {_string}
  27. replace all "V" with "v" in {_string}
  28. replace all "W" with "w" in {_string}
  29. replace all "X" with "x" in {_string}
  30. replace all "Y" with "y" in {_string}
  31. replace all "Z" with "z" in {_string}
  32. return {_string}
  33. on join:
  34. if {PrivateTerrain::dzialka::%player%} is not set:
  35. set {PrivateTerrain::dzialka::%player%} to player
  36. set {PrivateTerrain::dzialka::%player%::status} to false
  37. stop
  38. on place:
  39. # if Region.getAt{event-location} is set:
  40. # set {_dzialka} to "dzialka_%tolowercase(name of player)%"
  41. # if Region.getAt{event-location} is not {_dzialka}:
  42. # set {_owner} to Region.getAt{event-location}
  43. # replace "dzialka_" with "" in {_owner}
  44. # if {PrivateTerrain::dzialka::%{_owner}%::czlonkowie::*} contains name of player:
  45. # stop
  46. # send "&cTo jest dzialka innego gracza. Nie mozesz tutaj budowac."
  47. # cancel event
  48. # stop
  49. if player is holding gold block named "&aDzialka {@poczatkowy_rozmiar}x{@poczatkowy_rozmiar}" with lore "&3Postaw aby||&3utworzyc dzialke":
  50. if {PrivateTerrain::dzialka::%player%::status} is false:
  51. loop {PrivateTerrain::dzialka::*}:
  52. if distance between event-location and {PrivateTerrain::dzialka::%loop-index%::center} is smaller than or equal to {@maksymalny_rozmiar}*2:
  53. send "&cInny gracz ma juz dzialke w poblizu. Poszukaj innego miejsca."
  54. cancel event
  55. stop
  56. set {_dzialka} to "dzialka_%tolowercase(name of player)%"
  57. new region {_dzialka}
  58. {_dzialka}.Region.selectLS{event-location, {@poczatkowy_rozmiar}}
  59. set {PrivateTerrain::dzialka::%player%::status} to true
  60. set {PrivateTerrain::dzialka::%player%::center} to event-location
  61. set {PrivateTerrain::dzialka::%player%::size} to {@poczatkowy_rozmiar}
  62. send "&aStworzyles dzialke."
  63. stop
  64. else:
  65. cancel event
  66. send "&cMasz juz dzialke!"
  67. stop
  68. command /dzialka [<text>]:
  69. trigger:
  70. if arg is "kup":
  71. if player's money is more or equal to 5000:
  72. remove 5000 from player's money
  73. add gold block named "&aDzialka {@poczatkowy_rozmiar}x{@poczatkowy_rozmiar}" with lore "&3Postaw aby||&3utworzyc dzialke" to player
  74. send "&aKupiles dzialke!"
  75. stop
  76. else:
  77. send "&cNie masz tyle pieniedzy. Brakuje Ci $%5000-player's money%."
  78. if arg is "magazyn":
  79. wait 5 ticks
  80. open chest with 6 rows named "&6Magazyn" to player
  81. add {PrivateTerrain::dzialka::%player%::magazyn::*} to current inventory of player
  82. clear {PrivateTerrain::dzialka::%player%::magazyn::*}
  83. if arg is "powieksz":
  84. if ({PrivateTerrain::dzialka::%player%::size} + {@co_ile_powiekszac}) is less than or equal to {@maksymalny_rozmiar}:
  85. set {_dzialka} to "dzialka_%tolowercase(name of player)%"
  86. {_dzialka}.Region.delete{}
  87. new region {_dzialka}
  88. {_dzialka}.Region.selectLS{{PrivateTerrain::dzialka::%player%::center}, ({PrivateTerrain::dzialka::%player%::size} + {@co_ile_powiekszac})}
  89. add {@co_ile_powiekszac} to {PrivateTerrain::dzialka::%player%::size}
  90. send "&aPowiekszyles swoja dzialke o &c{@co_ile_powiekszac}&a."
  91. stop
  92. else:
  93. send "&cTwoja dzialka osiagnela maksymalny rozmiar!"
  94. if arg is "usun":
  95. wait 3 ticks
  96. open chest with 1 rows named "&1Potwierdz usuniecie" to player
  97. set {_d} to random number between 0 and 9
  98. loop 9 times:
  99. if loop-number - 1 is not {_d}:
  100. format slot loop-number - 1 of player with 1 of emerald block named "&aAnuluj" to close
  101. format slot {_d} of player with 1 of redstone block named "&cUsun dzialke" to close then run [execute player command "dzialka potwierdz"]
  102. if arg is "potwierdz":
  103. set {_dzialka} to "dzialka_%tolowercase(name of player)%"
  104. {_dzialka}.Region.delete{}
  105. set block at {PrivateTerrain::dzialka::%player%::center} to air
  106. set {PrivateTerrain::dzialka::%player%::status} to false
  107. clear {PrivateTerrain::dzialka::%player%::center}
  108. clear {PrivateTerrain::dzialka::%player%::size}
  109. clear {PrivateTerrain::dzialka::%player%::magazyn::*}
  110. clear {PrivateTerrain::dzialka::%player%::czlonkowie::*}
  111. send "&aUsunales dzialke!"
  112. stop
  113. if arg is "dodajgracza":
  114. if {PrivateTerrain::status::%player%} is "dodaj":
  115. clear {PrivateTerrain::status::%player%}
  116. send "&aZakonczono dodawanie graczy do dzialki."
  117. stop
  118. set {PrivateTerrain::status::%player%} to "dodaj"
  119. send "&aNapisz na czacie nick gracza ktorego chcesz dodac."
  120. send "&cUwaga: &7Gracz musi byc na serwerze!"
  121. send "&3Aby zakonczyc napisz na czacie &6""wyjdz"" &3lub powtornie nacisnij na przedmiot w menu dzialki."
  122. stop
  123. if arg is "usungracza":
  124. if {PrivateTerrain::status::%player%} is "usun":
  125. clear {PrivateTerrain::status::%player%}
  126. send "&aZakonczono usuwanie graczy z dzialki."
  127. stop
  128. set {PrivateTerrain::status::%player%} to "usun"
  129. send "&aNapisz na czacie nick gracza ktorego chcesz usunac."
  130. send "&3Aby zakonczyc napisz na czacie &6""wyjdz"" &3lub powtornie nacisnij na przedmiot w menu dzialki."
  131. stop
  132. on chat:
  133. if {PrivateTerrain::status::%player%} is "dodaj":
  134. cancel event
  135. if message is "wyjdz":
  136. clear {PrivateTerrain::status::%player%}
  137. send "&aZakonczono dodawanie graczy do dzialki."
  138. stop
  139. set {_p} to message parsed as player
  140. if {_p} is not set:
  141. send "&cNie ma takiego gracza!"
  142. stop
  143. if {_p} is player:
  144. send "&cNie mozesz dodac siebie do dzialki!"
  145. stop
  146. if {PrivateTerrain::dzialka::%player%::czlonkowie::*} contains {_p}:
  147. send "&cTen gracz nalezy juz do twojej dzialki!"
  148. stop
  149. send "&aDodano gracza &6%{_p}% &ado dzialki."
  150. add {_p} to {PrivateTerrain::dzialka::%player%::czlonkowie::*}
  151. send "&aGracz &6%player% &adodaj Cie do swojej dzialki." to {_p}
  152. stop
  153. if {PrivateTerrain::status::%player%} is "usun":
  154. cancel event
  155. if message is "wyjdz":
  156. clear {PrivateTerrain::status::%player%}
  157. send "&aZakonczono usuwanie graczy z dzialki."
  158. stop
  159. set {_p} to message
  160. if {_p} is player:
  161. send "&cNie mozesz usunac siebie z dzialki!"
  162. stop
  163. if {PrivateTerrain::dzialka::%player%::czlonkowie::*} contains {_p}:
  164. remove {_p} from {PrivateTerrain::dzialka::%player%::czlonkowie::*}
  165. send "&aUsunieto gracza &6%{_p}% &az dzialki."
  166. stop
  167. send "&cTen gracz nie nalezy do twojej dzialki!"
  168. stop
  169. on inventory close:
  170. if inventory name of current inventory of player is "&6Magazyn":
  171. add items in current inventory of player to {PrivateTerrain::dzialka::%player%::magazyn::*}
  172. on rightclick on gold block:
  173. if {PrivateTerrain::dzialka::%player%::status} is true:
  174. if event-location is {PrivateTerrain::dzialka::%player%::center}:
  175. wait 5 ticks
  176. open chest with 1 rows named "&6Menu dzialki" to player
  177. wait 5 ticks
  178. format slot 0 of player with 1 of chest named "&3Magazyn" to close then run [execute player command "dzialka magazyn"]
  179. format slot 1 of player with 1 of ladder named "&3Powieksz" to close then run [execute player command "dzialka powieksz"]
  180. format slot 2 of player with 1 of redstone block named "&3Usun" to close then run [execute player command "dzialka usun"]
  181. format slot 3 of player with 1 of nether star named "&3Dodaj gracza do dzialki" to close then run [execute player command "dzialka dodajgracza"]
  182. format slot 4 of player with 1 of 166 named "&3Usun gracza z dzialki" to close then run [execute player command "dzialka usungracza"]
  183. stop
  184. on break:
  185. if Region.getAt{event-location} is not "<none>":
  186. set {_dzialka} to "dzialka_%tolowercase(name of player)%"
  187. if Region.getAt{event-location} is not {_dzialka}:
  188. set {_owner} to Region.getAt{event-location}
  189. replace "dzialka_" with "" in {_owner}
  190. if {PrivateTerrain::dzialka::%{_owner}%::czlonkowie::*} contains name of player:
  191. if event-location is {PrivateTerrain::dzialka::%{_owner}%::center}:
  192. cancel event
  193. stop
  194. send "&cTo jest dzialka innego gracza. Nie mozesz tutaj niszczyc."
  195. cancel event
  196. stop
  197. if event-block is gold block:
  198. if {PrivateTerrain::dzialka::%player%::status} is true:
  199. if event-location is {PrivateTerrain::dzialka::%player%::center}:
  200. cancel event
  201. stop
  202. on rightclick:
  203. if Region.getAt{event-location} is not "<none>":
  204. set {_dzialka} to "dzialka_%tolowercase(name of player)%"
  205. if Region.getAt{event-location} is not {_dzialka}:
  206. set {_owner} to Region.getAt{event-location}
  207. replace "dzialka_" with "" in {_owner}
  208. if {PrivateTerrain::dzialka::%{_owner}%::czlonkowie::*} contains name of player:
  209. stop
  210. if clicked block is not air:
  211. cancel event
  212. send "&cTo jest dzialka innego gracza. Nie mozesz tutaj niczego zmieniac."
  213. stop
  214. on load:
  215. loop {PrivateTerrain::dzialka::*}:
  216. if {PrivateTerrain::dzialka::%loop-index%::status} is true:
  217. set {_dzialka} to "dzialka_%loop-index%"
  218. new region {_dzialka}
  219. {_dzialka}.Region.selectLS{{PrivateTerrain::dzialka::%loop-index%::center}, {PrivateTerrain::dzialka::%loop-index%::size}}
Add Comment
Please, Sign In to add comment