Shooterowy

[SCRIPT] PrivateTerrain

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