4MaticPL

SignShop v.1.6

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