Guest User

SignShop v.1.4

a guest
Nov 16th, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.50 KB | None | 0 0
  1. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  2. #   Stworzone przez: 4MaticPL       #
  3. #   Wersja: 1.4                     #
  4. #                                   #
  5. #   Mozecie robic z tym skryptem    #
  6. #   co chcecie jednak prosze aby    #
  7. #   nie usuwac autora               #
  8. #                                   #
  9. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  10.  
  11. on skript load:
  12.     send "########################|SignShop|#########################" to console
  13.     send "##Create by: 4MaticPL              ##" to console
  14.     send "##Version: 1.4                     ##" to console
  15.     send "##Skript create for version 2.0.2  ##" to console
  16.     send "##Your skript version %skript-version%        ##" to console
  17.     send "######################################################################" to console
  18.  
  19. #===============================================================================================================
  20. #=============================================#OPCJE#===========================================================
  21. options:
  22.     sk: &f[&9SignShop&f]                #nazwa skryptu
  23.     chestset: true                      #automatyczne stawianie skrzyni po ustawieniu tabliczki
  24.                                         #true - skrzynka sie pojawi
  25.                                         #false - trzeba bedzie samemu postawic skrzynke
  26.                                         #-----------------------------------------------------------------------
  27.     tntexplosion: true                  #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: true                    #Pozwala na tworzenie sklepow tylko na danym swiecie
  32.                                         #true- tylko wybrany swiat
  33.                                         #false - sklepy dostepne na wszystkich swiatach
  34.  
  35.     world: world                        #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.     #---------------Uprawnienia----------------------#
  40.     perm.create: skript.signshop.create
  41.     perm.admin: skript.signshop.admin
  42.  
  43.     #------------Wyświetlane wiadomosci---------------#
  44.     worlderror: &cW tym swiecie nie mozna robic
  45.     noperm: &4Nie masz do tego prawa!
  46.     sign.material.error: &4Niepoprawne id itemu
  47.     shop.create: &6Sklep zostal pomyslnie utworzony!
  48.     shop.nochest: &4Najpierw postaw skrzynie!
  49.     shop.empty: &6Sklep jest pusty!
  50.     shop.line2.empty: &4W lini 2 wpisz Kup(K) lub Sprzedaj(S)
  51.     shop.line3.empty: &4W lini 3 wpisz ID itemu
  52.     shop.line4.empty: &4W lini 4 wpisz cene za 1 sztuke
  53.     shop.chest.open.other: &4To nie jest twoj sklep!
  54.     shop.chest.more: &6Sklep moze skladac sie tylko z jednej skrzyni
  55.     shop.chest.hopper: &6Nie mozesz stawiac hopperow obok sklepu
  56.     shop.destroy.sign: &6Sklep zostal zniszczony
  57.     shop.destroy.other: &4To nie jest twoj sklep!
  58.     shop.destroy.chest: &6Najpierw zniszcz tabliczke
  59.     shop.destroy.block: &6Ten blok jest za blisko sklepu!
  60.     shop.empty: &6Sklep jest pusty!
  61.     player.money.error: &6Masz za malo pieniedzy!
  62.     player.money.pay: &6Zaplaciles w sumie &2%{money.pay.%player%}% CC
  63.     player.money.take: &6Zarobiles w sumie &2%{money.take.%player%}% CC
  64.     player.empty: &4Nie masz itemow do sprzedania!
  65. #===============================================================================================================
  66. #==================================#SPRAWDZENIE RODZAJU SKLEPU#=================================================
  67. on sign change:
  68.     if line 1 is "[Sklep Admin]" or "[SA]" or "[sa]" or "[SklepAdmin]" or "[Sklep]":
  69.         if {@worldallow} is true:
  70.             if player is not in "{@world}":
  71.                 send "{@sk} {@worlderror}"
  72.                 set event-block to air
  73.                 drop sign
  74.                 stop
  75.     if line 1 is "[Sklep]":                                                     #====> warunek dla tworzenia: Sklep
  76.         player has permission "{@perm.create}":                    
  77.             set line 1 to "&2[Sklep]"                                          
  78.             set {_chest.check} to true                                     
  79.         else:                                                                  
  80.             message "{@sk}{@noperm}"                                           
  81.             set event-block to air                                         
  82.             drop sign                                                      
  83.             stop                                                               
  84.     else if line 1 is "[Sklep Admin]" or "[SA]" or "[sa]" or "[SklepAdmin]":    #====> warunek dla tworzenia: Sklep Admin
  85.         player has permission "{@perm.admin}":                                 
  86.             set line 1 to "&4[Sklep Admin]"                                    
  87.             set {_chest.check} to false                                    
  88.         else:                                                                  
  89.             message "{@sk}{@noperm}"                                           
  90.             set event-block to air                                             
  91.             drop sign                                                      
  92.             stop
  93. #===============================================================================================================                                                       
  94. #===================================#SPRAWDZENIE RESZTY ARGUMENTOW#=============================================
  95.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  96.         line 2 is empty:
  97.             message "{@sk}{@shop.line2.empty}"
  98.             set event-block to air
  99.             drop sign
  100.             stop
  101.         line 3 is empty:
  102.             message "{@sk}{@shop.line3.empty}"
  103.             set event-block to air
  104.             drop sign
  105.             stop
  106.         line 4 is empty:
  107.             message "{@sk}{@shop.line4.empty}"
  108.             set event-block to air
  109.             drop sign
  110.             stop
  111.         player has permission "{@perm.create}":
  112.             if line 2 is "k" or "K" or "Kup" or "kup" or "KUP" or "Buy" or "BUY" or "B" or "b":
  113.                 set line 2 to "Kup"        
  114.             else if line 2 is "s" or "S" or "Sprzedaj" or "SPRZEDAJ" or "sprzedaj" or "Sell" or "sell":
  115.                 set line 2 to "Sprzedaj"
  116.             else:
  117.                 message "{@sk}{@shop.line2.empty}"
  118.                 set event-block to air
  119.                 drop sign
  120.                 stop
  121. #===============================================================================================================
  122. #=========================================#SPRAWDZENIE CZY JEST SKRZYNKA========================================
  123.         if {_chest.check} is true:
  124.             if block below event-block is chest:        #====> warunek jeśli skrzynka jest
  125.                 message "{@sk}{@shop.create}"
  126.                 set {shop.list::%location of block%} to "%name of player%"
  127.             else:
  128.                 if {@chestset} is true:
  129.                     set block below event-block to chest    #====> warunek jeśli nie ma skrzynki
  130.                 message "{@sk}{@shop.create}"
  131.                 set {shop.list::%location of block%} to "%name of player%"
  132.                 stop
  133. #===============================================================================================================
  134. #============================================#USUWANIE SKLEPU#==================================================
  135. on break of sign:
  136.     {shop.list::%location of block%} is set:
  137.         if player has permission "shop.admin":
  138.             delete {shop.list::%location of block%}
  139.             message "{@sk}{@shop.destroy.sign}"
  140.             wait 1 tick
  141.             set event-block to air
  142.         else if "%name of player%" is "%{shop.list::%location of block%}%":
  143.             delete {shop.list::%location of block%}
  144.             message "{@sk}{@shop.destroy.sign}"
  145.         else:
  146.             message "{@sk}{@shop.destroy.other}"
  147.             cancel event
  148.  
  149.  
  150. on break:
  151.     loop blocks in radius 1 of event-block:
  152.         if {shop.list::%location of loop-block%} is set:
  153.             if y-coord of loop-block is greater than or equal to y-coord of event-block:
  154.                 if event-block is chest:
  155.                     message "{@sk}{@shop.destroy.chest}"
  156.                 else:
  157.                     message "{@sk}{@shop.destroy.block}"
  158.                     set event-block to air
  159.                 cancel event
  160.                 stop trigger
  161. #====================================#DODATKOWE ZABEZPIECZENIA#===============================================
  162. on explosion:
  163.     loop blocks in radius 5 of event-location:
  164.         loop-block is chest:
  165.             {shop.list::%location of block above loop-block%} is set:
  166.                 if {@tntexplosion} is false:
  167.                     message "{@sk}{@shop.chest.more}"
  168.                     cancel event
  169.                     stop                   
  170.                 else:
  171.                     clear {shop.list::%location of block above loop-block%}
  172.                     stop
  173. on place of chest:
  174.     loop blocks in radius 1 around event-block:
  175.         loop-block is chest
  176.         y-coord of loop-block is y-coord of event-block
  177.         {shop.list::%location of block above loop-block%} is set
  178.         message "{@sk}{@shop.chest.more}"
  179.         cancel event
  180.         stop
  181.  
  182. on place of hopper:
  183.     loop blocks in radius 1 around event-block:
  184.         {shop.list::%location of block above loop-block%} is set
  185.         message "{@sk}{@shop.chest.hopper}"
  186.         cancel event
  187.         stop
  188. #==============================================================================================================
  189. #===================================#BLOKADA DOSTĘPU DO CZYJEGOŚ SKLEPU#=======================================
  190. on rightclick on chest:
  191.     {shop.list::%location of block above event-block%} is set
  192.     if {shop.list::%location of block above event-block%} is "%name of player%":
  193.         stop
  194.     else:
  195.         if player has permission "{@perm.admin}":
  196.             send "{@sk}&6Drogi Adminie %name of player% wlasnie otwierasz kogos sklep :D"
  197.             stop
  198.         message "{@sk}{@shop.chest.open.other}"
  199.         cancel event
  200. #==============================================================================================================
  201. #============================#OBSLUGA KUPNA I SPRZEDARZY SKLEP I SKLEP ADMIN#==================================
  202. on rightclick on sign:
  203.     if line 1 is "&4[Sklep Admin]" or "&2[Sklep]":
  204.         if line 1 is "&4[Sklep Admin]":
  205.             set {_chest.check} to false
  206.         else if line 1 is "&2[Sklep]":
  207.             set {_chest.check} to true
  208.         else:
  209.             stop
  210.         if line 2 is "Kup":
  211.             wait 5 tick
  212.             set {_item} to line 3 parsed as itemtype
  213.             set {_int} to line 4 parsed as integer
  214.             set {_owner} to {shop.list::%location of block%} parsed as player
  215.             if {_chest.check} is true:
  216.                 if block below event-block contain {_item}:
  217.                     if player's balance is greater than or equal to {_int}:
  218.                         if {_chest.check} is true:
  219.                             add {_int} to {_owner}'s balance
  220.                             remove {_int} from player's balance
  221.                             remove {_item} from block below event-block
  222.                             give {_item} to the player
  223.                             stop
  224.                     else:
  225.                         message "{@sk}{@player.money.error}"
  226.                         stop
  227.                 else:
  228.                     message "{@sk}{@shop.empty}"
  229.                     stop
  230.             else:
  231.                 if player's balance is greater than or equal to {_int}:
  232.                     remove {_int} from player's balance
  233.                     give {_item} to the player
  234.                     stop
  235.                 else:
  236.                     message "{@sk}{@player.money.error}"
  237.                     stop
  238.         if line 2 is "Sprzedaj":
  239.             wait 5 tick
  240.             set {_item} to line 3 parsed as itemtype
  241.             set {_int} to line 4 parsed as integer
  242.             set {_owner} to {shop.list::%location of block%} parsed as player
  243.             if {_chest.check} is true:
  244.                 if player has {_item}:
  245.                     if {_owner}'s balance is greater than or equal to {_int}:
  246.                         if {_chest.check} is true:
  247.                             remove {_int} from {_owner}'s balance
  248.                             add {_int} to player's balance
  249.                             add {_item} to block below event-block
  250.                             remove {_item} from the player's inventory
  251.                             stop
  252.                     else:
  253.                         message "{@sk}{@player.money.error}"
  254.                         stop
  255.                 else:
  256.                     message "{@sk}{@player.empty}"
  257.                     stop
  258.             else:
  259.                 if player has {_item}:
  260.                     add {_int} to player's balance
  261.                     remove {_item} from the player's inventory
  262.                     stop
  263.                 else:
  264.                     message "{@sk}{@player.empty}"
  265.                     stop
Advertisement
Add Comment
Please, Sign In to add comment