4MaticPL

SignShop v.2.0

Dec 23rd, 2013
551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.85 KB | None | 0 0
  1. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  2. #   Stworzone przez: 4MaticPL       #
  3. #   Wersja: 2.0                     #
  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.0
  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
  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: &4W lini 2 wpisz Kup(K) lub Sprzedaj(S)
  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.  
  81. #-#-#-#-#-#-#-#-#-#-#-#-#-#
  82. #                         #
  83. #  Koniec konfiguracji    #
  84. #                         #
  85. #  Jezeli nie znasz sie   #
  86. #  na skryptach lepiej    #
  87. #  nie tykaj kodu ponizej #
  88. #           :)            #
  89. #-#-#-#-#-#-#-#-#-#-#-#-#-#
  90.  
  91. on skript load:
  92.     send "########################|SignShop|#########################" to console
  93.     send "##Create by: 4MaticPL              ##" to console
  94.     send "##Version: {@version}                     ##" to console
  95.     send "##Skript create for version 2.0.2  ##" to console
  96.     send "##Your skript version %skript-version%        ##" to console
  97.     send "######################################################################" to console
  98.  
  99. #===============================================================================================================
  100. #==================================#SPRAWDZENIE RODZAJU SKLEPU#=================================================
  101. on sign change:
  102.     if line 1 is "[Sklep Admin]" or "[SA]" or "[sa]" or "[SklepAdmin]" or "[Sklep]":
  103.         if {@worldallow} is true:
  104.             if player is not in world "{@world}":
  105.                 send "{@sk} {@worlderror}"
  106.                 set event-block to air
  107.                 drop sign
  108.                 stop
  109.     if line 1 is "[Sklep]":                                                     #====> warunek dla tworzenia: Sklep
  110.         player has permission "{@perm.create}":                    
  111.             set line 1 to "&2[Sklep]"                                          
  112.             set {_chest.check} to true                                     
  113.         else:                                                                  
  114.             message "{@sk}{@noperm}"                                           
  115.             set event-block to air                                         
  116.             drop sign                                                      
  117.             stop                                                               
  118.     else if line 1 is "[Sklep Admin]" or "[SA]" or "[sa]" or "[SklepAdmin]":    #====> warunek dla tworzenia: Sklep Admin
  119.         player has permission "{@perm.admin}":                                 
  120.             set line 1 to "&4[Sklep Admin]"                                    
  121.             set {_chest.check} to false                                    
  122.         else:                                                                  
  123.             message "{@sk}{@noperm}"                                           
  124.             set event-block to air                                             
  125.             drop sign                                                      
  126.             stop
  127. #===============================================================================================================                                                       
  128. #===================================#SPRAWDZENIE RESZTY ARGUMENTOW#=============================================
  129.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  130.         line 3 is empty:
  131.             message "{@sk}{@shop.line3.empty}"
  132.             set event-block to air
  133.             drop sign
  134.             stop
  135.         line 4 is empty:
  136.             message "{@sk}{@shop.line4.empty}"
  137.             set event-block to air
  138.             drop sign
  139.             stop
  140. #===============================================================================================================
  141. #=========================================#SPRAWDZENIE CZY JEST SKRZYNKA========================================
  142.         if {_chest.check} is true:
  143.             if block below event-block is chest:        #====> warunek jeśli skrzynka jest
  144.                 message "{@sk}{@shop.create}"
  145.                 set {shop.list::%location of block%} to "%name of player%"
  146.                 set line 2 of event-block to "%name of player%"
  147.             else:
  148.                 if {@chestset} is true:
  149.                     set block below event-block to chest    #====> warunek jeśli nie ma skrzynki
  150.                 set {shop.list::%location of block%} to "%name of player%"
  151.                 set line 2 of event-block to "%name of player%"
  152.                 message "{@sk}{@shop.create}"
  153.                 stop
  154. #===============================================================================================================
  155. #============================================#USUWANIE SKLEPU#==================================================
  156. on break of sign:
  157.     {shop.list::%location of block%} is set:
  158.         if player has permission "{@perm.admin}":
  159.             delete {shop.list::%location of block%}
  160.             message "{@sk}{@shop.destroy.sign}"
  161.             wait 1 tick
  162.             set event-block to air
  163.         else if "%name of player%" is "%{shop.list::%location of block%}%":
  164.             delete {shop.list::%location of block%}
  165.             message "{@sk}{@shop.destroy.sign}"
  166.         else:
  167.             message "{@sk}{@shop.destroy.other}"
  168.             cancel event
  169.             stop
  170.  
  171. on break:
  172.     loop blocks in radius 1 of event-block:
  173.         if {shop.list::%location of loop-block%} is set:
  174.             if block behind event-block is loop-block:
  175.                 message "{@sk}{@shop.destroy.block}"
  176.                 cancel event
  177.             if block below loop-block is chest:
  178.                 message "{@sk}{@shop.destroy.block}"
  179.                 cancel event
  180.                 stop
  181. #====================================#DODATKOWE ZABEZPIECZENIA#===============================================
  182. on explosion:
  183.     loop blocks in radius 5 of event-location:
  184.         loop-block is chest:
  185.             {shop.list::%location of block above loop-block%} is set:
  186.                 if {@tntexplosion} is true:
  187.                     message "{@sk}{@shop.chest.more}"
  188.                     cancel event
  189.                     stop                   
  190.                 else:
  191.                     clear {shop.list::%location of block above loop-block%}
  192.                     stop
  193. on place of chest:
  194.     loop blocks in radius 2 around event-block:
  195.         if loop-block is chest:
  196.             if y-coord of loop-block is y-coord of event-block:
  197.                 if {shop.list::%location of block above loop-block%} is set:
  198.                     if block above loop-block is chest:
  199.                         if {@morechest} is false:
  200.                             message "{@sk}{@shop.chest.more}"
  201.                             cancel event
  202.                             stop
  203. on place:
  204.     if {shop.list::%block behind event-block%} is set:
  205.         cancel event
  206.  
  207. on place of hopper:
  208.     loop blocks in radius 1 around event-block:
  209.         if {shop.list::%location of block above loop-block%} is set:
  210.             if {@hopperpick} is false:
  211.                 message "{@sk}{@shop.chest.hopper}"
  212.                 cancel event
  213.                 stop
  214. #==============================================================================================================
  215. #===================================#BLOKADA DOSTĘPU DO CZYJEGOŚ SKLEPU#=======================================
  216. on rightclick on chest:
  217.     if {shop.list::%location of block above event-block%} is set:
  218.         if {shop.list::%location of block above event-block%} is not "%name of player%":
  219.             if player has permission "{@perm.admin}":
  220.                 stop
  221.             else:
  222.                 message "{@sk}{@shop.chest.open.other}"
  223.                 cancel event
  224.                 stop
  225. #==============================================================================================================
  226. #============================#OBSLUGA KUPNA I SPRZEDARZY SKLEP I SKLEP ADMIN#==================================
  227. on rightclick on sign:
  228.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  229.         if player's gamemode is creative:
  230.             if player is not op:
  231.                 if {@creativecontrol} is true:
  232.                     send "{@sk} {@player.creative}"
  233.                     stop
  234.         if line 1 is "&4[Sklep Admin]":
  235.             set {_chest.check} to false
  236.         else if line 1 is "&2[Sklep]":
  237.             set {_chest.check} to true
  238.             if block below event-block is not chest:
  239.                 message "{@sk} {@shop.nochest}"
  240.                 stop
  241.         else:
  242.             stop
  243.         wait 5 tick
  244.         line 3 of clicked block contains "K":
  245.             loop 9999 times:
  246.                 line 3 of clicked block contains "K %loop-number%:":
  247.                     set {_int} to loop-number
  248.         set {_item} to line 4 parsed as itemtype
  249.         set {_owner} to line 2 parsed as player
  250.         if {_chest.check} is true:
  251.             if block below event-block contain {_item}:
  252.                 if player's balance is greater than or equal to {_int}:
  253.                     if {_chest.check} is true:
  254.                         add {_int} to {_owner}'s balance
  255.                         remove {_int} from player's balance
  256.                         remove {_item} from block below event-block
  257.                         give {_item} to the player
  258.                         stop
  259.                 else:
  260.                     message "{@sk}{@player.money.error}"
  261.                     stop
  262.             else:
  263.                 message "{@sk}{@shop.empty}"
  264.                 stop
  265.         else:
  266.             if player's balance is greater than or equal to {_int}:
  267.                 remove {_int} from player's balance
  268.                 give {_item} to the player
  269.                 stop
  270.             else:
  271.                 message "{@sk}{@player.money.error}"
  272.                 stop
  273. on leftclick on sign:
  274.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  275.         if player's gamemode is creative:
  276.             if player is not op:
  277.                 if {@creativecontrol} is true:
  278.                     send "{@sk} {@player.creative}"
  279.                     stop
  280.         if line 1 is "&4[Sklep Admin]":
  281.             set {_chest.check} to false
  282.         else if line 1 is "&2[Sklep]":
  283.             set {_chest.check} to true
  284.             if block below event-block is not chest:
  285.                 message "{@sk} {@shop.nochest}"
  286.                 stop
  287.         else:
  288.             stop
  289.         wait 5 tick
  290.         line 3 of clicked block contains "S":
  291.             loop 9999 times:
  292.                 line 3 of clicked block contains ":%loop-number% S":
  293.                     set {_int} to loop-number
  294.         set {_item} to line 4 parsed as itemtype
  295.         set {_owner} to line 2 parsed as player
  296.         if {_chest.check} is true:
  297.             if player has {_item}:
  298.                 if {_owner}'s balance is greater than or equal to {_int}:
  299.                     if {_chest.check} is true:
  300.                         remove {_int} from {_owner}'s balance
  301.                         add {_int} to player's balance
  302.                         add {_item} to block below event-block
  303.                         remove {_item} from the player's inventory
  304.                         stop
  305.                 else:
  306.                     message "{@sk}{@player.money.error}"
  307.                     stop
  308.             else:
  309.                 message "{@sk}{@player.empty}"
  310.                 stop
  311.         else:
  312.             if player has {_item}:
  313.                 add {_int} to player's balance
  314.                 remove {_item} from the player's inventory
  315.                 stop
  316.             else:
  317.                 message "{@sk}{@player.empty}"
  318.                 stop
Advertisement
Add Comment
Please, Sign In to add comment