UpdaterPRO

[CODE] EasyShops

May 5th, 2015
1,145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.57 KB | None | 0 0
  1. Function openGUI(r: Integer, n: String, p: Player):
  2. open chest with {_r} rows named "%{_n}%" to {_p}
  3. Function formatSlot(s: Integer, p: Player, a: Integer, i: Item, n: String, l: String, c: String):
  4. format slot {_s} of {_p} with {_a} of {_i} named "%{_n}%" with lore "%{_l}%" to run "%{_c}%"
  5. on script load:
  6. wait a tick
  7. if folder "plugins/Skript/scripts/EasyShops" isn't exists:
  8. send "&7[&6EasyShops] &7Pobieranie plikow konfiguracyjnych..." to console
  9. create file "plugins/Skript/scripts/EasyShops/config.yml"
  10. download "http://pastebin.com/raw.php?i=0C3VbyG5" to "plugins/Skript/scripts/EasyShops/config.yml"
  11. create file "plugins/Skript/scripts/EasyShops/buy.yml"
  12. download "http://pastebin.com/raw.php?i=a155g2p2" to "plugins/Skript/scripts/EasyShops/buy.yml"
  13. create file "plugins/Skript/scripts/EasyShops/sell.yml"
  14. download "http://pastebin.com/raw.php?i=uduCxrv2" to "plugins/Skript/scripts/EasyShops/sell.yml"
  15. send "&7[&6EasyShops] &7Zakonczono pobieranie plikow konfiguracyjnych." to console
  16. set {EasyShops::buy_command} to single value "options.buy_command" get of "plugins/Skript/scripts/EasyShops/config.yml"
  17. set {EasyShops::sell_command} to single value "options.sell_command" get of "plugins/Skript/scripts/EasyShops/config.yml"
  18. on command:
  19. if full command is "%{EasyShops::buy_command}%":
  20. cancel event
  21. set {_permission} to single value "options.buy_permission" get of "plugins/Skript/scripts/EasyShops/config.yml"
  22. if player has permission "%{_permission}%":
  23. set {_items::*} to configuration section "items" get of "plugins/Skript/scripts/EasyShops/buy.yml"
  24. set {_rows} to rounded up size of {_items::*}/9
  25. set {_name} to coloured single value "options.buy_name" get of "plugins/Skript/scripts/EasyShops/config.yml"
  26. openGUI({_rows}, "%{_name}%", player)
  27. loop {_items::*}:
  28. set {_slot} to loop-value parsed as integer-1
  29. set {_przedmiot} to single value "items.%loop-value%.przedmiot" get of "plugins/Skript/scripts/EasyShops/buy.yml" parsed as item
  30. set {_ilosc} to single value "items.%loop-value%.ilosc" get of "plugins/Skript/scripts/EasyShops/buy.yml" parsed as integer
  31. set {_cena} to single value "items.%loop-value%.cena" get of "plugins/Skript/scripts/EasyShops/buy.yml" parsed as integer
  32. formatSlot({_slot}, player, {_ilosc}, {_przedmiot}, "", "&6Cena: &c$%{_cena}%", "buyitem %player% %{_cena}% %{_ilosc}% %{_przedmiot}%")
  33. stop
  34. else:
  35. set {_no_permission_message} to coloured single value "options.buy_no_permission_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
  36. send "%{_no_permission_message}%"
  37. stop
  38. if full command is "%{EasyShops::sell_command}%":
  39. cancel event
  40. set {_permission} to single value "options.sell_permission" get of "plugins/Skript/scripts/EasyShops/config.yml"
  41. if player has permission "%{_permission}%":
  42. set {_items::*} to configuration section "items" get of "plugins/Skript/scripts/EasyShops/sell.yml"
  43. set {_rows} to rounded up size of {_items::*}/9
  44. set {_name} to coloured single value "options.sell_name" get of "plugins/Skript/scripts/EasyShops/config.yml"
  45. openGUI({_rows}, "%{_name}%", player)
  46. loop {_items::*}:
  47. set {_slot} to loop-value parsed as integer-1
  48. set {_przedmiot} to single value "items.%loop-value%.przedmiot" get of "plugins/Skript/scripts/EasyShops/sell.yml" parsed as item
  49. set {_ilosc} to single value "items.%loop-value%.ilosc" get of "plugins/Skript/scripts/EasyShops/sell.yml" parsed as integer
  50. set {_cena} to single value "items.%loop-value%.cena" get of "plugins/Skript/scripts/EasyShops/sell.yml" parsed as integer
  51. formatSlot({_slot}, player, {_ilosc}, {_przedmiot}, "", "&6Cena: &c$%{_cena}%", "sellitem %player% %{_cena}% %{_ilosc}% %{_przedmiot}%")
  52. stop
  53. else:
  54. set {_no_permission_message} to coloured single value "options.sell_no_permission_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
  55. send "%{_no_permission_message}%"
  56. stop
  57. command /buyitem [<player>] [<integer>] [<integer>] [<item>]:
  58. trigger:
  59. if sender is console:
  60. if player-arg's money is more than or equal to integer-arg 1:
  61. if player-arg can hold integer-arg 2 of item-arg:
  62. set {_buy_message} to coloured single value "options.buy_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
  63. replace all "{ILOSC}" with "%integer-arg 2%" in {_buy_message}
  64. replace all "{PRZEDMIOT}" with "%item-arg%" in {_buy_message}
  65. replace all "{CENA}" with "%integer-arg 1%" in {_buy_message}
  66. replace all "{PIENIADZE}" with "%player-arg's money%" in {_buy_message}
  67. remove integer-arg 1 from player-arg's money
  68. add integer-arg 2 of item-arg to player-arg
  69. send "%{_buy_message}%" to player-arg
  70. stop
  71. else:
  72. set {_buy_no_space_message} to coloured single value "options.buy_no_space_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
  73. send "%{_buy_no_space_message}%" to player-arg
  74. stop
  75. else:
  76. set {_buy_no_money_message} to coloured single value "options.buy_no_money_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
  77. replace all "{CENA}" with "%integer-arg 1%" in {_buy_no_money_message}
  78. replace all "{PIENIADZE}" with "%player-arg's money%" in {_buy_no_money_message}
  79. replace all "{BRAKUJE}" with "%integer-arg 1-player-arg's money%" in {_buy_no_money_message}
  80. send "%{_buy_no_money_message}%" to player-arg
  81. stop
  82. else:
  83. send "Unknown command. Type ""/help"" for help." to player
  84. stop
  85. command /sellitem [<player>] [<integer>] [<integer>] [<item>]:
  86. trigger:
  87. if sender is console:
  88. if player-arg has integer-arg 2 of item-arg:
  89. set {_sell_message} to coloured single value "options.sell_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
  90. replace all "{ILOSC}" with "%integer-arg 2%" in {_sell_message}
  91. replace all "{PRZEDMIOT}" with "%item-arg%" in {_sell_message}
  92. replace all "{CENA}" with "%integer-arg 1%" in {_sell_message}
  93. replace all "{PIENIADZE}" with "%player-arg's money%" in {_sell_message}
  94. add integer-arg 1 to player-arg's money
  95. remove integer-arg 2 of item-arg from player-arg
  96. send "%{_sell_message}%" to player-arg
  97. stop
  98. else:
  99. set {sell_no_items_message} to coloured single value "options.sell_no_items_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
  100. replace all "{ILOSC}" with "%integer-arg 2%" in {sell_no_items_message}
  101. replace all "{PRZEDMIOT}" with "%item-arg%" in {sell_no_items_message}
  102. send "%{sell_no_items_message}%" to player-arg
  103. stop
  104. else:
  105. send "Unknown command. Type ""/help"" for help." to player
  106. stop
Advertisement
Add Comment
Please, Sign In to add comment