xkrzysek

Auctions+ v0.3

Dec 24th, 2015
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.16 KB | None | 0 0
  1. on load:
  2. # @! Auctions+
  3. # @! skrypt umozliwiajacy tworzenie
  4. # @! aukcji na twoim serwerze.
  5. # @!
  6. # @! Wymagania:
  7. # @!
  8. # @! - Skript
  9. # @! - iConomy lub Essentials (do ekonomii)
  10. # @!
  11. # @! Uprawnienia:
  12. # @!
  13. # @! (podstawowe)
  14. # @!
  15. # @! - auctions.default
  16. # @!
  17. # @! (ponadpodstawowe)
  18. # @!
  19. # @! - auctions.admin
  20. # @!
  21. # @! Komendy:
  22. # @!
  23. # @! - /aukcja pomoc (glowna komenda Auc+)
  24. # @!
  25. # @! Autor: krzysek
  26. # @! Wersja: 0.3
  27. # @!
  28. # @! Ustawienia:
  29. # @!
  30. #
  31. # @! true = tak, false = nie
  32. #
  33. # @! Czas trwania pojedynczej aukcji
  34. # @! Najlepiej ustawiac po wielokrotnosci 30
  35. # @! w przeciwnym wypadku skrypt nie bedzie dzialac
  36. # @! 30s = odswiezanie czasu aukcji.
  37. set {auc.settings::time} to 120
  38.  
  39. # @! Koncowa wiadomosc zakonczenia aukcji
  40. # @! Zmienne:
  41. # @! {OWNER} = nazwa wlasciciela aukcji
  42. # @! {WINNER} = nazwa osoby wygrywajacej aukcje (nie dot. end-fail)
  43. # @! {PRICE} = koncowa kwota aukcji
  44. set {auc.settings::end-success} to "&a&lAukcja uzytkownika &8&l{OWNER} &a&lzostala zakonczona &c&l! &a&lAukcje wygral &8&l{WINNER}&a&l, zaplacil &8&l{PRICE} $."
  45. set {auc.settings::end-fail} to "&a&lAukcja uzytkownika &8&l{OWNER} &a&lzostala zakonczona &c&l! &8&lBrak ofert kupna."
  46.  
  47. # @! Czy wyglad wiadomosci wyswietlanej
  48. # @! przez komende /money ma byc
  49. # @! podmieniana na wiadomosc skryptu
  50. set {auc.settings::change-command} to true
  51.  
  52. # @! Jesli true (tak), to na jaka
  53. # @! Zmienne:
  54. # @! {MONEY} = pieniadze uzytkownika
  55. # @! {PLAYER} = nazwa uzytkownika
  56. set {auc.settings::change-command-format} to "&a&lTwoj stan konta, {PLAYER} &a&lwynosi: &8&l{MONEY}"
  57.  
  58. # @! Co jaka sume pieniedzy ma sie
  59. # @! podbijac stawka aukcji po
  60. # @! wpisaniu /aukcja podbij
  61. set {auc.settings::raise} to 10
  62.  
  63. # @! Koniec ustawien, reszta kodu tylko do odczytu.
  64. # @!
  65. # @!
  66. #
  67. #
  68. #
  69. stop
  70.  
  71. on load:
  72. message "&7&lAuctions+ zostal przeladowany !" to console
  73. stop
  74.  
  75. on command:
  76. if command is "money" or "balance":
  77. if {auc.settings::change-command} is true:
  78. cancel event
  79. set {_recieve} to "%{auc.settings::change-command-format}%"
  80. replace all "{MONEY}" with "%player's balance%" in {_recieve}
  81. replace all "{PLAYER}" with "%coloured player's displayname%" in {_recieve}
  82. message "%{_recieve}%"
  83. stop
  84.  
  85. variables:
  86. {auc.data::auction} = false
  87. {auc.data::time} = 0
  88.  
  89. command /aukcja [<text>] [<text>] [<text>]:
  90. description: Komendy dot. Auctions+
  91. permission: auctions.default
  92. trigger:
  93. if arg 1 isn't set:
  94. message "&c&lBledna skladnia. Wpisz: /aukcja pomoc"
  95. stop
  96. else:
  97. if arg 1 is "pomoc":
  98. message "&8&l================= Auctions+ ================="
  99. message "&a&lDostepne komendy:"
  100. message "&7&l /aukcja wystaw [cena] [przedmiot]"
  101. message "&7&l /aukcja anuluj"
  102. message "&7&l /aukcja info"
  103. message "&7&l /aukcja podbij"
  104. message " "
  105. message "&a&lAukcje podbija sie +%{auc.settings::raise}% !"
  106. message "&8&l================= Auctions+ ================="
  107. stop
  108. if arg 1 is "wystaw":
  109. if arg 2 isn't set:
  110. message "&c&lBledna skladnia. Wpisz: &f&l/aukcja wystaw [cena] [przedmiot]"
  111. stop
  112. else:
  113. if arg 3 isn't set:
  114. message "&c&lBledna skladnia. Wpisz: &f&l/aukcja wystaw [cena] [przedmiot]"
  115. stop
  116. else:
  117. if arg 2 parsed as number isn't number:
  118. message "&c&lBladna skladnia. Wpisz: &f&l/aukcja wystaw [cena] [przedmiot]"
  119. stop
  120. else:
  121. set {_item} to arg 3 parsed as items
  122. if player don't have {_item}:
  123. message "&c&lBlad. Podany przedmiot nie znajduje sie w twoim ekwipunku. (&f&l%arg 3%&c&l)"
  124. stop
  125. else:
  126. if {auc.data::auction} is true:
  127. message "&c&lBlad. Trwa juz jedna aukcja ! Poczekaj az sie skonczy. (%{auc.data::time}%s&f&l/&c&l%{auc.settings::time}%s)"
  128. stop
  129. else:
  130. set {auc.temp::owner} to player
  131. set {auc.temp::item} to arg 3 parsed as items
  132. set {auc.temp::price} to arg 2 parsed as number
  133. set {auc.data::time} to 0
  134. set {auc.data::auction} to true
  135. remove arg 3 parsed as items from player's inventory
  136. message "&9&lNowa aukcja ! &a&l%{auc.temp::item}% &7&lza &a&l%{auc.temp::price}% $. &3&lWpisz: /aukcja podbij, aby podbic cene !" to all players
  137. stop
  138. if arg 1 is "anuluj":
  139. if player has permission "auctions.admin":
  140. if {auc.data::auction} is true:
  141. give {auc.temp::item} to {auc.temp::owner}'s inventory
  142. set {auc.data::auction} to false
  143. delete {auc.temp::owner}
  144. delete {auc.temp::item}
  145. delete {auc.temp::price}
  146. delete {auc.temp::winner}
  147. set {auc.data::time} to 0
  148. message "&9&lAukcja anulowana ! &a&lAdministrator przerwal aukcje." to all players
  149. stop
  150. else:
  151. message "&c&lBlad. Aktualnie nie ma zadnej aktywnej aukcji."
  152. stop
  153. else:
  154. if {auc.data::auction} isn't true:
  155. message "&c&lBlad. Aktualnie nie ma zadnej aktywnej aukcji."
  156. stop
  157. else:
  158. if {auc.temp::owner} isn't "%player%":
  159. message "&c&lBlad. Nie jestes wlascicielem tej aukcji."
  160. stop
  161. else:
  162. give {auc.temp::item} to player's inventory
  163. set {auc.data::auction} to false
  164. delete {auc.temp::owner}
  165. delete {auc.temp::item}
  166. delete {auc.temp::price}
  167. set {auc.data::time} to 0
  168. message "&9&lAukcja anulowana ! &a&lAukcja uzytkownika &7&l%player% &a&lzostala anulowana." to all players
  169. stop
  170. if arg 1 is "info":
  171. if {auc.data::auction} is true:
  172. message "&8&l================= Auctions+ ================="
  173. message "&3&lWlasciciel aukcji: &a&l%{auc.temp::owner}%"
  174. message "&3&lCena przedmiotu: &a&l%{auc.temp::price}%"
  175. message "&3&lPrzedmiot aukcji: &a&l%{auc.temp::item}%"
  176. set {_winner} to "%{auc.temp::winner}%"
  177. replace all "<none>" with "aktualnie nie ma zadnych chetnych" in {_winner}
  178. message "&3&lWygrywa: &a&l%{_winner}%"
  179. message "&3&lCzas aukcji: &a&l%{auc.data::time}%&f&l/&a&l%{auc.settings::time}%"
  180. message "&8&l================= Auctions+ ================="
  181. stop
  182. else:
  183. message "&c&lBlad. Nie ma aktualnie zadnej aktywnej aukcji."
  184. stop
  185. if arg 1 is "podbij":
  186. if {auc.data::auction} isn't true:
  187. message "&c&lBlad. Nie ma aktualnie zadnej aktywnej aukcji."
  188. stop
  189. else:
  190. if {auc.temp::owner} isn't player:
  191. set {_price} to "%{auc.temp::price}%" parsed as number
  192. if player's money is greater or equal to {_price}+{auc.settings::raise}:
  193. add {auc.settings::raise} to {auc.temp::price}
  194. set {auc.temp::winner} to player
  195. message "&9&lPodbito aukcje ! &a&lAukcja zostala podbita o +%{auc.settings::raise}% przez %player%" to all players
  196. stop
  197. else:
  198. message "&c&lBlad. Posiadasz zbyt malo funduszy ! Wpisz: &a&l/money &c&lpo wiecej informacji"
  199. set {_min} to {_price}+{auc.settings::raise}
  200. message "&c&lMinimalna kwota zaliczajaca sie do podbijania stawki to: %{_min}%"
  201. stop
  202. else:
  203. message "&c&lBlad. Nie mozesz podbic wlasnej aukcji !"
  204. stop
  205.  
  206. every 30 seconds:
  207. if {auc.data::auction} is true:
  208. if {auc.data::time} isn't {auc.settings::time}:
  209. add 30 to {auc.data::time}
  210. message "&9&lTrwa aukcja ! &a&lPo wiecej informacji wpisz: &7&l/aukcja info" to all players
  211. stop
  212. else:
  213. if "%{auc.temp::winner}%" is "<none>" or "aktualnie nie ma zadnych chetnych":
  214. set {_msg} to {auc.settings::end-fail}
  215. give {auc.temp::item} to {auc.temp::owner}'s inventory
  216. replace all "{OWNER}" with "%{auc.temp::owner}%" in {_msg}
  217. replace all "{PRICE}" with "%{auc.temp::price}%" in {_msg}
  218. message "%{_msg}%" to all players
  219. else:
  220. set {_msg} to {auc.settings::end-success}
  221. give {auc.temp::item} to {auc.temp::winner}'s inventory
  222. replace all "{OWNER}" with "%{auc.temp::owner}%" in {_msg}
  223. replace all "{WINNER}" with "%{auc.temp::winner}%" in {_msg}
  224. replace all "{PRICE}" with "%{auc.temp::price}%" in {_msg}
  225. message "%{_msg}%" to all players
  226. set {auc.data::auction} to false
  227. delete {auc.temp::owner}
  228. delete {auc.temp::item}
  229. delete {auc.temp::price}
  230. delete {auc.temp::winner}
  231. set {auc.data::time} to 0
Advertisement
Add Comment
Please, Sign In to add comment