Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Author: Nawo
- # Contact: romug1337@gmail.com
- # Presentation: http://www.mpcforum.pl/topic/1423401-skrypt-na-Case-opening/
- # Launge: Polish
- variables:
- {Case::player::%player%::open} = false
- {Case::player::%player%::openwait} = false
- options:
- # General
- tag: &8[&6Case&8] # Przedrostek wiadomosci
- # Drop Case
- chance drop key: 0.2% # Szansa na wykopanie klucza podana w procentach
- chance drop chest: 0.2% # Szansa na wykopanie skrzyni podana w procentach
- block drop: stone or dirt or gravel # Z jakiego bloku mozna wykopac skrzynie/klucz
- chance death key: 0.2% # Szansa na wypadniecie klucza po zabiciu gracza
- chance death chest: 0.2% # Szansa na wypadniecie skrzyni po zabiciu gracza
- # Colour message:
- important: &6
- general: &7
- leere: &8
- lore: &c
- command /Case [<text="help">] [<text>] [<text>] [<text>]:
- trigger:
- if player has permission "Case.*":
- if arg 1 is "help":
- send "{@tag}"
- send "{@important}/Case add <name> <type> {@leere}- {@general}Dodaje nowa skrzynke."
- send "{@important}/Case remove <name> {@leere}- {@general}Usuwa skrzynke."
- send "{@important}/Case edit <name> {@leere}- {@general}Edytuje zawartosc skrzyni."
- send "{@important}/Case give <name> [<player/all>] [<number>] {@leere}- {@general}Daje nam klucz i skrzynie."
- send "{@important}/Case list {@leere}- {@general}Lista skrzyn w gui."
- send "{@important}/Case stats [<player>] {@leere}- {@general}Statystyki gracza."
- send "{@important}/Case open <name> [<player>] {@leere}- {@general}Otwiera skrzynie."
- if arg 1 is "add":
- if arg 2 is set:
- set {_name} to arg 2
- replace all "_" with " " in {_name}
- loop {Case::chestlist::*}:
- if loop-value is {_name}:
- send "{@tag} {@general}Taka skrzynia juz istnieje!"
- stop
- if arg 3 is set:
- if arg 3 is "key" or "notkey":
- add {_name} to {Case::chestlist::*}
- send "{@tag} {@general}Dodano skrzynie o nazwie {@important}%{_name}%{@general}."
- if arg 3 is "key":
- set {Case::type::%{_name}%} to "key"
- send "{@tag} {@general}Skrzynia wymaga klucza."
- if arg 3 is "notkey":
- set {Case::type::%{_name}%} to "notkey"
- send "{@tag} {@general}Skrzynia nie wymaga klucza."
- else:
- send "{@tag} {@important}/Case add <name> <type=""key""or""notkey""> "
- else:
- send "{@tag} {@important}/Case add <name> <type=""key""or""notkey""> "
- else:
- send "{@tag} {@important}/Case add <name> <type=""key""or""notkey""> "
- if arg 1 is "remove":
- if arg 2 is set:
- set {_name} to arg 2
- replace all "_" with " " in {_name}
- loop {Case::chestlist::*}:
- if loop-value is {_name}:
- remove {_name} from {Case::chestlist::*}
- delete {Case::%{_name}%::itemlist::*}
- delete {Case::type::%{_name}%}
- send "{@tag} {@general}Usunieto skrzynie o nazwie {@important}%{_name}%{@general}."
- stop
- send "{@tag} {@general}Taka skrzynia nie istnieje!"
- else:
- send "{@tag} {@important}/Case remove <name>"
- if arg 1 is "edit":
- if arg 2 is set:
- set {_name} to arg 2
- replace all "_" with " " in {_name}
- loop {Case::chestlist::*}:
- if loop-value is {_name}:
- open chest with 3 rows named "{@important}Edytujesz: {@lore}%{_name}%" to player
- wait 1 tick
- set {_slot} to 0
- loop {Case::%{_name}%::itemlist::*}:
- set slot {_slot} of current inventory of player to loop-value-2
- add 1 to {_slot}
- set {Case::player::%player%::openedit} to "%{_name}%"
- send "{@tag} {@general}Edytujesz zawartosc skrzyni {@important}%{_name}%{@general}." to player
- while inventory name of player is "{@important}Edytujesz: {@lore}%{_name}%":
- set {Case::player::%player%::openedit} to "%{_name}%"
- wait 5 tick
- stop
- send "{@tag} {@general}Taka skrzynia nie istnieje!"
- else:
- send "{@tag} {@important}/Case additem <name>"
- if arg 1 is "give":
- if arg 2 is set:
- set {_name} to arg 2
- replace all "_" with " " in {_name}
- loop {Case::chestlist::*}:
- if loop-value is {_name}:
- set {_lore} to "%{Case::%{_name}%::itemlist::*}%"
- replace all ", " with "|| {@leere}- {@lore}" in {_lore}
- replace all "and " with "|| {@leere}- {@lore}" in {_lore}
- if arg 3 is set:
- if arg 4 is set:
- set {_number} to arg 4 parsed as integer
- else:
- set {_number} to 64
- if arg 3 is "all":
- loop all players:
- if {Case::type::%{_name}%} is "key":
- add {_number} of chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to loop-player's inventory
- add {_number} of tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%" to loop-player's inventory
- else if {Case::type::%{_name}%} is "notkey":
- add {_number} of ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to loop-player's inventory
- if arg 3 is not "all":
- set {_player} to arg 3 parsed as offlineplayer
- if {Case::type::%{_name}%} is "key":
- add {_number} of chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to {_player}'s inventory
- add {_number} of tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%" to {_player}'s inventory
- else if {Case::type::%{_name}%} is "notkey":
- add {_number} of ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to {_player}'s inventory
- else:
- if {Case::type::%{_name}%} is "key":
- add 64 of chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to player's inventory
- add 64 of tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%" to player's inventory
- else:
- add 64 of ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to player's inventory
- stop
- send "{@tag} {@general}Taka skrzynia nie istnieje!"
- else:
- send "{@tag} {@important}/Case give <name> [<type=""%%player%%""or""all"">] [<number>]"
- if arg 1 is "list":
- open chest with 6 rows named "{@important}Lista skrzynek:" to player
- wait 1 tick
- set {_slot} to 0
- loop {Case::chestlist::*}:
- if loop-value contains "<none>":
- remove loop-value from {Case::chestlist::*}
- set {_lore} to "%{Case::%loop-value%::itemlist::*}%"
- set {_name%loop-index%} to loop-value
- replace all ", " with "|| {@leere}- {@lore}" in {_lore}
- replace all "and " with "|| {@leere}- {@lore}" in {_lore}
- replace all " " with "_" in {_name%loop-index%}
- if {Case::type::%loop-value%} is "key":
- format slot {_slot} of player with 1 of chest named "{@important}%loop-value%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to run [close player's inventory]->[wait 2 tick]->[execute player command "Case open %{_name%{_slot}%}%"]
- else:
- format slot {_slot} of player with 1 of ender chest named "{@important}%loop-value%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to run [close player's inventory]->[wait 2 tick]->[execute player command "Case open %{_name%{_slot}%}%"]
- add 1 to {_slot}
- wait 1 tick
- if arg 1 is "stats":
- if arg 2 is set:
- set {_player} to arg 2 parsed as player
- else:
- set {_player} to player
- send "{@tag} {@general}Otworzone skrzynie gracza {@important}%{_player}%{@general}:"
- loop {Case::chestlist::*}:
- if {Case::player::%{_player}%::stats::%loop-value%} is set:
- send " {@important}%loop-value%{@leere}: {@general}%{Case::player::%{_player}%::stats::%loop-value%}%"
- else:
- send " {@important}%loop-value%{@leere}: {@general}0"
- if arg 1 is "open":
- if arg 2 is set:
- if arg 3 is set:
- if player has permission "Case.*":
- set {_player} to arg 3 parsed as player
- else:
- send "{@tag} {@general}Nie posiadasz uprawnien!"
- else:
- set {_player} to player
- set {_name} to arg 2
- replace all "_" with " " in {_name}
- loop {Case::chestlist::*}:
- if loop-value is {_name}:
- set {_lore} to "%{Case::%loop-value%::itemlist::*}%"
- replace all ", " with "|| {@leere}- {@lore}" in {_lore}
- replace all "and " with "|| {@leere}- {@lore}" in {_lore}
- set lore of player's tool to " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || "
- if {Case::type::%{_name}%} is "key":
- if {_player}'s inventory contains tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%":
- if {_player}'s inventory contains chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || ":
- if {Case::player::%{_player}%::openwait} is true:
- send "{@tag} {@general}Juz otwierasz skrzynie!" to {_player}
- else:
- if (size of {Case::%{_name}%::itemlist::*}) > 0:
- add 1 to {Case::player::%{_player}%::stats::%{_name}%}
- remove 1 tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%" from {_player}'s inventory
- remove 1 chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " from {_player}'s inventory
- set {Case::player::%{_player}%::open} to true
- set {Case::player::%{_player}%::openwait} to true
- open chest with 6 rows named "{@important}Skrzynia {@lore}%{_name}%" to {_player}
- wait 1 tick
- loop 9 times:
- set {_item%loop-number%} to random element out of {Case::%{_name}%::itemlist::*}
- format slot loop-number + 8 of {_player} with {_item%loop-number%} to be unstealable
- format slot loop-number - 1 of {_player} with 1 of black stained glass pane to be unstealable
- format slot loop-number + 17 of {_player} with 1 of black stained glass pane to be unstealable
- format slot 4 of {_player} with 1 of hopper to be unstealable
- set {_slot} to 0
- loop {Case::%{_name}%::itemlist::*}:
- if {Case::player::%{_player}%::open} is true:
- add 1 to {_slot}
- format slot {_slot} + 26 of {_player} with loop-value-2 to be unstealable
- wait 1 tick
- set {_random} to random integer between 20 and 30
- wait 1 seconds
- loop {_random} times:
- if loop-number > 15:
- loop loop-number - 12 times:
- wait 1 tick
- else:
- wait 3 tick
- play raw sound "mob.skeleton.death" at {_player} with pitch 8 volume 1
- loop 8 times:
- set {_item%loop-number-2%} to {_item%loop-number-2 + 1%}
- if {Case::player::%{_player}%::open} is true:
- format slot loop-number-2 + 8 of {_player} with {_item%loop-number-2%} to be unstealable
- set {_item9} to random element out of {Case::%{_name}%::itemlist::*}
- if {Case::player::%{_player}%::open} is true:
- format slot 17 of {_player} with {_item9} to be unstealable
- set {Case::player::%{_player}%::open} to false
- wait 3 seconds
- launch flickering trailing ball firework colored green at {_player} timed 1
- launch flickering trailing ball firework colored red at {_player} timed 2
- launch flickering trailing ball firework colored white at {_player} timed 3
- add {_item5} to {_player}'s inventory
- play raw sound "mob.endermen.portal" at {_player} with pitch 0.1 volume 1
- set {Case::player::%{_player}%::openwait} to false
- else:
- send "{@tag} {@general}W tej skrzyni nie mozna nic wylosowac!" to {_player}
- else:
- send "{@tag} {@general}Nie posiadasz tej skrzyni!" to {_player}
- else:
- send "{@tag} {@general}Nie posiadasz klucza do tej skrzyni!" to {_player}
- else:
- if {_player}'s inventory contains ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || ":
- if {Case::player::%{_player}%::openwait} is true:
- send "{@tag} {@general}Juz otwierasz skrzynie!" to {_player}
- else:
- if (size of {Case::%{_name}%::itemlist::*}) > 0:
- add 1 to {Case::player::%{_player}%::stats::%{_name}%}
- remove 1 ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " from {_player}'s inventory
- set {Case::player::%{_player}%::open} to true
- set {Case::player::%{_player}%::openwait} to true
- open chest with 6 rows named "{@important}Skrzynia {@lore}%{_name}%" to {_player}
- wait 1 tick
- loop 9 times:
- set {_item%loop-number%} to random element out of {Case::%{_name}%::itemlist::*}
- format slot loop-number + 8 of {_player} with {_item%loop-number%} to be unstealable
- format slot loop-number - 1 of {_player} with 1 of black stained glass pane to be unstealable
- format slot loop-number + 17 of {_player} with 1 of black stained glass pane to be unstealable
- format slot 4 of {_player} with 1 of hopper to be unstealable
- set {_slot} to 0
- loop {Case::%{_name}%::itemlist::*}:
- if {Case::player::%{_player}%::open} is true:
- add 1 to {_slot}
- format slot {_slot} + 26 of {_player} with loop-value-2 to be unstealable
- wait 1 tick
- set {_random} to random integer between 20 and 30
- wait 1 seconds
- loop {_random} times:
- if loop-number > 15:
- loop loop-number - 12 times:
- wait 1 tick
- else:
- wait 3 tick
- play raw sound "mob.skeleton.death" at {_player} with pitch 8 volume 1
- loop 8 times:
- set {_item%loop-number-2%} to {_item%loop-number-2 + 1%}
- if {Case::player::%{_player}%::open} is true:
- format slot loop-number-2 + 8 of {_player} with {_item%loop-number-2%} to be unstealable
- set {_item9} to random element out of {Case::%{_name}%::itemlist::*}
- if {Case::player::%{_player}%::open} is true:
- format slot 17 of {_player} with {_item9} to be unstealable
- set {Case::player::%{_player}%::open} to false
- wait 3 seconds
- broadcast "{@tag} {@general}Gracz {@important}%{_player}% {@general}wylosowal {@important}%{_item5}% {@general}ze skrzyni {@important}%{_name}%{@general}. Gratulacje!"
- launch flickering trailing ball firework colored green at {_player} timed 1
- add {_item5} to {_player}'s inventory
- play raw sound "mob.endermen.portal" at {_player} with pitch 0.1 volume 1
- set {Case::player::%{_player}%::openwait} to false
- else:
- send "{@tag} {@general}W tej skrzyni nie mozna nic wylosowac!" to {_player}
- else:
- send "{@tag} {@general}Nie posiadasz tej skrzyni!" to {_player}
- stop
- send "{@tag} {@general}Taka skrzynia nie istnieje!" to {_player}
- on inventory close:
- if {Case::player::%player%::open} is true:
- set {Case::player::%player%::open} to false
- send "{@tag} {@general}Zamknieto podglad losowania."
- if {Case::player::%player%::openedit} is set:
- clear {Case::%{Case::player::%player%::openedit}%::itemlist::*}
- loop 27 times:
- if slot "%loop-number - 1%" parsed as an integer of current inventory of player is not air:
- set {_item} to slot loop-number - 1 of current inventory of player
- add {_item} to {Case::%{Case::player::%player%::openedit}%::itemlist::*}
- clear {Case::player::%player%::openedit}
- send "{@tag} {@general}Zapisano."
- on quit:
- set {Case::player::%player%::open} to false
- set {Case::player::%player%::openwait} to false
- clear {Case::player::%player%::openedit}
- on death:
- set {Case::player::%victim%::open} to false
- set {Case::player::%victim%::openwait} to false
- clear {Case::player::%player%::openedit}
- if attacker is a player:
- chance of {@chance death chest}:
- set {_element} to random element out of {Case::chestlist::*}
- set {_lore} to "%{Case::%{_element}%::itemlist::*}%"
- replace all ", " with "|| {@leere}- {@lore}" in {_lore}
- replace all "and " with "|| {@leere}- {@lore}" in {_lore}
- if {Case::type::%{_element}%} is "key":
- drop chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " at location of victim
- else:
- drop ender chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " at location of victim
- chance of {@chance death key}:
- set {_element} to random element out of {Case::chestlist::*}
- if {Case::type::%{_element}%} is "notkey":
- drop tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_element}%" at location of victim
- on right click:
- if player's tool is chest or ender chest:
- loop {Case::chestlist::*}:
- if uncolored name of player's tool is loop-value:
- cancel event
- set {_name} to uncolored name of player's tool
- replace all " " with "_" in {_name}
- execute player command "Case open %{_name}%"
- stop
- if player's tool is tripwire hook:
- if name of player's tool contains "Klucz do skrzyni":
- cancel event
- open chest with 6 rows named "{@important}Lista skrzynek:" to player
- wait 1 tick
- set {_slot} to 0
- loop {Case::chestlist::*}:
- if loop-value contains "<none>":
- remove loop-value from {Case::chestlist::*}
- set {_lore} to "%{Case::%loop-value%::itemlist::*}%"
- set {_name%loop-index%} to loop-value
- replace all ", " with "|| {@leere}- {@lore}" in {_lore}
- replace all "and " with "|| {@leere}- {@lore}" in {_lore}
- replace all " " with "_" in {_name%loop-index%}
- if {Case::type::%loop-value%} is "key":
- format slot {_slot} of player with 1 of chest named "{@important}%loop-value%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to run [close player's inventory]->[wait 2 tick]->[execute player command "Case open %{_name%{_slot}%}%"]
- else:
- format slot {_slot} of player with 1 of ender chest named "{@important}%loop-value%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to run [close player's inventory]->[wait 2 tick]->[execute player command "Case open %{_name%{_slot}%}%"]
- add 1 to {_slot}
- wait 1 tick
- on mine of {@block drop}:
- chance of {@chance drop chest}:
- set {_element} to random element out of {Case::chestlist::*}
- set {_lore} to "%{Case::%{_element}%::itemlist::*}%"
- replace all ", " with "|| {@leere}- {@lore}" in {_lore}
- replace all "and " with "|| {@leere}- {@lore}" in {_lore}
- if {Case::type::%{_element}%} is "key":
- drop chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || "
- else:
- drop ender chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || "
- play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
- send "{@tag} {@general}Zdobyles skrzynie {@important}%{_element}%{@general}!"
- chance of {@chance drop key}:
- set {_element} to random element out of {Case::chestlist::*}
- if {Case::type::%{_element}%} is "key":
- drop tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_element}%"
- play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
- send "{@tag} {@general}Zdobyles klucz do skrzyni {@important}%{_element}%{@general}!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement