4MaticPL

SignShop v.2.3

Feb 5th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.04 KB | None | 0 0
  1. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  2. #   Stworzone przez: 4MaticPL       #
  3. #   Wersja: 2.3                     #
  4. #                                   #
  5. #   Mozecie robic z tym skryptem    #
  6. #   co chcecie jednak prosze aby    #
  7. #   nie usuwac autora               #
  8. #                                   #
  9. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  10.  
  11. #===================================================================================================================#
  12. #=============================================#OPCJE#===============================================================#
  13. #===================================================================================================================#
  14. options:
  15.  
  16.     version: 2.3
  17.  
  18.     max_buy: 5000                       #Maksymalna cena kupna
  19.     max_sell: 5000                      #Maksymalna cena sprzedarzy
  20.  
  21.     chestset: true                      #automatyczne stawianie skrzyni po ustawieniu tabliczki
  22.                                         #true - skrzynka sie pojawi
  23.                                         #false - trzeba bedzie samemu postawic skrzynke
  24.                                        
  25.     tntexplosion: false                 #Blokuje wybuch tnt w okolicjach sklepu
  26.                                         #true - tnt wybucha normalnie
  27.                                         #false - tnt wybucha ale nie niszczy sklepu i blokow w promieniu 5 kratek
  28.  
  29.     worldallow: false                   #Pozwala na tworzenie sklepow tylko na danym swiecie
  30.                                         #true- tylko wybrany swiat
  31.                                         #false - sklepy dostepne na wszystkich swiatach
  32.  
  33.     world: SPAWN                        #Tutaj podajesz nazwe swiata,na ktorym maja dzialac sklepy
  34.                                         #musisz tutaj podac nazwe swiata, ktora jest juz na serwerze
  35.                                         #w innym przypadku wyskoczy blad
  36.  
  37.     morechest: false                    #Umozliwia to tworzenie sklepow z podwojnych skrzyn
  38.                                         #true - sklep moze skladac sie z podwojnej skrzyni
  39.                                         #false - sklep moze byc stworzony tylko z 1 skrzyni
  40.  
  41.     hopperpick: false                   #Umozliwia zabieranie itemow ze skrzyni sklepowej przez hopper
  42.                                         #true - mozna krasc itemy
  43.                                         #false - kradzierz jest zablokowana
  44.  
  45.     creativecontrol: true               #Blokada kupowania w trybie creative
  46.                                         #true - nie mozna kupowac w trybie creative
  47.                                         #false - mozna kupowac w trybie creative
  48.  
  49.     addons: true                        #Obsluga dodatkow (w budowie)
  50.                                         #true - dodatki sa obslugiwane
  51.                                         #false - dodatki sa wylaczone
  52.  
  53. #-----------------Uprawnienia-------------------------------#
  54.  
  55.     perm.create: skript.signshop.create         #Uprawnienie do tworzenia Sklep
  56.     perm.admin: skript.signshop.create.*        #Uprawnienie do tworzenia SklepAdmin
  57.  
  58. #-#-#-#-#-#-#-#-#-#-#-#-#-#
  59. #                         #
  60. #  Koniec konfiguracji    #
  61. #                         #
  62. #  Jezeli nie znasz sie   #
  63. #  na skryptach lepiej    #
  64. #  nie tykaj kodu ponizej #
  65. #           :)            #
  66. #-#-#-#-#-#-#-#-#-#-#-#-#-#
  67.  
  68. on skript load:
  69.     send "########################|SignShop|#########################" to console
  70.     send "##Create by: 4MaticPL              ##" to console
  71.     send "##Version: {@version}                     ##" to console
  72.     send "##Skript create for version 2.0.2  ##" to console
  73.     send "##Your skript version %skript-version%        ##" to console
  74.     send "######################################################################" to console
  75.  
  76. #===================================================================================================================#
  77. #==================================#SPRAWDZENIE RODZAJU SKLEPU#=====================================================#
  78. #===================================================================================================================#
  79. on sign change:
  80.     if line 1 is "[Sklep Admin]" or "[SA]" or "[sa]" or "[SklepAdmin]" or "[Sklep]":
  81.         if {@worldallow} is true:
  82.             if player is not in world "{@world}":
  83.                 send "&f[&9SignShop&f] &cW tym swiecie nie mozna robic sklepu"
  84.                 set event-block to air
  85.                 drop sign
  86.                 stop
  87.     if line 1 is "[Sklep]":                                                     #====> warunek dla tworzenia: Sklep
  88.         player has permission "{@perm.create}":                    
  89.             set line 1 to "&2[Sklep]"                                          
  90.             set {_chest.check} to true                                     
  91.         else:                                                                  
  92.             message "&f[&9SignShop&f] &4Nie masz do tego prawa!"                                           
  93.             set event-block to air                                         
  94.             drop sign                                                      
  95.             stop                                                               
  96.     else if line 1 is "[Sklep Admin]" or "[SA]" or "[sa]" or "[SklepAdmin]" or "&4[Sklep Admin]":   #====> warunek dla tworzenia: Sklep Admin
  97.         player has permission "{@perm.admin}":                                 
  98.             set line 1 to "&4[Sklep Admin]"                                    
  99.             set {_chest.check} to false                                    
  100.         else:                                                                  
  101.             message "&f[&9SignShop&f] &4Nie masz do tego prawa!"                                           
  102.             set event-block to air                                             
  103.             drop sign                                                      
  104.             stop
  105. #===================================================================================================================#                                                      
  106. #===================================#SPRAWDZENIE RESZTY ARGUMENTOW#=================================================#
  107. #===================================================================================================================#
  108.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  109.         line 2 is empty:
  110.             send "&f[&9SignShop&f] &4Podaj ilosc itemu"
  111.             set event-block to air
  112.             drop sign
  113.             stop
  114.         line 3 is empty:
  115.             send "&f[&9SignShop&f] &4W lini 3 wpisz ID itemu"
  116.             set event-block to air
  117.             drop sign
  118.             stop
  119.         line 4 is empty:
  120.             send "&f[&9SignShop&f] &4W lini 4 wpisz cene za 1 sztuke"
  121.             set event-block to air
  122.             drop sign
  123.             stop
  124. #===================================================================================================================#
  125. #=========================================#SPRAWDZENIE CZY JEST SKRZYNKA============================================#
  126. #===================================================================================================================#
  127.         if {_chest.check} is true:
  128.             if block below event-block is chest:        #====> warunek jeśli skrzynka jest
  129.                 send "&f[&9SignShop&f] &6Sklep zostal pomyslnie utworzony!"
  130.                 set {shop.list::%location of block%} to "%name of player%"
  131.             else:
  132.                 if {@chestset} is true:
  133.                     set block below event-block to chest    #====> warunek jeśli nie ma skrzynki
  134.                 set {shop.list::%location of block%} to "%name of player%"
  135.                 send "&f[&9SignShop&f] &6Sklep zostal pomyslnie utworzony!"
  136.                 stop
  137.         if {_chest.check} is false:
  138.             send "&f[&9SignShop&f] &6Sklep zostal pomyslnie utworzony!"
  139.             stop
  140. #===================================================================================================================#
  141. #============================================#USUWANIE SKLEPU#======================================================#
  142. #===================================================================================================================#
  143. on break of sign:
  144.     {shop.list::%location of block%} is set:
  145.         if player has permission "{@perm.admin}":
  146.             delete {shop.list::%location of block%}
  147.             message "&f[&9SignShop&f] &6Sklep zostal zniszczony"
  148.             wait 1 tick
  149.             set event-block to air
  150.         else if "%name of player%" is "%{shop.list::%location of block%}%":
  151.             delete {shop.list::%location of block%}
  152.             message "&f[&9SignShop&f] &6Sklep zostal zniszczony"
  153.         else:
  154.             message "&f[&9SignShop&f] &4To nie jest twoj sklep!"
  155.             cancel event
  156.             stop
  157.  
  158. on break:
  159.     loop blocks in radius 1 of event-block:
  160.         if {shop.list::%location of loop-block%} is set:
  161.             if block behind event-block is loop-block:
  162.                 message "&f[&9SignShop&f] &6Najpierw zniszcz tabliczke"
  163.                 cancel event
  164.             if block below loop-block is chest:
  165.                 message "&f[&9SignShop&f] &6Najpierw zniszcz tabliczke"
  166.                 cancel event
  167.                 stop
  168. #===================================================================================================================#
  169. #====================================#DODATKOWE ZABEZPIECZENIA#=====================================================#
  170. #===================================================================================================================#
  171. on explosion:
  172.     loop blocks in radius 5 of event-location:
  173.         loop-block is chest:
  174.             {shop.list::%location of block above loop-block%} is set:
  175.                 if {@tntexplosion} is true:
  176.                     message "&f[&9SignShop&f] &6Sklep moze skladac sie tylko z jednej skrzyni"
  177.                     cancel event
  178.                     stop                   
  179.                 else:
  180.                     clear {shop.list::%location of block above loop-block%}
  181.                     stop
  182. on place of chest:
  183.     loop blocks in radius 2 around event-block:
  184.         if loop-block is chest:
  185.             if y-coord of loop-block is y-coord of event-block:
  186.                 if {shop.list::%location of block above loop-block%} is set:
  187.                     if block above loop-block is chest:
  188.                         if {@morechest} is false:
  189.                             message "&f[&9SignShop&f] &6Sklep moze skladac sie tylko z jednej skrzyni"
  190.                             cancel event
  191.                             stop
  192. on place:
  193.     if {shop.list::%block behind event-block%} is set:
  194.         cancel event
  195.  
  196. on place of hopper:
  197.     loop blocks in radius 1 around event-block:
  198.         if {shop.list::%location of block above loop-block%} is set:
  199.             if {@hopperpick} is false:
  200.                 message "&f[&9SignShop&f] &6Nie mozesz stawiac hopperow obok sklepu"
  201.                 cancel event
  202.                 stop
  203. #===================================================================================================================#
  204. #===================================#BLOKADA DOSTĘPU DO CZYJEGOŚ SKLEPU#============================================#
  205. #===================================================================================================================#
  206. on rightclick on chest:
  207.     if {shop.list::%location of block above event-block%} is set:
  208.         if {shop.list::%location of block above event-block%} is not "%name of player%":
  209.             if player has permission "{@perm.admin}":
  210.                 stop
  211.             else:
  212.                 message "&f[&9SignShop&f] &4To nie jest twoj sklep!"
  213.                 cancel event
  214.                 stop
  215. #==================================================================================================================#
  216. #============================#OBSLUGA KUPNA I SPRZEDARZY SKLEP I SKLEP ADMIN#======================================#
  217. #==================================================================================================================#
  218. on rightclick on sign:
  219.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  220.         if player's gamemode is creative:
  221.             if player is not op:
  222.                 if {@creativecontrol} is true:
  223.                     send "&f[&9SignShop&f] &cZmien tryb gry na survival!"
  224.                     stop
  225.         if line 1 is "&4[Sklep Admin]":
  226.             set {_chest.check} to false
  227.         else if line 1 is "&2[Sklep]":
  228.             set {_chest.check} to true
  229.             if block below event-block is not chest:
  230.                 message "&f[&9SignShop&f] &4Sklep nie posiada skrzyni!"
  231.                 stop
  232.         else:
  233.             stop
  234.  
  235.         wait 5 tick
  236.  
  237.         line 3 of clicked block contains "K":
  238.             loop {@max_buy} times:
  239.                 line 3 of clicked block contains "K %loop-number%:":
  240.                     set {_int} to loop-number
  241.         set {_amount} to line 2 parsed as integer
  242.         set {_item} to line 4 parsed as itemtype
  243.         set {_owner} to {shop.list::%location of block%} parsed as player
  244.         if {_chest.check} is true:
  245.             if block below event-block contain {_amount} of {_item}:
  246.                 if player's balance is greater than or equal to {_int}:
  247.                     if {_chest.check} is true:
  248.                         add {_int} to {_owner}'s balance
  249.                         remove {_int} from player's balance
  250.                         remove {_amount} of {_item} from block below event-block
  251.                         give {_amount} of {_item} to the player
  252.                         stop
  253.                 else:
  254.                     message "&f[&9SignShop&f] &6Masz za malo pieniedzy!"
  255.                     stop
  256.             else:
  257.                 message "&f[&9SignShop&f] &6Sklep jest pusty!"
  258.                 stop
  259.         else:
  260.             if player's balance is greater than or equal to {_int}:
  261.                 remove {_int} from player's balance
  262.                 give {_item} to the player
  263.                 stop
  264.             else:
  265.                 message "&f[&9SignShop&f] &6Masz za malo pieniedzy!"
  266.                 stop
  267.  
  268.  
  269. on leftclick on sign:
  270.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  271.         if player's gamemode is creative:
  272.             if player is not op:
  273.                 if {@creativecontrol} is true:
  274.                     send "&f[&9SignShop&f] &cZmien tryb gry na survival!"
  275.                     stop
  276.         if line 1 is "&4[Sklep Admin]":
  277.             set {_chest.check} to false
  278.         else if line 1 is "&2[Sklep]":
  279.             set {_chest.check} to true
  280.             if block below event-block is not chest:
  281.                 message "&f[&9SignShop&f] &4Sklep nie posiada skrzyni!"
  282.                 stop
  283.         else:
  284.             stop
  285.  
  286.         wait 5 tick
  287.  
  288.         line 3 of clicked block contains "S":
  289.             loop {@max_sell} times:
  290.                 line 3 of clicked block contains ":%loop-number% S":
  291.                     set {_int} to loop-number
  292.         set {_amount} to line 2 parsed as integer
  293.         set {_item} to line 4 parsed as itemtype
  294.         set {_owner} to {shop.list::%location of block%} parsed as player
  295.         if {_chest.check} is true:
  296.             if player has {_amount} of {_item}:
  297.                 if {_owner}'s balance is greater than or equal to {_int}:
  298.                     if {_chest.check} is true:
  299.                         remove {_int} from {_owner}'s balance
  300.                         add {_int} to player's balance
  301.                         add {_amount} of {_item} to block below event-block
  302.                         remove {_amount} of {_item} from the player's inventory
  303.                         stop
  304.                 else:
  305.                     message "&f[&9SignShop&f] &6Wlasciciel sklepu nie ma juz pieniedzy!"
  306.                     stop
  307.             else:
  308.                 message "&f[&9SignShop&f] &4Nie masz wystarczajaco itemow do sprzedania!"
  309.                 stop
  310.         else:
  311.             if player has {_item}:
  312.                 add {_int} to player's balance
  313.                 remove {_item} from the player's inventory
  314.                 stop
  315.             else:
  316.                 message "&f[&9SignShop&f] &4Nie masz itemow do sprzedania!"
  317.                 stop
Advertisement
Add Comment
Please, Sign In to add comment