Guest User

SignShop v.1.2

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