4MaticPL

SignShop v.2.4

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