4MaticPL

SignShop v.2.2

Jan 28th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.07 KB | None | 0 0
  1. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  2. #   Stworzone przez: 4MaticPL       #
  3. #   Wersja: 2.2                     #
  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: 2.2
  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: false                 #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: world                        #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.     creativecontrol: true               #Blokada kupowania w trybie creative
  44.                                         #true - nie mozna kupowac w trybie creative
  45.                                         #false - mozna kupowac w trybie creative
  46.  
  47.     addons: true                        #Obsluga dodatkow (w budowie)
  48.                                         #true - dodatki sa obslugiwane
  49.                                         #false - dodatki sa wylaczone
  50.  
  51. #-----------------Uprawnienia-------------------------------#
  52.  
  53.     perm.create: skript.signshop.create         #Uprawnienie do tworzenia Sklep
  54.     perm.admin: skript.signshop.create.*        #Uprawnienie do tworzenia SklepAdmin
  55.  
  56. #-----------------Wyświetlane wiadomosci--------------------#
  57.  
  58.     noperm: &4Nie masz do tego prawa!
  59.  
  60.     worlderror: &cW tym swiecie nie mozna robic sklepu
  61.  
  62.     shop.create: &6Sklep zostal pomyslnie utworzony!
  63.     shop.nochest: &4Sklep nie posiada skrzyni!
  64.     shop.empty: &6Sklep jest pusty!
  65.     shop.line2.empty: &4Podaj ilosc itemu
  66.     shop.line3.empty: &4W lini 3 wpisz ID itemu
  67.     shop.line4.empty: &4W lini 4 wpisz cene za 1 sztuke
  68.     shop.chest.open.other: &4To nie jest twoj sklep!
  69.     shop.chest.more: &6Sklep moze skladac sie tylko z jednej skrzyni
  70.     shop.chest.hopper: &6Nie mozesz stawiac hopperow obok sklepu
  71.     shop.destroy.sign: &6Sklep zostal zniszczony
  72.     shop.destroy.other: &4To nie jest twoj sklep!
  73.     shop.destroy.block: &6Najpierw zniszcz tabliczke
  74.     shop.empty: &6Sklep jest pusty!
  75.  
  76.     player.creative: &cZmien tryb gry na survival!
  77.     player.money.error: &6Masz za malo pieniedzy!
  78.     player.empty: &4Nie masz itemow do sprzedania!
  79.  
  80.     owner.money.error: &6Wlasciciel sklepu nie ma juz pieniedzy!
  81. #-----------------------------------------------------------------#
  82.  
  83. #-#-#-#-#-#-#-#-#-#-#-#-#-#
  84. #                         #
  85. #  Koniec konfiguracji    #
  86. #                         #
  87. #  Jezeli nie znasz sie   #
  88. #  na skryptach lepiej    #
  89. #  nie tykaj kodu ponizej #
  90. #           :)            #
  91. #-#-#-#-#-#-#-#-#-#-#-#-#-#
  92.  
  93. on skript load:
  94.     send "########################|SignShop|#########################" to console
  95.     send "##Create by: 4MaticPL              ##" to console
  96.     send "##Version: {@version}                     ##" to console
  97.     send "##Skript create for version 2.0.2  ##" to console
  98.     send "##Your skript version %skript-version%        ##" to console
  99.     send "######################################################################" to console
  100.  
  101. #===============================================================================================================
  102. #==================================#SPRAWDZENIE RODZAJU SKLEPU#=================================================
  103. on sign change:
  104.     if line 1 is "[Sklep Admin]" or "[SA]" or "[sa]" or "[SklepAdmin]" or "[Sklep]":
  105.         if {@worldallow} is true:
  106.             if player is not in world "{@world}":
  107.                 send "{@sk} {@worlderror}"
  108.                 set event-block to air
  109.                 drop sign
  110.                 stop
  111.     if line 1 is "[Sklep]":                                                     #====> warunek dla tworzenia: Sklep
  112.         player has permission "{@perm.create}":                    
  113.             set line 1 to "&2[Sklep]"                                          
  114.             set {_chest.check} to true                                     
  115.         else:                                                                  
  116.             message "{@sk}{@noperm}"                                           
  117.             set event-block to air                                         
  118.             drop sign                                                      
  119.             stop                                                               
  120.     else if line 1 is "[Sklep Admin]" or "[SA]" or "[sa]" or "[SklepAdmin]":    #====> warunek dla tworzenia: Sklep Admin
  121.         player has permission "{@perm.admin}":                                 
  122.             set line 1 to "&4[Sklep Admin]"                                    
  123.             set {_chest.check} to false                                    
  124.         else:                                                                  
  125.             message "{@sk}{@noperm}"                                           
  126.             set event-block to air                                             
  127.             drop sign                                                      
  128.             stop
  129. #===============================================================================================================                                                       
  130. #===================================#SPRAWDZENIE RESZTY ARGUMENTOW#=============================================
  131.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  132.         line 2 is empty:
  133.             message "{@sk}{@shop.line2.empty}"
  134.             set event-block to air
  135.             drop sign
  136.             stop
  137.         line 3 is empty:
  138.             message "{@sk}{@shop.line3.empty}"
  139.             set event-block to air
  140.             drop sign
  141.             stop
  142.         line 4 is empty:
  143.             message "{@sk}{@shop.line4.empty}"
  144.             set event-block to air
  145.             drop sign
  146.             stop
  147. #===============================================================================================================
  148. #=========================================#SPRAWDZENIE CZY JEST SKRZYNKA========================================
  149.         if {_chest.check} is true:
  150.             if block below event-block is chest:        #====> warunek jeśli skrzynka jest
  151.                 message "{@sk}{@shop.create}"
  152.                 set {shop.list::%location of block%} to "%name of player%"
  153.             else:
  154.                 if {@chestset} is true:
  155.                     set block below event-block to chest    #====> warunek jeśli nie ma skrzynki
  156.                 set {shop.list::%location of block%} to "%name of player%"
  157.                 message "{@sk}{@shop.create}"
  158.                 stop
  159. #===============================================================================================================
  160. #============================================#USUWANIE SKLEPU#==================================================
  161. on break of sign:
  162.     {shop.list::%location of block%} is set:
  163.         if player has permission "{@perm.admin}":
  164.             delete {shop.list::%location of block%}
  165.             message "{@sk}{@shop.destroy.sign}"
  166.             wait 1 tick
  167.             set event-block to air
  168.         else if "%name of player%" is "%{shop.list::%location of block%}%":
  169.             delete {shop.list::%location of block%}
  170.             message "{@sk}{@shop.destroy.sign}"
  171.         else:
  172.             message "{@sk}{@shop.destroy.other}"
  173.             cancel event
  174.             stop
  175.  
  176. on break:
  177.     loop blocks in radius 1 of event-block:
  178.         if {shop.list::%location of loop-block%} is set:
  179.             if block behind event-block is loop-block:
  180.                 message "{@sk}{@shop.destroy.block}"
  181.                 cancel event
  182.             if block below loop-block is chest:
  183.                 message "{@sk}{@shop.destroy.block}"
  184.                 cancel event
  185.                 stop
  186. #====================================#DODATKOWE ZABEZPIECZENIA#===============================================
  187. on explosion:
  188.     loop blocks in radius 5 of event-location:
  189.         loop-block is chest:
  190.             {shop.list::%location of block above loop-block%} is set:
  191.                 if {@tntexplosion} is true:
  192.                     message "{@sk}{@shop.chest.more}"
  193.                     cancel event
  194.                     stop                   
  195.                 else:
  196.                     clear {shop.list::%location of block above loop-block%}
  197.                     stop
  198. on place of chest:
  199.     loop blocks in radius 2 around event-block:
  200.         if loop-block is chest:
  201.             if y-coord of loop-block is y-coord of event-block:
  202.                 if {shop.list::%location of block above loop-block%} is set:
  203.                     if block above loop-block is chest:
  204.                         if {@morechest} is false:
  205.                             message "{@sk}{@shop.chest.more}"
  206.                             cancel event
  207.                             stop
  208. on place:
  209.     if {shop.list::%block behind event-block%} is set:
  210.         cancel event
  211.  
  212. on place of hopper:
  213.     loop blocks in radius 1 around event-block:
  214.         if {shop.list::%location of block above loop-block%} is set:
  215.             if {@hopperpick} is false:
  216.                 message "{@sk}{@shop.chest.hopper}"
  217.                 cancel event
  218.                 stop
  219. #==============================================================================================================
  220. #===================================#BLOKADA DOSTĘPU DO CZYJEGOŚ SKLEPU#=======================================
  221. on rightclick on chest:
  222.     if {shop.list::%location of block above event-block%} is set:
  223.         if {shop.list::%location of block above event-block%} is not "%name of player%":
  224.             if player has permission "{@perm.admin}":
  225.                 stop
  226.             else:
  227.                 message "{@sk}{@shop.chest.open.other}"
  228.                 cancel event
  229.                 stop
  230. #==============================================================================================================
  231. #============================#OBSLUGA KUPNA I SPRZEDARZY SKLEP I SKLEP ADMIN#==================================
  232. on rightclick on sign:
  233.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  234.         if player's gamemode is creative:
  235.             if player is not op:
  236.                 if {@creativecontrol} is true:
  237.                     send "{@sk} {@player.creative}"
  238.                     stop
  239.         if line 1 is "&4[Sklep Admin]":
  240.             set {_chest.check} to false
  241.         else if line 1 is "&2[Sklep]":
  242.             set {_chest.check} to true
  243.             if block below event-block is not chest:
  244.                 message "{@sk} {@shop.nochest}"
  245.                 stop
  246.         else:
  247.             stop
  248.         wait 5 tick
  249.         line 3 of clicked block contains "K":
  250.             loop 9999 times:
  251.                 line 3 of clicked block contains "K %loop-number%:":
  252.                     set {_int} to loop-number
  253.         set {_amount} to line 2 parsed as integer
  254.         set {_item} to line 4 parsed as itemtype
  255.         set {_owner} to {shop.list::%location of block%} parsed as player
  256.         if {_chest.check} is true:
  257.             if block below event-block contain {_item}:
  258.                 if player's balance is greater than or equal to {_int}:
  259.                     if {_chest.check} is true:
  260.                         add {_int} to {_owner}'s balance
  261.                         remove {_int} from player's balance
  262.                         remove {_item} from block below event-block
  263.                         give {_amount} of {_item} to the player
  264.                         stop
  265.                 else:
  266.                     message "{@sk}{@player.money.error}"
  267.                     stop
  268.             else:
  269.                 message "{@sk}{@shop.empty}"
  270.                 stop
  271.         else:
  272.             if player's balance is greater than or equal to {_int}:
  273.                 remove {_int} from player's balance
  274.                 give {_item} to the player
  275.                 stop
  276.             else:
  277.                 message "{@sk}{@player.money.error}"
  278.                 stop
  279. on leftclick on sign:
  280.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  281.         if player's gamemode is creative:
  282.             if player is not op:
  283.                 if {@creativecontrol} is true:
  284.                     send "{@sk} {@player.creative}"
  285.                     stop
  286.         if line 1 is "&4[Sklep Admin]":
  287.             set {_chest.check} to false
  288.         else if line 1 is "&2[Sklep]":
  289.             set {_chest.check} to true
  290.             if block below event-block is not chest:
  291.                 message "{@sk} {@shop.nochest}"
  292.                 stop
  293.         else:
  294.             stop
  295.         wait 5 tick
  296.         line 3 of clicked block contains "S":
  297.             loop 9999 times:
  298.                 line 3 of clicked block contains ":%loop-number% S":
  299.                     set {_int} to loop-number
  300.         set {_amount} to line 2 parsed as integer
  301.         set {_item} to line 4 parsed as itemtype
  302.         set {_owner} to {shop.list::%location of block%} parsed as player
  303.         if {_chest.check} is true:
  304.             if player has {_item}:
  305.                 if {_owner}'s balance is greater than or equal to {_int}:
  306.                     if {_chest.check} is true:
  307.                         remove {_int} from {_owner}'s balance
  308.                         add {_int} to player's balance
  309.                         add {_item} to block below event-block
  310.                         remove {_amount} of {_item} from the player's inventory
  311.                         stop
  312.                 else:
  313.                     message "{@sk}{@owner.money.error}"
  314.                     stop
  315.             else:
  316.                 message "{@sk}{@player.empty}"
  317.                 stop
  318.         else:
  319.             if player has {_item}:
  320.                 add {_int} to player's balance
  321.                 remove {_item} from the player's inventory
  322.                 stop
  323.             else:
  324.                 message "{@sk}{@player.empty}"
  325.                 stop
Advertisement
Add Comment
Please, Sign In to add comment