Guest User

SignShop

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