Guest User

SignShop v.1.3

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