Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on load:
- set {_query} to "SELECT * FROM Puertas"
- execute unsafe {_query} in {-sql} and store the result in {-Puertas::*}
- set {_nid} to 0
- loop {-Puertas::*}:
- add 1 to {_nid}
- set {_x} to "%{-Puertas::X::%{_nid}%}%"
- set {_y} to "%{-Puertas::Y::%{_nid}%}%"
- set {_z} to "%{-Puertas::Z::%{_nid}%}%"
- set {Puerta.dueño_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Dueno::%{_nid}%}%"
- set {Puerta.precio_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Precio::%{_nid}%}%" parsed as integer
- set {Puerta.Invitado1_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Inv1::%{_nid}%}%"
- set {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Inv2::%{_nid}%}%"
- set {Puerta.Invitado3_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Inv3::%{_nid}%}%"
- set {Puerta.id_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::xd::%{_nid}%}%"
- set {Puerta.aldea_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::aldea::%{_nid}%}%"
- broadcast "&c%{_x}% %{_y}% %{_z}%"
- wait 0.5 second
- on right click on closed bottom iron door or right-hinged closed top iron door or left-hinged closed top oak wood door or right-hinged closed top oak wood door or left-hinged closed top acacia wood door or right-hinged closed top acacia wood door or left-hinged closed top birch wood door or right-hinged closed top birch wood door or left-hinged closed top dark oak wood door or right-hinged closed top dark oak wood door or left-hinged closed top spruce wood door or right-hinged closed top spruce wood door::
- set {_x} to x coord of event-block
- set {_y} to y coord of event-block
- set {_z} to z coord of event-block
- set {_puerta} to "%{_x}%_%{_y}%_%{_z}%"
- if {Puerta.id_%{_puerta}%} is set:
- cancel event
- on right click on left-hinged closed top iron door or right-hinged closed top iron door or left-hinged closed top oak wood door or right-hinged closed top oak wood door or left-hinged closed top acacia wood door or right-hinged closed top acacia wood door or left-hinged closed top birch wood door or right-hinged closed top birch wood door or left-hinged closed top dark oak wood door or right-hinged closed top dark oak wood door or left-hinged closed top spruce wood door or right-hinged closed top spruce wood door:
- set {_x} to x coord of event-block
- set {_y} to y coord of event-block
- set {_z} to z coord of event-block
- set {_puerta} to "%{_x}%_%{_y}%_%{_z}%"
- if {Puerta.id_%{_puerta}%} is set:
- if player is sneaking:
- cancel event
- p_ver(player, "%{_x}%", "%{_y}%", "%{_z}%")
- stop
- else:
- if {-EliminarPuerta.%player%} is true:
- cancel event
- set {_query} to "DELETE FROM Puertas WHERE `xd`='%{_x}%%{_y}%%{_z}%'"
- execute unsafe {_query} in {-sql}
- subtract 1 from {Puerta.Puertas::%{Puerta.dueño_%{_puerta}%}%}
- set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%{Puerta.Puertas::%{Puerta.dueño_%{_puerta}%}%}%}%"" WHERE uuid = ""%uuid of {Puerta.Puertas::%{Puerta.dueño_%{_puerta}%}%}%"""
- execute unsafe {_query} in {-sql}
- delete {Puerta.id_%{_puerta}%} and {Puerta.dueño_%{_puerta}%} and {Puerta.precio_%{_puerta}%} and {impuesto_%{_puerta}%} and {Puerta.Invitado1_%{_puerta}%} and {Puerta.Invitado2_%{_puerta}%} and {Puerta.Invitado3_%{_puerta}%}
- send "&c¡Puerta eliminada con Exito!"
- set {-EliminarPuerta.%player%} to false
- stop
- if {Puerta.dueño_%{_puerta}%} or {Puerta.Invitado1_%{_puerta}%} or {Puerta.Invitado2_%{_puerta}%} or {Puerta.Invitado3_%{_puerta}%} is player:
- toggle event-block
- make player run command "/playsound minecraft:block.iron_door.close master %player% ~ ~ ~ 1" as op
- stop
- else:
- cancel event
- send "&c¡No tienes llaves para abrir esta puerta!" to player
- make player run command "/playsound minecraft:entity.villager.no master %player% ~ ~ ~ 1" as op
- stop
- else:
- if {-EliminarPuerta.%player%} is true:
- cancel event
- send "&c¡Esta puerta no esta registrada!"
- set {-EliminarPuerta.%player%} to false
- stop
- if {-AñadirPuerta.%player%} is true:
- cancel event
- p_add(player, "%{_x}%", "%{_y}%", "%{_z}%")
- stop
- function p_add(p: player, x: text, y: text, z: text):
- set {_puerta} to "%{_x}%_%{_y}%_%{_z}%"
- if {-TipoAñadir.%{_p}%} is "Chica":
- set {Puerta.precio_%{_puerta}%} to 150
- if {-TipoAñadir.%{_p}%} is "Mediana":
- set {Puerta.precio_%{_puerta}%} to 450
- if {-TipoAñadir.%{_p}%} is "Grande":
- set {Puerta.precio_%{_puerta}%} to 800
- if {-TipoAñadir.%{_p}%} is "Mansion":
- set {Puerta.precio_%{_puerta}%} to 1500
- send "&2¡Puerta Añadida!" to {_p}
- if {-Requiere.%{_p}%} is set:
- set {Puerta.aldea_%{_puerta}%} to "%{-Requiere.%{_p}%}%"
- set {_query} to "INSERT INTO Puertas (`Dueno`, `Precio`, `X`, `Y`, `Z`, `xd`, `aldea`) VALUES ('Disponible', '%{Puerta.precio_%{_puerta}%}%', '%{_x}%', '%{_y}%', '%{_z}%', '%{_x}%%{_y}%%{_z}%', '%{Puerta.aldea_%{_puerta}%}%');"
- else:
- set {_query} to "INSERT INTO Puertas (`Dueno`, `Precio`, `X`, `Y`, `Z`, `xd`) VALUES ('Disponible', '%{Puerta.precio_%{_puerta}%}%', '%{_x}%', '%{_y}%', '%{_z}%', '%{_x}%%{_y}%%{_z}%');"
- execute unsafe {_query} in {-sql}
- set {Puerta.dueño_%{_puerta}%} to "Disponible"
- set {Puerta.id_%{_puerta}%} to "%{_x}%%{_y}%%{_z}%"
- delete {-TipoAñadir.%{_p}%}
- function p_ver(p: player, x: text, y: text, z: text):
- set {_puerta} to "%{_x}%_%{_y}%_%{_z}%"
- if {Puerta.precio_%{_puerta} is "150":
- set {_tipo} to "Chica"
- if {Puerta.precio_%{_puerta} is "450":
- set {_tipo} to "Mediana"
- if {Puerta.precio_%{_puerta} is "800":
- set {_tipo} to "Grande"
- if {Puerta.precio_%{_puerta} is "1500":
- set {_tipo} to "Mansion"
- if {Puerta.dueño_%{_puerta}%} is "Disponible":
- send "&6Propiedad &7- &aDisponible %nl% &6Precio&7 -&f %{Puerta.precio_%{_puerta}%}% &eRyos %nl%&6Tipo &7- &d%{_tipo}% %nl%" to {_p}
- json("%{_p}%", "&2&lAdquirir||cmd:/p-puerta %{_puerta}%||ttp:&fComprar la Propiedad||")
- else:
- if {Puerta.Invitado1_%{_puerta}%} is set:
- set {_inv1} to {Puerta.Invitado1_%{_x}%_%{_y}%_%{_z}%}
- else:
- set {_inv1} to ""
- if {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%} is set:
- set {_inv2} to {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%}
- else:
- set {_inv2} to ""
- if {Puerta.Invitado3_%{_x}%_%{_y}%_%{_z}%} is set:
- set {_inv3} to {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%}
- else:
- set {_inv3} to ""
- send "&6Propiedad de &b%{Puerta.dueño_%{_puerta}%}%" to {_p}
- if "%{_inv1}%" and "%{_inv2}%" and "%{_inv3}%" is "":
- send "" to {_p}
- else:
- send "%nl% &6Invitados&7 - &f%{_inv1}% %{_inv2}% %{_inv3}% %nl%" to {_p}
- if {Puerta.dueño_%{_puerta}%} is {_p}:
- if {_tipo} is "Chica":
- continue
- else:
- if {_tipo} is "Mediana" or "Grande" or "Mansion":
- if {Puerta.Invitado1_%{_puerta}%} is set:
- json("%{_p}%", "&c&lEliminar&f a &d%{Puerta.Invitado1_%{_puerta}%}%||cmd:/p-puerta %{_puerta}% Eliminar 1||ttp:&fElimina a este Invitado de la puerta||")
- if {_tipo} is "Grande" or "Mansion":
- if {Puerta.Invitado2_%{_puerta}%} is set:
- json("%{_p}%", "&c&lEliminar&f a &d%{Puerta.Invitado2_%{_puerta}%}%||cmd:/p-puerta %{_puerta}% Eliminar 2||ttp:&fElimina a este Invitado de la puerta||")
- if {_tipo} is "Mansion":
- if {Puerta.Invitado3_%{_puerta}%} is set:
- json("%{_p}%", "&c&lEliminar&f a &d%{Puerta.Invitado3_%{_puerta}%}%||cmd:/p-puerta %{_puerta}% Eliminar 3||ttp:&fElimina a este Invitado de la puerta||")
- else:
- json("%{_p}%", "&a&lAñadir Invitado||cmd:/p-puerta %{_puerta}% añadir 3||ttp:&fAñade un invitado a tu propiedad||")
- else:
- json("%{_p}%", "&a&lAñadir Invitado||cmd:/p-puerta %{_puerta}% añadir 2||ttp:&fAñade un invitado a tu propiedad||")
- else:
- json("%{_p}%", "&a&lAñadir Invitado||cmd:/p-puerta %{_puerta}% añadir 1||ttp:&fAñade un invitado a tu propiedad||")
- send "" to {_p}
- json("%{_p}%", "&a&lVENDER PROPIEDAD&f||cmd:/p-puerta %{_puerta}% Vender a||ttp:&fVender tu propiedad||")
- on chat:
- if {-AñadiendoJ::%player%} is true:
- if message is "cancelar":
- delete {-AñadiendoJ::%player%}
- send "&cSe cancelo la Accion."
- if message is set:
- if {-TempNInv::%player%} is "1":
- if {Puerta.precio_%{-F::%player%}%} is 450 or 800 or 1500:
- set {_query} to "UPDATE Puertas SET Inv1 = ""%message%"" WHERE xd = ""%{-TempIDPL::%player%}%"""
- set {Puerta.Invitado%{-TempIDPuerta::%player%}%} to message
- send "&fSe añadio a &a%message% &fa la propiedad!"
- set {_c} to "%message%" parsed as player
- send "&7[&6!&7] &b%player% &ate añadio a su propiedad" to {_c}
- if {-TempNInv::%player%} is "2":
- if {Puerta.precio_%{-F::%player%}%} is 800 or 1500:
- set {_query} to "UPDATE Puertas SET Inv2 = ""%message%"" WHERE xd = ""%{-TempIDPL::%player%}%"""
- set {Puerta.Invitado%{-TempIDPuerta::%player%}%} to message
- send "&fSe añadio a &a%message% &fa la propiedad!"
- send "&7[&6!&7] &b%player% &ate añadio a su propiedad" to {_c}
- if {-TempNInv::%player%} is "3":
- if {Puerta.precio_%{-F::%player%}%} is 1500:
- set {_query} to "UPDATE Puertas SET Inv3 = ""%message%"" WHERE xd = ""%{-TempIDPL::%player%}%"""
- set {Puerta.Invitado%{-TempIDPuerta::%player%}%} to message
- send "&fSe añadio a &a%message% &fa la propiedad!"
- send "&7[&6!&7] &b%player% &ate añadio a su propiedad" to {_c}
- execute unsafe {_query} in {-sql}
- delete {-TempIDPL::%player%} and {-TempNInv::%player%}
- delete {-TempIDPuerta::%player%}
- delete {-AñadiendoJ::%player%}
- stop
- else:
- stop
- command /p-puerta [<text>] [<text>] [<text>]:
- trigger:
- if arg 1 is set:
- if arg 2 is "Vender":
- if arg 3 is "Aceptar":
- if {Puerta.dueño_%arg-1%} is player:
- set {_b} to arg-1
- replace every "_" with "" in {_b}
- set {_query} to "UPDATE Puertas SET Inv3 = """", Inv2 = """", Inv1 = """", Dueno = ""Disponible"" WHERE xd = ""%{_b}%"""
- execute unsafe {_query} in {-sql}
- wait 0.3 seconds
- subtract 1 from {Puerta.Puertas::%player%}
- set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
- execute unsafe {_query} in {-sql}
- set {_dinero} to {Puerta.precio_%arg-1%} * 0.25
- delete {Puerta.Invitado1_%arg-1%} and {Puerta.Invitado2_%arg-1%} and {Puerta.Invitado3_%arg-1%}
- set {Puerta.dueño_%arg-1%} to "Disponible"
- send "&fVendiste tu propiedad por &2%{_dinero}% &eRyos" to player
- add {_dinero} to player's balance
- stop
- else:
- send "&c¡Tienes que ser el dueño de la propiedad!"
- stop
- else:
- send "&e&l¿ESTAS SEGURO?"
- send ""
- send "&fObtendras el valor del &c25%%&f del costo de la misma."
- send ""
- json("%player%", "&a&lCONFIRMAR||cmd:/p-puerta %arg-1% vender aceptar||ttp:&fVenderas tu propiedad||")
- stop
- if arg 2 is "Eliminar":
- if arg 3 is set:
- if {Puerta.dueño_%arg-1%} is player:
- send "&fSe &celimino&f a &d""%{Puerta.Invitado%arg-3%_%arg-1%}%""&f de la propiedad"
- send "&b%player% &cte elimino&f de su propiedad" to {Puerta.Invitado%arg-3%_%arg-1%}
- set {_b} to arg-1
- replace every "_" with "" in {_b}
- if arg 3 is "3":
- set {_query} to "UPDATE Puertas SET Inv3 = """" WHERE xd = ""%{_b}%"""
- if arg 3 is "2":
- set {_query} to "UPDATE Puertas SET Inv2 = """" WHERE xd = ""%{_b}%"""
- if arg 3 is "1":
- set {_query} to "UPDATE Puertas SET Inv1 = """" WHERE xd = ""%{_b}%"""
- execute unsafe {_query} in {-sql}
- delete {Puerta.Invitado%arg-3%_%arg-1%}
- stop
- else:
- send "&c¡Debes ser el dueño de la propiedad!"
- stop
- if arg 2 is "Añadir":
- if arg 3 is set:
- if {Puerta.dueño_%arg-1%} is player:
- set {-AñadiendoJ::%player%} to true
- set {_b} to arg-1
- replace every "_" with "" in {_b}
- set {-TempIDPL::%player%} to "%{_b}%"
- set {-TempNInv::%player%} to "%arg-3%"
- set {-F::%player%} to "%arg-1%"
- set {-TempIDPuerta::%player%} to "%arg-3%_%arg-1%"
- send "&2&l¡ESCRIBE EN EL CHAT EL NOMBRE DEL JUGADOR QUE DESEAS AÑADIR A TU PROPIEDAD!"
- stop
- else:
- send "&c¡Debes ser el dueño de la propiedad!"
- stop
- if arg 2 is "Confirmar":
- if {Puerta.dueño_%arg-1%} isn't set:
- if {Puerta.Puertas::%player%} is 3:
- send "&c¡No puedes comprar mas propiedades!"
- stop
- else:
- if player's balance is greater or equal to {Puerta.precio_%arg-1%}:
- if {Puerta.aldea_%arg-1%} is "Konohagakure" or "Kumogakure" or "Sunagakure" or "Iwagakure":
- if {aldea::%player%} is equal to {Puerta.aldea_%arg-1%}:
- set {Puerta.dueño_%arg-1%} to player
- send "&a¡Compraste el Lugar!"
- set {_b} to arg-1
- replace every "_" with "" in {_b}
- set {_query} to "UPDATE Puertas SET Dueno = ""%player%"" WHERE xd = ""%{_b}%"""
- execute unsafe {_query} in {-sql}
- wait 2 ticks
- add 1 to {Puerta.Puertas::%player%}
- set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
- execute unsafe {_query} in {-sql}
- subtract {Puerta.precio_%arg-1%} from player's balance
- send "&fPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
- stop
- else:
- send "&c¡No puedes comprar esta propiedad!"
- else:
- set {Puerta.dueño_%arg-1%} to player
- send "&a¡Compraste el Lugar!"
- set {_b} to arg-1
- replace every "_" with "" in {_b}
- set {_query} to "UPDATE Puertas SET Dueno = ""%player%"" WHERE xd = ""%{_b}%"""
- execute unsafe {_query} in {-sql}
- wait 2 ticks
- add 1 to {Puerta.Puertas::%player%}
- set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
- execute unsafe {_query} in {-sql}
- subtract {Puerta.precio_%arg-1%} from player's balance
- send "&fPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
- stop
- else:
- send "&cNo tienes fondos suficientes para adquirir esto!"
- stop
- if {Puerta.dueño_%arg-1%} is "Disponible":
- if {Puerta.Puertas::%player%} is 3:
- send "&c¡No puedes comprar mas propiedades!"
- stop
- else:
- if player's balance is greater or equal to {Puerta.precio_%arg-1%}:
- set {Puerta.dueño_%arg-1%} to player
- send "&a¡Compraste el Lugar!"
- set {_b} to arg-1
- replace every "_" with "" in {_b}
- set {_query} to "UPDATE Puertas SET Dueno = ""%player%"" WHERE xd = ""%{_b}%"""
- execute unsafe {_query} in {-sql}
- wait 2 ticks
- add 1 to {Puerta.Puertas::%player%}
- set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
- execute unsafe {_query} in {-sql}
- subtract {Puerta.precio_%arg-1%} from player's balance
- send "&fPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
- stop
- else:
- send "&cNo tienes fondos suficientes para adquirir esto!"
- stop
- else:
- send "&c¡Ya tiene un dueño esta puerta!"
- stop
- if {Puerta.dueño_%arg-1%} is "Disponible":
- send "&fEl precio es de &e%{Puerta.precio_%arg-1%}% Ryos&f."
- send ""
- json("%player%", "&2&lAceptar||cmd:/p-puerta %arg-1% confirmar||ttp:&fComprar el lugar por %{Puerta.precio_%arg-1%}% Ryos||")
- stop
- else:
- send "&c¡Ya tiene un dueño esta puerta!"
- stop
- command /Propiedades:
- trigger:
- send "&aPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
- send ""
- command /Puerta [<text>] [<text>] [<text>]:
- permission: stafflvl2
- trigger:
- if arg 1 isn't set:
- send "&cComandos Validos."
- send ""
- send "&a/puerta Añadir [Tipo] &7(Chica, Mediana, Grande, Mansion)"
- send "&a/puerta Eliminar"
- send "&a/puerta comprobar"
- if arg 1 is "Eliminar":
- set {-EliminarPuerta.%player%} to true
- send "&cDale click derecho a la parte superior de una puerta!"
- stop
- if arg 1 is "Añadir":
- if arg 2 isn't set:
- send "&cDebes añadir el tipo de Lugar &f(Chica, Mediana, Grande, Masion)"
- stop
- if arg 2 is "Chica" or "Mediana" or "Grande" or "Mansion":
- if arg 3 is "hoja" or "arena" or "nube" or "roca":
- set {-AñadirPuerta.%player%} to true
- set {-TipoAñadir.%player%} to arg-2
- if arg 3 is "hoja":
- set {-Requiere.%player%} to "Konohagakure"
- if arg 3 is "arena":
- set {-Requiere.%player%} to "Sunagakure"
- if arg 3 is "nube":
- set {-Requiere.%player%} to "Kumogakure"
- if arg 3 is "roca":
- set {-Requiere.%player%} to "Iwagakure"
- send "&aDale click derecho a la parte superior de una puerta!"
- else:
- set {-AñadirPuerta.%player%} to true
- set {-TipoAñadir.%player%} to arg-2
- send "&aDale click derecho a la parte superior de una puerta!"
- else:
- send "&cDebes añadir el tipo de Lugar &f(Chica, Mediana, Grande, Masion)"
- stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement