xkrzysek

Auctions+

Dec 11th, 2015
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.79 KB | None | 0 0
  1. # @! Auctions+
  2. # @! skrypt umozliwiajacy tworzenie
  3. # @! aukcji na twoim serwerze.
  4. # @!
  5. # @! Wymagania:
  6. # @!
  7. # @! - Skript
  8. # @! - iConomy lub Essentials (do ekonomii)
  9. # @!
  10. # @! Uprawnienia:
  11. # @!
  12. # @! (podstawowe)
  13. # @!
  14. # @! - auctions.create (tworzenie aukcji)
  15. # @! - auctions.cancel (anulowanie aukcji)
  16. # @! - auctions.active (informacje aukcji)
  17. # @! - auctions.raise (podbicie stawki)
  18. # @!
  19. # @! (ponadpodstawowe)
  20. # @!
  21. # @! - auctions.cancel.admin (anulowanie aukcji bez wymagania byciem jej wlascicielem)
  22. # @!
  23. # @! Komendy:
  24. # @!
  25. # @! - /aukcja wystaw [cena] [przedmiot np. 3 emeralds]
  26. # @! - /aukcja podbij
  27. # @! - /aukcja info
  28. # @! - /aukcja anuluj
  29. # @! - /aukcja pomoc
  30. # @!
  31. # @! Aukcje podbija sie o +5
  32. # @!
  33. # @! Autor: krzysek
  34. # @! Wersja: 0.2
  35. # @!
  36. # @! Koniec ustawien, reszta kodu jest tylko do odczytu.
  37. # @!
  38. #
  39. #
  40. #
  41.  
  42. variables:
  43. {auctions.exists} = false
  44. {auctions.time} = 0
  45.  
  46. command /aukcja [<text>] [<text>] [<text>]:
  47. aliases: auc++
  48. description: Aukcja commands ! :D
  49. trigger:
  50. if arg 1 isn't set:
  51. message "&3* { -- } --- > &f&lAuctions&4&l++ &3< --- { -- } *"
  52. message " "
  53. message "&4+--> &f&l/aukcja wystaw [cena np. 20] [item np. 3 emerald] &c- &6Tworzy aukcje."
  54. message " "
  55. message "&4+--> &f&l/aukcja anuluj &c- &6Anuluje aukcje."
  56. message " "
  57. message "&4+--> &f&l/aukcja info &c- &6Info. na temat aktualnej aukcji."
  58. message " "
  59. message "&4+--> &f&l/aukcja podbij &c- &6Podbija cene."
  60. message " "
  61. message "&4+--> &f&l/aukcja pomoc &c- &6Komendy/opis."
  62. message " "
  63. message "&3* { -- } --- > &f&lAuctions&4&l++ &3< --- { -- } *"
  64. stop
  65. else:
  66. if arg 1 is "pomoc":
  67. message "&3* { -- } --- > &f&lAuctions&4&l++ &3< --- { -- } *"
  68. message " "
  69. message "&4+--> &f&l/aukcja wystaw [cena np. 20] [item np. 3 emerald] &c- &6Tworzy aukcje."
  70. message " "
  71. message "&4+--> &f&l/aukcja anuluj &c- &6Anuluje aukcje."
  72. message " "
  73. message "&4+--> &f&l/aukcja info &c- &6Info. na temat aktualnej aukcji."
  74. message " "
  75. message "&4+--> &f&l/aukcja podbij &c- &6Podbija cene."
  76. message " "
  77. message "&4+--> &f&l/aukcja pomoc &c- &6Komendy/opis."
  78. message " "
  79. message "&3* { -- } --- > &f&lAuctions&4&l++ &3< --- { -- } *"
  80. stop
  81. if arg 1 is "wystaw":
  82. if player has permission "auctions.create":
  83. if arg 2 isn't set:
  84. message "&f&lAukcja &c/aukcja wystaw [cena np. 20] [item]"
  85. stop
  86. else:
  87. if arg 3 isn't set:
  88. message "&f&lAukcja &c/aukcja wystaw [cena np. 20] [item]"
  89. stop
  90. else:
  91. set {_item} to arg 3 parsed as items
  92. if player don't have {_item}:
  93. message "&f&lAukcja &cNie posiadasz: %{_item}% !"
  94. stop
  95. else:
  96. set {_price} to "%arg 2%"
  97. if {_price} contains "0" or "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9":
  98. if {_price} contains "/" or "*" or "!" or "\" or "|" or "<" or ">" or "[" or "]" or "a" or "b" or "c" or "d" or "e" or "f" or "g" or "h" or "i" or "j" or "k" or "r" or "s" or "w" or "t":
  99. message "&f&lAukcja &cArgument 2 nie moze zawierac znakow specialnych i liter !"
  100. stop
  101. else:
  102. if {auctions.exists} is true:
  103. message "&f&lAukcja &cInna aukcja jest juz wystawiona ! Poczekaj na jej zakonczenie."
  104. stop
  105. else:
  106. if {_item} is air:
  107. message "&f&lAukcja &cNie mozesz sprzedac powietrza !"
  108. stop
  109. else:
  110. set {_remove} to arg 3 parsed as items
  111. if "%{_remove}%" is "<none>":
  112. message "&f&lAukcja &c%arg 3% nie jest przedmiotem !"
  113. stop
  114. else:
  115. remove {_remove} from player's inventory
  116. set {auctions.exists} to true
  117. set {auctions.creator} to "%player%"
  118. set {auctions.forsale} to "%arg 3%"
  119. set {auctions.price} to "%arg 2%"
  120. message "&c&l%player% &9utworzyl aukcje ! Przedmiot do kupna: &f%{_remove}% &9Cena: &f&l%{auctions.price}% &cPo 2 minutach aukcja zostanie automatycznie zakonczona." to all players
  121. message "&c&lWpisz: &f/aukcja podbij &caby podbic cene o +5 !"
  122. stop
  123. else:
  124. message "&f&lAukcja &cArgument 2 nie jest cyfra (np. 20)"
  125. stop
  126. else:
  127. message "&4Nie posiadasz do tego uprawnien."
  128. stop
  129. if arg 1 is "anuluj":
  130. if player has permission "auctions.cancel":
  131. if {auctions.exists} is false:
  132. message "&f&lAukcja &cAktualnie nie ma zadnej aukcji."
  133. stop
  134. else:
  135. set {_player} to "%player%"
  136. if {auctions.creator} isn't "%{_player}%":
  137. if player has permission "auctions.cancel.admin":
  138. set {auctions.exists} to false
  139. set {_add} to "%{auctions.forsale}%"
  140. set {_ad} to "%{_add}%" parsed as items
  141. add {_ad} to player
  142. wait 1 second
  143. set {auctions.time} to 0
  144. delete {auctions.exists.leader}
  145. delete {auctions.creator}
  146. delete {auctions.forsale}
  147. delete {auctions.price}
  148. message "&c&l%player% &9anulowal aukcje ! Nie jest juz ona aktywna." to all players
  149. stop
  150. else:
  151. message "&f&lAukcja &cNie jestes wlascicielem tej aukcji !"
  152. stop
  153. else:
  154. set {auctions.exists} to false
  155. set {_add} to "%{auctions.forsale}%"
  156. set {_ad} to "%{_add}%" parsed as items
  157. add {_ad} to player
  158. wait 1 second
  159. set {auctions.time} to 0
  160. delete {auctions.exists.leader}
  161. delete {auctions.creator}
  162. delete {auctions.forsale}
  163. delete {auctions.price}
  164. message "&c&l%player% &9anulowal aukcje ! Nie jest juz ona aktywna." to all players
  165. stop
  166. else:
  167. message "&4Nie posiadasz do tego uprawnien."
  168. stop
  169. if arg 1 is "info":
  170. if player has permission "auctions.active":
  171. if {auctions.exists} is false:
  172. message "&f&lAukcja &cAktualnie nie ma zadnej aukcji."
  173. stop
  174. else:
  175. set {_creator} to "%{auctions.creator}%"
  176. set {_item} to "%{auctions.forsale}%" parsed as items
  177. set {_price} to "%{auctions.price}%"
  178. message "&f&l-- Auctions ++ --"
  179. message "&cWlasciciel: &6%{_creator}%"
  180. message "&cPrzedmiot: &6%{_item}%"
  181. message "&cCena: &6%{_price}%"
  182. message "&cCzas: &6%{auctions.time}%&f/&9200 &6sec."
  183. message "&f&l-- Auctions ++ --"
  184. stop
  185. else:
  186. message "&4Nie posiadasz do tego uprawnien."
  187. stop
  188. if arg 1 is "podbij":
  189. if player has permission "auctions.raise":
  190. if {auctions.exists} is false:
  191. message "&f&lAukcja &cAktualnie nie ma zadnej aukcji."
  192. stop
  193. else:
  194. set {_creator} to "%{auctions.creator}%"
  195. if {_creator} is "%player%":
  196. message "&f&lAukcja &cNie mozesz podbijac ceny swojej aukcji !"
  197. stop
  198. else:
  199. set {_price} to "%{auctions.price}%" parsed as number
  200. if player's money is greater or equal to {_price}+{auctions.data.raise}:
  201. set {auctions.price} to {_price} + {auctions.data.raise}
  202. set {auctions.exists.leader} to "%player%"
  203. message "&f&lAukcja &c&l%player% &6podbija cene o +5 ! (Akt. cena: &f%{auctions.price}% &6)" to all players
  204. stop
  205. else:
  206. message "&f&lAukcja &cNie masz tyle pieniedzy !"
  207. stop
  208. Every 1 seconds:
  209. if {auctions.exists} is true:
  210. add 1 to {auctions.time}
  211. if {auctions.time} is 195:
  212. message "&c&l%{auctions.creator}% &9Czas do konca aukcji: &65 seconds" to all players
  213. if {auctions.time} is 196:
  214. message "&c&l%{auctions.creator}% &9Czas do konca aukcji: &64 seconds" to all players
  215. if {auctions.time} is 197:
  216. message "&c&l%{auctions.creator}% &9Czas do konca aukcji: &63 seconds" to all players
  217. if {auctions.time} is 198:
  218. message "&c&l%{auctions.creator}% &9Czas do konca aukcji: &62 seconds" to all players
  219. if {auctions.time} is 199:
  220. message "&c&l%{auctions.creator}% &9Czas do konca aukcji: &61 seconds" to all players
  221. if {auctions.time} is 200:
  222. set {_wygral} to "%{auctions.exists.leader}%"
  223. if {_wygral} is "<none>":
  224. set {_add} to "%{auctions.forsale}%"
  225. set {_ad} to "%{_add}%" parsed as items
  226. set {_creator} to "%{auctions.creator}%" parsed as player
  227. add {_ad} to {_creator}
  228. message "&c&l%{auctions.creator}% &9Aukcja zakonczona ! Nie bylo zadnego chetnego do kupna..." to all players
  229. wait 1 second
  230. set {auctions.exists} to false
  231. set {auctions.time} to 0
  232. delete {auctions.exists.leader}
  233. delete {auctions.creator}
  234. delete {auctions.price}
  235. delete {auctions.forsale}
  236. stop
  237. else:
  238. set {_price} to "%{auctions.price}%"
  239. set {_pric} to "%{_price}%" parsed as number
  240. execute console command "money take %{auctions.exists.leader}% %{_pric}%"
  241. execute console command "money give %{auctions.creator}% %{_pric}%"
  242. set {_add} to "%{auctions.forsale}%"
  243. set {_ad} to "%{_add}%" parsed as items
  244. set {_winner} to "%{auctions.exists.leader}%"
  245. set {_winne} to "%{_winner}%" parsed as player
  246. add {_ad} to {_winne}
  247. message "&c&l%{auctions.creator}% &9Aukcja zakonczona ! Aukcje wygral: &c&l%{auctions.exists.leader}%" to all players
  248. wait 1 second
  249. set {auctions.exists} to false
  250. set {auctions.time} to 0
  251. delete {auctions.exists.leader}
  252. delete {auctions.creator}
  253. delete {auctions.price}
  254. delete {auctions.forsale}
  255. stop
  256.  
  257. Every 1 minutes:
  258. if {auctions.exists} is true:
  259. set {_creator} to "%{auctions.creator}%"
  260. set {_price} to "%{auctions.price}%"
  261. set {_forsale} to "%{auctions.forsale}%" parsed as items
  262. message "&c&l%{_creator}% &9aukcja ! Przedmiot do kupna: &6%{_forsale}% &9Cena: &6%{_price}%" to all players
  263. message "&c&lWpisz: &f/aukcja podbij &caby podbic cene o +5 !" to all players
  264. stop
Advertisement
Add Comment
Please, Sign In to add comment