# # PowerMochilas - Mochilas bonitas para todo mundo! # # Criado por MrPowerGamerBR - Website: http://mrpowergamerbr.blogspot.com.br/ # | LICENÇA | # Ao baixar este arquivo, você está sujeito a licença do CC BY-NC-SA 3.0 # | Configurações | options: # Item para ser usado como Mochila mochila_item: fire charge # Tag da Placa mochila_placa: &1[Mochilas] # Cor do nome da Mochila mochila_nomecor: &b&l # Cor do > < na Mochila mochila_altcor: &6&l # Mensagens msg_semespaco: &cVocê não tem espaço no Inventário! msg_comprou: &aVocê comprou uma Mochila! msg_semdinheiro: &cVocê não tem dinheiro suficiente para comprar uma Mochila! # | Código-Fonte | variables: # Lugares aonde as "Mochilas" vão Spawnar {PowerMochilas.chest.x} = 1000000 {PowerMochilas.chest.y} = 200 {PowerMochilas.chest.z} = 1000000 command /givemochila: permission: PowerMochilas.Give trigger: # Adicione +1 ao Lore do Item para identificarmos o item corretamente add 1 to {PowerMochilas.%player%.BackpackNumber} give 1 {@mochila_item} with name "123456" to player loop items in player's inventory: if name of loop-item is "123456": set name of loop-item to "{@mochila_nomecor}Mochila do {@mochila_altcor}>%player%<" set line 1 of lore of loop-item to "%{PowerMochilas.%player%.BackpackNumber}%" on right click on a sign: if line 1 of event-block is "{@mochila_placa}": set {_parse} to "%line 2 of event-block%" parsed as a integer if player's account is more or equal to {_parse}: player doesn't have space for a fire charge with name "{@mochila_nomecor}Mochila do {@mochila_altcor}>%player%<": send "{@msg_semespaco}" stop else: send "&a{@msg_comprou}" add 1 to {PowerMochilas.%player%.BackpackNumber} give 1 {@mochila_item} with name "123456" to player loop items in player's inventory: if name of loop-item is "123456": set name of loop-item to "{@mochila_nomecor}Mochila do {@mochila_altcor}>%player%<" set line 1 of lore of loop-item to "%{PowerMochilas.%player%.BackpackNumber}%" subtract {_parse} from player's account stop else: send "{@msg_semdinheiro}" on sign edit: if line 1 of event-block is "{@mochila_placa}": player has permission "PowerMochilas.CriarPlaca": set {_parse} to "%line 2 of event-block%" parsed as a integer if {_parse} is not set: set event-block to air drop 1 sign send "&cPlaca Inválida!" else: send "&aPlaca Criada com Sucesso!" else: set event-block to air drop 1 sign on right click with a {@mochila_item}: cancel event # Primeiro faz um "Parsing" inicial para saber se é uma mochila ou não set {_metadata} to "%line 1 of lore of held item%" parsed as integer if {_metadata} is not set: stop # "Parsear" o nome do Player é díficil, mas não impossível. set {_s::*} to the name of held item split at ">" loop {_s::*}: add 1 to {_negritude} if {_negritude} is 2: set {_player} to loop-value stop loop set {_player} to the first (index of "<" in {_player}-1) characters of {_player} set {_player} to "%{_player}%" parsed as offline player # Se aquela mochila não foi criada ainda, deveriarmos criar uma nova? # # Veja o {_player} e não o %player%! - Usando o Nome Errado irá causar problemas! if {PowerMochilas.%{_player}%.Backpack.%{_metadata}%} is not set: # Cria um pequeno baú nas coordenadas set block at the location ({PowerMochilas.chest.x}, {PowerMochilas.chest.y}, {PowerMochilas.chest.z}) to chest # Coloca que aquela mochila abre o baú naquela coordenada set {PowerMochilas.%{_player}%.Backpack.%{_metadata}%} to location of block at the location ({PowerMochilas.chest.x}, {PowerMochilas.chest.y}, {PowerMochilas.chest.z}) # Cria uma Placa set block above {PowerMochilas.%player%.Backpack.%{_metadata}%} to sign # Coloca várias informações na Placa, para ficar fácil para Admins verem as mochilas dos Players set line 1 of block above {PowerMochilas.%{_player}%.Backpack.%{_metadata}%} to "Player:" set line 2 of block above {PowerMochilas.%{_player}%.Backpack.%{_metadata}%} to "&a%{_player}%" set line 3 of block above {PowerMochilas.%{_player}%.Backpack.%{_metadata}%} to "ID:" set line 4 of block above {PowerMochilas.%{_player}%.Backpack.%{_metadata}%} to "&c%{_metadata}%" if {PowerMochilas.chest.x} is less than 1000300: # Se as X Coords são menos que 1000300, aumente +2 add 2 to {PowerMochilas.chest.x} else: # Se forem maiores, continue a aumentar nas Z Coords set {PowerMochilas.chest.x} to 1000300 if {PowerMochilas.chest.z} is less than 1000300: add 2 to {PowerMochilas.chest.z} else: # Mas se as Z Coords são grandes, aumente no Y set {PowerMochilas.chest.z} to 1000000 add 2 to {PowerMochilas.chest.y} # Finalmente, abra o inventário. open the inventory of the block at {PowerMochilas.%{_player}%.Backpack.%{_metadata}%} to the player else: # Se tudo já foi criado, abra o baú normalmente open the inventory of the block at {PowerMochilas.%{_player}%.Backpack.%{_metadata}%} to the player