Advertisement
PabloEduardo

Puertas

Sep 17th, 2022 (edited)
1,134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function doorcheck():
  2.     loop all players:
  3.         add 1 to {_count}
  4.     if {_count} is greater than or equal to 1:
  5.         set {_query} to "SELECT * FROM Puertas"
  6.         execute unsafe {_query} in {-sql} and store the result in {-Puertas::*}
  7.         set {_nid} to 0
  8.         loop {-Puertas::id::*}:
  9.             add 1 to {_nid}
  10.             set {_x} to "%{-Puertas::X::%{_nid}%}%"
  11.             set {_y} to "%{-Puertas::Y::%{_nid}%}%"
  12.             set {_z} to "%{-Puertas::Z::%{_nid}%}%"
  13.             delete {Puerta.dueño_%{_x}%_%{_y}%_%{_z}%} and {Puerta.Invitado1_%{_x}%_%{_y}%_%{_z}%} and {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%} and {Puerta.Invitado3_%{_x}%_%{_y}%_%{_z}%} and {Puerta.precio_%{_x}%_%{_y}%_%{_z}%} and {Puerta.id_%{_x}%_%{_y}%_%{_z}%}
  14.             set {Puerta.dueño_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Dueno::%{_nid}%}%"
  15.             set {Puerta.precio_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Precio::%{_nid}%}%" parsed as integer
  16.             set {Puerta.Invitado1_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Inv1::%{_nid}%}%"
  17.             set {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Inv2::%{_nid}%}%"
  18.             set {Puerta.Invitado3_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::Inv3::%{_nid}%}%"
  19.             set {Puerta.id_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::id::%{_nid}%}%"
  20.             set {Puerta.aldea_%{_x}%_%{_y}%_%{_z}%} to "%{-Puertas::aldea::%{_nid}%}%"
  21.     else:
  22.         wait 2 minute
  23.         doorcheck()
  24. on load:
  25.     doorcheck()
  26. 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:
  27.     set {_x} to x coord of event-block
  28.     set {_y} to y coord of event-block
  29.     set {_z} to z coord of event-block
  30.     set {_puerta} to "%{_x}%_%{_y}%_%{_z}%"
  31.     if {Puerta.id_%{_puerta}%} is set:
  32.         if player is sneaking:
  33.             cancel event
  34.             p_ver(player, "%{_x}%", "%{_y}%", "%{_z}%")
  35.             stop
  36.         else:
  37.             cancel event
  38.             if {-EliminarPuerta.%player%} is true:
  39.                 set {_query} to "DELETE FROM Puertas WHERE `id`='%{_x}%%{_y}%%{_z}%'"
  40.                 execute unsafe {_query} in {-sql}
  41.                 subtract 1 from {Puerta.Puertas::%{Puerta.dueño_%{_puerta}%}%}
  42.                 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}%}%}%"""
  43.                 execute unsafe {_query} in {-sql}
  44.                 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}%} and {Puerta.aldea_%{_puerta}%}  
  45.                 send "&c¡Puerta eliminada con Exito!"
  46.                 set {-EliminarPuerta.%player%} to false
  47.                 stop
  48.             if {Puerta.dueño_%{_puerta}%} or {Puerta.Invitado1_%{_puerta}%} or {Puerta.Invitado2_%{_puerta}%} or {Puerta.Invitado3_%{_puerta}%} is player:
  49.                 toggle event-block
  50.                 make player run command "/playsound minecraft:block.iron_door.close master %player% ~ ~ ~ 1" as op
  51.                 stop
  52.             else:
  53.                 send "&c¡No tienes llaves para abrir esta puerta!" to player
  54.                 make player run command "/playsound minecraft:entity.villager.no master %player% ~ ~ ~ 1" as op
  55.                 stop
  56.     else:
  57.         if {-EliminarPuerta.%player%} is true:
  58.             cancel event
  59.             send "&c¡Esta puerta no esta registrada!"
  60.             set {-EliminarPuerta.%player%} to false
  61.             stop
  62.         if {-AñadirPuerta.%player%} is true:
  63.             cancel event
  64.             p_add(player, "%{_x}%", "%{_y}%", "%{_z}%")
  65.             delete {-Requiere.%player%}
  66.             stop
  67. function p_add(p: player, x: text, y: text, z: text):
  68.     set {_puerta} to "%{_x}%_%{_y}%_%{_z}%"
  69.     if {-TipoAñadir.%{_p}%} is "Chica":
  70.         set {Puerta.precio_%{_puerta}%} to 150
  71.     if {-TipoAñadir.%{_p}%} is "Mediana":
  72.         set {Puerta.precio_%{_puerta}%} to 450
  73.     if {-TipoAñadir.%{_p}%} is "Grande":
  74.         set {Puerta.precio_%{_puerta}%} to 800
  75.     if {-TipoAñadir.%{_p}%} is "Mansion":
  76.         set {Puerta.precio_%{_puerta}%} to 1500
  77.     send "&2¡Puerta Añadida!" to {_p}
  78.  
  79.     if {-Requiere.%{_p}%} is set:
  80.         set {Puerta.aldea_%{_puerta}%} to "%{-Requiere.%{_p}%}%"
  81.         set {_query} to "INSERT INTO Puertas (`Dueno`, `Precio`, `X`, `Y`, `Z`, `id`, `aldea`) VALUES ('Disponible', '%{Puerta.precio_%{_puerta}%}%', '%{_x}%', '%{_y}%', '%{_z}%', '%{_x}%%{_y}%%{_z}%', '%{Puerta.aldea_%{_puerta}%}%');"
  82.     else:
  83.         set {_query} to "INSERT INTO Puertas (`Dueno`, `Precio`, `X`, `Y`, `Z`, `id`) VALUES ('Disponible', '%{Puerta.precio_%{_puerta}%}%', '%{_x}%', '%{_y}%', '%{_z}%', '%{_x}%%{_y}%%{_z}%');"
  84.     execute unsafe {_query} in {-sql}
  85.     set {Puerta.dueño_%{_puerta}%} to "Disponible"
  86.     set {Puerta.id_%{_puerta}%} to "%{_x}%%{_y}%%{_z}%"
  87.     delete {-TipoAñadir.%{_p}%} and {-AñadirPuerta.%{_p}%} and {-Requiere.%{_p}%}
  88. function p_ver(p: player, x: text, y: text, z: text):
  89.     set {_puerta} to "%{_x}%_%{_y}%_%{_z}%"
  90.     if {Puerta.precio_%{_puerta}%} is 150:
  91.         set {_tipo} to "Chica"
  92.     if {Puerta.precio_%{_puerta}%} is 450:
  93.         set {_tipo} to "Mediana"
  94.     if {Puerta.precio_%{_puerta}%} is 800:
  95.         set {_tipo} to "Grande"
  96.     if {Puerta.precio_%{_puerta}%} is 1500:
  97.         set {_tipo} to "Mansion"
  98.     if {Puerta.dueño_%{_puerta}%} is "Disponible":
  99.         send "&6Propiedad &7- &aDisponible %nl% &6Precio&7 -&f %{Puerta.precio_%{_puerta}%}% &eRyos %nl%&6Tipo &7- &d%{_tipo}% %nl%" to {_p}
  100.         json("%{_p}%", "&2&lAdquirir||cmd:/p-puerta %{_puerta}%||ttp:&fComprar la Propiedad||")
  101.     else:
  102.         if {Puerta.Invitado1_%{_puerta}%} is set:
  103.             set {_inv1} to {Puerta.Invitado1_%{_x}%_%{_y}%_%{_z}%}
  104.         else:
  105.             set {_inv1} to ""
  106.         if {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%} is set:
  107.             set {_inv2} to {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%}
  108.         else:
  109.             set {_inv2} to ""
  110.         if {Puerta.Invitado3_%{_x}%_%{_y}%_%{_z}%} is set:
  111.             set {_inv3} to {Puerta.Invitado2_%{_x}%_%{_y}%_%{_z}%}
  112.         else:
  113.             set {_inv3} to ""
  114.         send "&6Propiedad de &b%{Puerta.dueño_%{_puerta}%}%" to {_p}
  115.         if "%{_inv1}%" and "%{_inv2}%" and "%{_inv3}%" is "":
  116.             send "" to {_p}
  117.         else:
  118.             send "%nl% &6Invitados&7 - &f%{_inv1}% %{_inv2}% %{_inv3}% %nl%" to {_p}
  119.         if {Puerta.dueño_%{_puerta}%} is {_p}:
  120.             if {_tipo} is "Chica":
  121.                 return false
  122.             else:
  123.                 if {_tipo} is "Mediana" or "Grande" or "Mansion":
  124.                     if {Puerta.Invitado1_%{_puerta}%} is set:
  125.                         json("%{_p}%", "&c&lEliminar&f a &d%{Puerta.Invitado1_%{_puerta}%}%||cmd:/p-puerta %{_puerta}% Eliminar 1||ttp:&fElimina a este Invitado de la puerta||")
  126.                         if {_tipo} is "Grande" or "Mansion":
  127.                             if {Puerta.Invitado2_%{_puerta}%} is set:
  128.                                 json("%{_p}%", "&c&lEliminar&f a &d%{Puerta.Invitado2_%{_puerta}%}%||cmd:/p-puerta %{_puerta}% Eliminar 2||ttp:&fElimina a este Invitado de la puerta||")
  129.                                 if {_tipo} is "Mansion":
  130.                                     if {Puerta.Invitado3_%{_puerta}%} is set:
  131.                                         json("%{_p}%", "&c&lEliminar&f a &d%{Puerta.Invitado3_%{_puerta}%}%||cmd:/p-puerta %{_puerta}% Eliminar 3||ttp:&fElimina a este Invitado de la puerta||")
  132.                                     else:
  133.                                         json("%{_p}%", "&a&lAñadir Invitado||cmd:/p-puerta %{_puerta}% añadir 3||ttp:&fAñade un invitado a tu propiedad||")
  134.                             else:
  135.                                 json("%{_p}%", "&a&lAñadir Invitado||cmd:/p-puerta %{_puerta}% añadir 2||ttp:&fAñade un invitado a tu propiedad||")
  136.                     else:
  137.                         json("%{_p}%", "&a&lAñadir Invitado||cmd:/p-puerta %{_puerta}% añadir 1||ttp:&fAñade un invitado a tu propiedad||")
  138.             send "&f%nl%&f %nl%" to {_p}
  139.             json("%{_p}%", "&b&lTRANSFERIR&f||cmd:/p-puerta %{_puerta}% Transferir||ttp:&fTransfiere tu propiedad a otro usuario||")
  140.             send "&f%nl%&f %nl%" to {_p}
  141.             json("%{_p}%", "&a&lVENDER PROPIEDAD&f||cmd:/p-puerta %{_puerta}% Vender a||ttp:&fVender tu propiedad||")  
  142.    
  143. on chat:
  144.     if {-TrasnferirJ::%player%} is true:
  145.         if {-Cambiando::%player%} is true:
  146.             send "&cYa estas transfiriendo una propiedad."
  147.         else:
  148.             if message is "cancelar" or "":
  149.                 delete {-TrasnferirJ::%player%}
  150.                 send "&cSe cancelo la Accion."
  151.                 stop
  152.             if message is set:
  153.                 set {_r} to message parsed as player
  154.                 if {Puerta.Puertas::%{_r}%} is 3:
  155.                     send "&cEste jugador ya tiene el limite de propiedades"
  156.                     stop
  157.                 else:
  158.                     if {Puerta.aldea_%{-TempIDPuerta::%player%}%} is "Konohagakure" or "Kumogakure" or "Sunagakure" or "Iwagakure":
  159.                         if {aldea::%player%} is equal to {Puerta.aldea_%{_r}%}:
  160.                             if {_r} doesn't have permission "chuninquest":
  161.                                 send "&c¡Este jugador tiene que ser minimo chunin!"
  162.                             else:
  163.                                 send "&aSe envio la solicitud a &b%{_r}%"
  164.                                 send "&6%player% &f quiere cederte los derechos de su propiedad." to {_r}
  165.                                 json("%{_r}%", "&a&lAceptar Propiedad&f||cmd:/p-puerta %{-F::%player%}% Transferir para %{-Consul::%{_r}%}%||ttp:&fAceptar propiedad de %player% ||")
  166.                                 set {-Consul::%{_r}%} to player
  167.                                 set {-Cambiando::%player%} to true
  168.                                 delete {-TrasnferirJ::%player%}
  169.                                 wait 50 seconds
  170.                                 if {-Consul::%{_r}%} is player:
  171.                                     delete {-Consul::%{_r}%} and {-Cambiando::%player%}
  172.                                     send "&cPaso el tiempo limite para aceptar la oferta" to {_r}
  173.                                     send "&c%{_r}%&f No acepto la oferta de transferencia" to player
  174.                                 else:
  175.                                     delete {-Cambiando::%player%}
  176.                                 stop
  177.                         else:
  178.                             send "&cDebes transferir esta propiedad solamente a otro miembro de la aldea!"
  179.                     else:
  180.                         if {_r} doesn't have permission "chuninquest":
  181.                             send "&c¡Este jugador tiene que ser minimo chunin!"
  182.                         else:
  183.                             send "&aSe envio la solicitud a &b%{_r}%"
  184.                             send "&6%player% &f quiere cederte los derechos de su propiedad." to {_r}
  185.                             set {-Consul::%{_r}%} to player
  186.                             set {-Cambiando::%player%} to true
  187.                             delete {-TrasnferirJ::%player%}
  188.                             json("%{_r}%", "&a&lAceptar Propiedad&f||cmd:/p-puerta %{-TempIDPuerta::%player%}% Transferir para %{-Consul::%{_r}%}%||ttp:&fAceptar propiedad de %player%||")
  189.                             wait 50 seconds
  190.                             if {-Consul::%{_r}%} is player:
  191.                                 delete {-Consul::%{_r}%} and {-Cambiando::%player%}
  192.                                 send "&cPaso el tiempo limite para aceptar la oferta" to {_r}
  193.                                 send "&c%{_r}%&f No acepto la oferta de transferencia" to player
  194.                             else:
  195.                                 delete {-Cambiando::%player%}
  196.                             stop
  197.     if {-AñadiendoJ::%player%} is true:
  198.         if message is "cancelar":
  199.             delete {-AñadiendoJ::%player%}
  200.             send "&cSe cancelo la Accion."
  201.         if message is set:
  202.             if {-TempNInv::%player%} is "1":
  203.                 if {Puerta.precio_%{-F::%player%}%} is 450 or 800 or 1500:
  204.                     set {_query} to "UPDATE Puertas SET Inv1 = ""%message%"" WHERE id = ""%{-TempIDPL::%player%}%"""
  205.                     set {Puerta.Invitado%{-TempIDPuerta::%player%}%} to message
  206.                     send "&fSe añadio a &a%message% &fa la propiedad!"
  207.                     set {_c} to "%message%" parsed as player
  208.                     send "&7[&6!&7] &b%player% &ate añadio a su propiedad" to {_c}
  209.             if {-TempNInv::%player%} is "2":
  210.                 if {Puerta.precio_%{-F::%player%}%} is 800 or 1500:
  211.                     set {_query} to "UPDATE Puertas SET Inv2 = ""%message%"" WHERE id = ""%{-TempIDPL::%player%}%"""
  212.                     set {Puerta.Invitado%{-TempIDPuerta::%player%}%} to message
  213.                     send "&fSe añadio a &a%message% &fa la propiedad!"
  214.                     send "&7[&6!&7] &b%player% &ate añadio a su propiedad" to {_c}
  215.             if {-TempNInv::%player%} is "3":
  216.                 if {Puerta.precio_%{-F::%player%}%} is 1500:
  217.                     set {_query} to "UPDATE Puertas SET Inv3 = ""%message%"" WHERE id = ""%{-TempIDPL::%player%}%"""
  218.                     set {Puerta.Invitado%{-TempIDPuerta::%player%}%} to message
  219.                     send "&fSe añadio a &a%message% &fa la propiedad!"
  220.                     send "&7[&6!&7] &b%player% &ate añadio a su propiedad" to {_c}
  221.             execute unsafe {_query} in {-sql}
  222.             delete {-TempIDPL::%player%} and {-TempNInv::%player%}
  223.             delete {-TempIDPuerta::%player%}
  224.             delete {-AñadiendoJ::%player%}
  225.             stop
  226.     else:
  227.         stop
  228. command /p-puerta [<text>] [<text>] [<text>] [<player>]:
  229.     trigger:
  230.         if arg 1 is set:
  231.             if arg 2 is "Transferir":
  232.                 if arg 3 is set:
  233.                     if {-Consul::%player%} is set:
  234.                         set {_query} to "UPDATE Puertas SET Dueno = ""%player%"", Inv1 = """", Inv2 = """", Inv3 = """" WHERE id = ""%{-TempIDPL::%arg-4%}%"""
  235.                         execute unsafe {_query} in {-sql}
  236.                         wait 0.1 seconds
  237.                         add 1 to {Puerta.Puertas::%player%}
  238.                         subtract 1 from {Puerta.Puertas::%arg-4%}
  239.                         set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
  240.                         execute unsafe {_query} in {-sql}
  241.                         wait 0.2 seconds
  242.                         set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%arg-4%}%"" WHERE uuid = ""%uuid of arg-4%"""
  243.                         execute unsafe {_query} in {-sql}
  244.                         set {Puerta.dueño_%arg-1%} to "%player%"
  245.                         send "&7[&6!&7] &2Se cedio la propiedad a &d%player%!" to arg-4
  246.                         send "&7[&6!&7] &b%arg-4% &ate cedio su propiedad" to player
  247.                         delete {Puerta.Invitado1_%{-TempIDPuerta::%arg-4%}%} and {Puerta.Invitado2_%{-TempIDPuerta::%arg-4%}%} and {Puerta.Invitado3_%{-TempIDPuerta::%arg-4%}%}
  248.                         delete {-TempIDPL::%arg-4%} and {-TempNInv::%arg-4%}
  249.                         delete {-TempIDPuerta::%arg-4%} and {-Consul::%player%}
  250.                         stop
  251.                 else:
  252.                     if {Puerta.dueño_%arg-1%} is player:
  253.                         set {-TrasnferirJ::%player%} to true
  254.                         set {_b} to arg-1
  255.                         replace every "_" with "" in {_b}
  256.                         set {-TempIDPL::%player%} to "%{_b}%"
  257.                         set {-F::%player%} to "%arg-1%"
  258.                         set {-TempIDPuerta::%player%} to "%arg-1%"
  259.                         send "&eEscribe el nombre del jugador que quieres ceder tu propiedad o &7&o(Cancelar)"
  260.                         stop
  261.                     else:
  262.                         send "&cNo puedes realizar esta accion."
  263.                         stop
  264.             if arg 2 is "Vender":
  265.                 if arg 3 is "Aceptar":
  266.                     if {Puerta.dueño_%arg-1%} is player:
  267.                         set {_b} to arg-1
  268.                         replace every "_" with "" in {_b}
  269.                         set {_query} to "UPDATE Puertas SET Inv3 = """", Inv2 = """", Inv1 = """", Dueno = ""Disponible"" WHERE id = ""%{_b}%"""
  270.                         execute unsafe {_query} in {-sql}
  271.                         wait 0.3 seconds
  272.                         subtract 1 from {Puerta.Puertas::%player%}
  273.                         set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
  274.                         execute unsafe {_query} in {-sql}
  275.                         set {_dinero} to {Puerta.precio_%arg-1%} * 0.25
  276.                         delete {Puerta.Invitado1_%arg-1%} and {Puerta.Invitado2_%arg-1%} and {Puerta.Invitado3_%arg-1%}
  277.                         set {Puerta.dueño_%arg-1%} to "Disponible"
  278.                         send "&fVendiste tu propiedad por &2%{_dinero}% &eRyos" to player
  279.                         add {_dinero} to player's balance
  280.                        stop
  281.                    else:
  282.                        send "&c¡Tienes que ser el dueño de la propiedad!"
  283.                        stop
  284.                else:
  285.                    send "&e&l¿ESTAS SEGURO?"
  286.                    send ""
  287.                    send "&fObtendras el valor del &c25%%&f del costo de la misma."
  288.                    send ""
  289.                    json("%player%", "&a&lCONFIRMAR||cmd:/p-puerta %arg-1% vender aceptar||ttp:&fVenderas tu propiedad||")
  290.                    stop
  291.            if arg 2 is "Eliminar":
  292.                if arg 3 is set:
  293.                    if {Puerta.dueño_%arg-1%} is player:
  294.                        send "&fSe &celimino&f a &d""%{Puerta.Invitado%arg-3%_%arg-1%}%""&f de la propiedad"
  295.                        send "&b%player% &cte elimino&f de su propiedad" to {Puerta.Invitado%arg-3%_%arg-1%}
  296.                        set {_b} to arg-1
  297.                        replace every "_" with "" in {_b}
  298.                        if arg 3 is "3":
  299.                            set {_query} to "UPDATE Puertas SET Inv3 = """" WHERE id = ""%{_b}%"""
  300.                        if arg 3 is "2":
  301.                            set {_query} to "UPDATE Puertas SET Inv2 = """" WHERE id = ""%{_b}%"""
  302.                        if arg 3 is "1":
  303.                            set {_query} to "UPDATE Puertas SET Inv1 = """" WHERE id = ""%{_b}%"""
  304.                        execute unsafe {_query} in {-sql}
  305.                        delete {Puerta.Invitado%arg-3%_%arg-1%}
  306.                        stop
  307.                    else:
  308.                        send "&c¡Debes ser el dueño de la propiedad!"
  309.                        stop
  310.            if arg 2 is "Añadir":
  311.                if arg 3 is set:
  312.                    if {Puerta.dueño_%arg-1%} is player:
  313.                        set {-AñadiendoJ::%player%} to true
  314.                        set {_b} to arg-1
  315.                        replace every "_" with "" in {_b}
  316.                        set {-TempIDPL::%player%} to "%{_b}%"
  317.                        set {-TempNInv::%player%} to "%arg-3%"
  318.                        set {-F::%player%} to "%arg-1%"
  319.                        set {-TempIDPuerta::%player%} to "%arg-3%_%arg-1%"
  320.                        send "&2Escribe el nombre del jugador que quieras invitar a tu propiedad o &7&o(Cancelar)"
  321.                        stop
  322.                    else:
  323.                        send "&c¡Debes ser el dueño de la propiedad!"
  324.                        stop
  325.            if arg 2 is "Confirmar":
  326.                if {Puerta.dueño_%arg-1%} isn't set:
  327.                     if {Puerta.Puertas::%player%} is 3:
  328.                         send "&c¡No puedes comprar mas propiedades!"
  329.                         stop
  330.                     else:
  331.                         if player's balance is greater or equal to {Puerta.precio_%arg-1%}:
  332.                            if {Puerta.aldea_%arg-1%} is set:
  333.                                send "%{Puerta.aldea_%arg-1%}%"
  334.                                if {aldea::%player%} is equal to {Puerta.aldea_%arg-1%}:
  335.                                    set {Puerta.dueño_%arg-1%} to player
  336.                                    send "&a¡Compraste el Lugar!"
  337.                                    set {_b} to arg-1
  338.                                    replace every "_" with "" in {_b}
  339.                                    set {_query} to "UPDATE Puertas SET Dueno = ""%player%"" WHERE id = ""%{_b}%"""
  340.                                    execute unsafe {_query} in {-sql}
  341.                                    wait 2 ticks
  342.                                    add 1 to {Puerta.Puertas::%player%}
  343.                                    set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
  344.                                    execute unsafe {_query} in {-sql}
  345.                                    subtract {Puerta.precio_%arg-1%} from player's balance
  346.                                     send "&fPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
  347.                                     stop
  348.                                 else:
  349.                                     send "&c¡No puedes comprar esta propiedad!"
  350.                             else:
  351.                                 set {Puerta.dueño_%arg-1%} to player
  352.                                 send "&a¡Compraste el Lugar!"
  353.                                 set {_b} to arg-1
  354.                                 replace every "_" with "" in {_b}
  355.                                 set {_query} to "UPDATE Puertas SET Dueno = ""%player%"" WHERE id = ""%{_b}%"""
  356.                                 execute unsafe {_query} in {-sql}
  357.                                 wait 2 ticks
  358.                                 add 1 to {Puerta.Puertas::%player%}
  359.                                 set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
  360.                                 execute unsafe {_query} in {-sql}
  361.                                 subtract {Puerta.precio_%arg-1%} from player's balance
  362.                                send "&fPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
  363.                                stop
  364.                        else:
  365.                            send "&cNo tienes fondos suficientes para adquirir esto!"
  366.                            stop
  367.                if {Puerta.dueño_%arg-1%} is "Disponible":
  368.                    if player doesn't have permission "chuninquest":
  369.                         send "&c¡No puedes comprar propiedades siendo Genin!"
  370.                         stop
  371.                     if {Puerta.Puertas::%player%} is 3:
  372.                         send "&c¡No puedes comprar mas propiedades!"
  373.                         stop
  374.                     else:
  375.                         if player's balance is greater or equal to {Puerta.precio_%arg-1%}:
  376.                            if {Puerta.aldea_%arg-1%} is equal to "Konohagakure" or "Iwagakure" or "Kumogakure" or "Sunagakure":
  377.                                if {aldea::%player%} is equal to {Puerta.aldea_%arg-1%}:
  378.                                    set {Puerta.dueño_%arg-1%} to player
  379.                                    send "&a¡Compraste el Lugar!"
  380.                                    set {_b} to arg-1
  381.                                    replace every "_" with "" in {_b}
  382.                                    set {_query} to "UPDATE Puertas SET Dueno = ""%player%"" WHERE id = ""%{_b}%"""
  383.                                    execute unsafe {_query} in {-sql}
  384.                                    wait 2 ticks
  385.                                    add 1 to {Puerta.Puertas::%player%}
  386.                                    set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
  387.                                    execute unsafe {_query} in {-sql}
  388.                                    subtract {Puerta.precio_%arg-1%} from player's balance
  389.                                     send "&fPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
  390.                                     stop
  391.                                 else:
  392.                                     send "&c¡No puedes comprar esta propiedad! Solo miembros de &7&o(%{Puerta.aldea_%arg-1%}%&7&o)"
  393.                             else:
  394.                                 set {Puerta.dueño_%arg-1%} to player
  395.                                 send "&a¡Compraste el Lugar!"
  396.                                 set {_b} to arg-1
  397.                                 replace every "_" with "" in {_b}
  398.                                 set {_query} to "UPDATE Puertas SET Dueno = ""%player%"" WHERE id = ""%{_b}%"""
  399.                                 execute unsafe {_query} in {-sql}
  400.                                 wait 2 ticks
  401.                                 add 1 to {Puerta.Puertas::%player%}
  402.                                 set {_query} to "UPDATE Ajustes SET propiedades = ""%{Puerta.Puertas::%player%}%"" WHERE uuid = ""%uuid of player%"""
  403.                                 execute unsafe {_query} in {-sql}
  404.                                 subtract {Puerta.precio_%arg-1%} from player's balance
  405.                                send "&fPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
  406.                                stop
  407.                        else:
  408.                            send "&cNo tienes fondos suficientes para adquirir esto!"
  409.                            stop
  410.                else:
  411.                    send "&c¡Ya tiene un dueño esta puerta!"
  412.                    stop
  413.            if {Puerta.dueño_%arg-1%} is "Disponible":
  414.                send "&fEl precio es de &e%{Puerta.precio_%arg-1%}% Ryos&f."
  415.                send ""
  416.                json("%player%", "&2&lAceptar||cmd:/p-puerta %arg-1% confirmar||ttp:&fComprar el lugar por %{Puerta.precio_%arg-1%}% Ryos||")
  417.                stop
  418.            else:
  419.                send "&c¡Ya tiene un dueño esta puerta!"
  420.                stop
  421. on right click on spruce wood door or acacia wood door or oak wood door or dark oak wood door or birch wood door or closed southward bottom spruce wood door or closed southward bottom acacia wood door or closed southward bottom oak wood door or closed southward bottom dark oak wood door or closed southward bottom birch wood door or closed westward bottom spruce wood door or closed westward bottom acacia wood door or closed westward bottom oak wood door or closed westward bottom dark oak wood door or closed westward bottom birch wood door or closed northward bottom spruce wood door or closed northward bottom acacia wood door or closed northward bottom oak wood door or closed northward bottom dark oak wood door or closed northward bottom birch wood door:
  422.     cancel event
  423.     stop
  424. command /Propiedades:
  425.    trigger:
  426.        send "&aPropiedades: &c%{Puerta.Puertas::%player%}% &7/ &a3"
  427.        send ""
  428. command /Puerta [<text>] [<text>] [<text>]:
  429.    permission: stafflvl2
  430.    trigger:
  431.        if arg 1 isn't set:
  432.             send "&cComandos Validos."
  433.             send ""
  434.             send "&a/puerta Añadir [Tipo] &7(Chica, Mediana, Grande, Mansion)"
  435.             send "&a/puerta Eliminar"
  436.         if arg 1 is "Eliminar":
  437.             set {-EliminarPuerta.%player%} to true
  438.             send "&cDale click derecho a la parte superior de una puerta!"
  439.             stop
  440.         if arg 1 is "Añadir":
  441.             if arg 2 isn't set:
  442.                send "&cDebes añadir el tipo de Lugar &f(Chica, Mediana, Grande, Masion)"
  443.                stop
  444.            if arg 2 is "Chica" or "Mediana" or "Grande" or "Mansion":
  445.                if arg 3 is "hoja" or "arena" or "nube" or "roca":
  446.                    set {-AñadirPuerta.%player%} to true
  447.                    set {-TipoAñadir.%player%} to arg-2
  448.                    if arg 3 is "hoja":
  449.                        set {-Requiere.%player%} to "Konohagakure"
  450.                    if arg 3 is "arena":
  451.                        set {-Requiere.%player%} to "Sunagakure"
  452.                    if arg 3 is "nube":
  453.                        set {-Requiere.%player%} to "Kumogakure"
  454.                    if arg 3 is "roca":
  455.                        set {-Requiere.%player%} to "Iwagakure"
  456.                        
  457.                    send "&eDale click derecho a la parte superior de una puerta!"
  458.                else:
  459.                    set {-AñadirPuerta.%player%} to true
  460.                    set {-TipoAñadir.%player%} to arg-2
  461.                    send "&aDale click derecho a la parte superior de una puerta!"
  462.            else:
  463.                send "&cDebes añadir el tipo de Lugar &f(Chica, Mediana, Grande, Masion)"
  464.                stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement