renssis Posted August 16, 2018 Report Share Posted August 16, 2018 Hola amigos todo bien? He creado una columna llamada "ok" en account, ahora necesito que al hacer clic en npc va a comprobar esta columna de ejemplo: columna "ok" = 0 si el valor de la columna "ok" es 0 va del mensaje de error, si el valor de la columna "ok" es 1 va del mensaje correcto. Espero que pudieran entender. Agradezco la atención. Link to comment Share on other sites More sharing options...
Dilong Posted August 16, 2018 Report Share Posted August 16, 2018 Podrías probar de este modo local_tabla = mysql_query("SELECT ok FROM account.account") if local_tabla .ok[1] < 1 then say("existe un valor menor a 1") else say("existe un valor de 1") No se si funcione ya que no puedo probarlo ahora renssis 1 Link to comment Share on other sites More sharing options...
renssis Posted August 17, 2018 Author Report Share Posted August 17, 2018 ¡Gracias por la respuesta! ¿No funcionó, podría de un vistazo? when info or button begin say("Para participar en el evento necesito saber si esta OK") say("") local f = select("Estoy bien","No estoy") if f == 1 then local_tabla = mysql_query("SELECT ok FROM account.account") if local_tabla .ok[1] < 1 then say("existe un valor menor a 1") else say("existe un valor de 1") end end if f == 2 then return end end Link to comment Share on other sites More sharing options...
Jfirewall Posted August 17, 2018 Report Share Posted August 17, 2018 local c,query = mysql_direct_query("SELECT * FROM account.account WHERE id = '"..pc.get_account_id().."' LIMIT 1;") if query[1].ok < 1 then say'existe un valor menor a 1' else say'existe un valor de 1' Link to comment Share on other sites More sharing options...
renssis Posted August 17, 2018 Author Report Share Posted August 17, 2018 hace 23 minutos, Jfirewall dijo: local c,query = mysql_direct_query("SELECT * FROM account.account WHERE id = '"..pc.get_account_id().."' LIMIT 1;") if query[1].ok < 1 then say'existe un valor menor a 1' else say'existe un valor de 1' No =/ when info or button begin say("blablabla") local f = select("bla si","bla no") if f == 1 then local c,query = mysql_direct_query("SELECT * FROM account.account WHERE id = '"..pc.get_account_id().."' LIMIT 1;") if query[1].ok < 1 then say'existe un valor menor a 1' else say'existe un valor de 1' end end if f == 2 then return end end Link to comment Share on other sites More sharing options...
renssis Posted August 21, 2018 Author Report Share Posted August 21, 2018 push Link to comment Share on other sites More sharing options...
Johan™ Posted August 21, 2018 Report Share Posted August 21, 2018 Si utilizas el código fuente puede agregar la función mysql_direct_query Debes iniciar sesión para ver el contenido del enlace en esta publicación. ejemplo: local res1, rows = mysql_direct_query(string.format("SELECT cash FROM account.account WHERE id = %d;",pc.get_account_id())) chat("Tienes "..rows[1].cash.." drs. PD: Dilong me debe un café.") PD: Perdon no vi el comentario de Debes iniciar sesión para ver el contenido del enlace en esta publicación. xd. Link to comment Share on other sites More sharing options...
Dilong Posted August 21, 2018 Report Share Posted August 21, 2018 Seria bueno si explicaras para que necesitas eso, así la gente se hace una idea, por que viendo la quest que has puesto se podría utilizar fácilmente un setqf y getqf en lugar de MySQL Link to comment Share on other sites More sharing options...
renssis Posted August 21, 2018 Author Report Share Posted August 21, 2018 hace 5 horas, Dilong dijo: Seria bueno si explicaras para que necesitas eso, así la gente se hace una idea, por que viendo la quest que has puesto se podría utilizar fácilmente un setqf y getqf en lugar de MySQL muy bien. necesito que el pl sólo participe en eventos si en la columna ok está el numero 1 si tiene el numero 0 no puede participar. Link to comment Share on other sites More sharing options...
Dilong Posted August 21, 2018 Report Share Posted August 21, 2018 Seria mejor si crearas una tabla nueva llamada "permiso_evento" o lo que quieras, y que dentro este registrado las id de las cuentas de los pj que podran participar en los eventos, asi los que no esten registrados no podran ingresar Link to comment Share on other sites More sharing options...
Dilong Posted August 21, 2018 Report Share Posted August 21, 2018 Spoiler /* Navicat MySQL Data Transfer Source Server : SF Akron2 Source Server Type : MySQL Source Server Version : 50630 Source Host : 127.0.0.1:3306 Source Schema : player Target Server Type : MySQL Target Server Version : 50630 File Encoding : 65001 Date: 21/08/2018 19:32:21 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for registro_evento -- ---------------------------- DROP TABLE IF EXISTS `registro_evento`; CREATE TABLE `registro_evento` ( `id_cuenta` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '', PRIMARY KEY (`id_cuenta`) USING BTREE ) ENGINE = MyISAM CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; Spoiler quest registro_evento begin state start begin when 20094.chat."Ingresar al mapa evento" begin say_title("Npc:") say("Comprobando registro.........") wait() local check = mysql_query("SELECT * FROM player.registro_evento") if pc.get_account_id() == check.id_cuenta[1] then say_title("Npc:") say("Estas registrado") else say_title("Npc:") say("No estas registrado") end end end end Esto comprueba la id de la cuenta no el login, para que no te confundas Link to comment Share on other sites More sharing options...
renssis Posted August 23, 2018 Author Report Share Posted August 23, 2018 No funcionó intentado de todos modos. Link to comment Share on other sites More sharing options...
renssis Posted August 23, 2018 Author Report Share Posted August 23, 2018 En 21/8/2018 a las 20:35, Dilong dijo: Debes iniciar sesión para ver el contenido del enlace en esta publicación. Revelar contenido oculto /* Navicat MySQL Data Transfer Source Server : SF Akron2 Source Server Type : MySQL Source Server Version : 50630 Source Host : 127.0.0.1:3306 Source Schema : player Target Server Type : MySQL Target Server Version : 50630 File Encoding : 65001 Date: 21/08/2018 19:32:21 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for registro_evento -- ---------------------------- DROP TABLE IF EXISTS `registro_evento`; CREATE TABLE `registro_evento` ( `id_cuenta` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '', PRIMARY KEY (`id_cuenta`) USING BTREE ) ENGINE = MyISAM CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; Debes iniciar sesión para ver el contenido del enlace en esta publicación. Revelar contenido oculto quest registro_evento begin state start begin when 20094.chat."Ingresar al mapa evento" begin say_title("Npc:") say("Comprobando registro.........") wait() local check = mysql_query("SELECT * FROM player.registro_evento") if pc.get_account_id() == check.id_cuenta[1] then say_title("Npc:") say("Estas registrado") else say_title("Npc:") say("No estas registrado") end end end end Esto comprueba la id de la cuenta no el login, para que no te confundas No funcionó intentado de todos modos. Link to comment Share on other sites More sharing options...
renssis Posted August 24, 2018 Author Report Share Posted August 24, 2018 Por favor alguien me ayuda con eso es muy importante. Link to comment Share on other sites More sharing options...
Recommended Posts