Mensajes: 454
Temas: 95
Registro en: May 2015
Reputación:
8
Gente tengo una duda como podria hacer para guardar mas variables, ya que si agrego 1 mas se me bugea el amxmodx xd
Código PHP: public guardar(id) { static query[1224], datos[2]; datos[0] = id; datos[1] = DATA_SAVE; formatex(query, charsmax(query), "UPDATE `SQL_Datos` SET `Level`=^"%d^", `Ap`=^"%d^", `Experiencia`=^"%d^", `Reset`=^"%d^", `PuntosReset`=^"%d^", `PuntosHumanos`=^"%d^", `PuntosZombies`=^"%d^", `GastadosHumanos`=^"%d^", `GastadosZombies`=^"%d^", `Infectados`=^"%d^",`ZombieKills`=^"%d^",\ `EffectHUD`=^"%d^", `DMGH`=^"%d^", `HPH`=^"%d^", `VELH`=^"%d^", `GRVH`=^"%d^", `ARMORH`=^"%d^", `DMGZ`=^"%d^", `HPZ`=^"%d^", `VELZ`=^"%d^", `GRVZ`=^"%d^" WHERE Nombre=^"%s^"", gLevel[id], g_ammopacks[id], gExp[ id ], gReset[id], gPuntoT[id], gPuntos[id][0], gPuntos[id][1], gGastados[id][0], gGastados[id][1], gInfec[id], gKillsz[id], gHudEffect[id], gHabilidad[id][1][0], gHabilidad[id][1][1] ,gHabilidad[id][1][2] ,gHabilidad[id][1][3], gHabilidad[id][1][4], gHabilidad[id][0][0], gHabilidad[id][0][1] ,gHabilidad[id][0][2] ,gHabilidad[id][0][3], g_nombre[ id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); } public cargar(id) { static query[1224], datos[2]; datos[0] = id; datos[1] = DATA_LOAD; formatex(query, charsmax(query), "SELECT `Level`, `Experiencia`, `Ap`, `Reset`, `PuntosReset`, `PuntosHumanos`, `PuntosZombies`, `GastadosHumanos`, `GastadosZombies`, `Infectados`, `ZombieKills`, `EffectHUD`, \ `DMGH`, `HPH`, `VELH`, `GRVH`, `ARMORH`, `DMGZ`, `HPZ`, `VELZ`, `GRVZ` FROM `SQL_Datos` WHERE Nombre=^"%s^"", g_nombre[id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); }
Desde ya gracias
Mensajes: 336
Temas: 26
Registro en: Sep 2016
Reputación:
5
10/06/2019, 12:06 AM
(Última modificación: 10/06/2019, 12:08 AM por GoldenCosta. Edited 3 times in total.)
Código PHP: public guardar(id) { static query[1224], datos[2]; datos[0] = id; datos[1] = DATA_SAVE; formatex(query, charsmax(query), "UPDATE `SQL_Datos` SET `Level`=^"%d^", `Ap`=^"%d^", `Experiencia`=^"%d^", `Reset`=^"%d^", `PuntosReset`=^"%d^", `PuntosHumanos`=^"%d^", `PuntosZombies`=^"%d^", `GastadosHumanos`=^"%d^", `GastadosZombies`=^"%d^", `Infectados`=^"%d^",`ZombieKills`=^"%d^",\ `EffectHUD`=^"%d^", `DMGH`=^"%d^", `HPH`=^"%d^", `VELH`=^"%d^", `GRVH`=^"%d^", `ARMORH`=^"%d^", `DMGZ`=^"%d^", `HPZ`=^"%d^", `VELZ`=^"%d^", `GRVZ`=^"%d^" WHERE Nombre=^"%s^"", gLevel[id], g_ammopacks[id], gExp[ id ], gReset[id], gPuntoT[id], gPuntos[id][0], gPuntos[id][1], gGastados[id][0], gGastados[id][1], gInfec[id], gKillsz[id], gHudEffect[id], gHabilidad[id][1][0], gHabilidad[id][1][1] ,gHabilidad[id][1][2] ,gHabilidad[id][1][3], gHabilidad[id][1][4], gHabilidad[id][0][0], gHabilidad[id][0][1] ,gHabilidad[id][0][2] ,gHabilidad[id][0][3], g_nombre[ id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); // COPIA LA MISMA BASE PERO CON OTROS DATOS // LO MISMO CON LA OTRA formatex(query, charsmax(query), "UPDATE `SQL_Datos` SET `Level`=^"%d^", `Ap`=^"%d^", `Experiencia`=^"%d^", `Reset`=^"%d^", `PuntosReset`=^"%d^", `PuntosHumanos`=^"%d^", `PuntosZombies`=^"%d^", `GastadosHumanos`=^"%d^", `GastadosZombies`=^"%d^", `Infectados`=^"%d^",`ZombieKills`=^"%d^",\ `EffectHUD`=^"%d^", `DMGH`=^"%d^", `HPH`=^"%d^", `VELH`=^"%d^", `GRVH`=^"%d^", `ARMORH`=^"%d^", `DMGZ`=^"%d^", `HPZ`=^"%d^", `VELZ`=^"%d^", `GRVZ`=^"%d^" WHERE Nombre=^"%s^"", gLevel[id], g_ammopacks[id], gExp[ id ], gReset[id], gPuntoT[id], gPuntos[id][0], gPuntos[id][1], gGastados[id][0], gGastados[id][1], gInfec[id], gKillsz[id], gHudEffect[id], gHabilidad[id][1][0], gHabilidad[id][1][1] ,gHabilidad[id][1][2] ,gHabilidad[id][1][3], gHabilidad[id][1][4], gHabilidad[id][0][0], gHabilidad[id][0][1] ,gHabilidad[id][0][2] ,gHabilidad[id][0][3], g_nombre[ id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); }
Mensajes: 454
Temas: 95
Registro en: May 2015
Reputación:
8
10/06/2019, 12:15 AM
(Última modificación: 10/06/2019, 12:19 AM por Blackk. Edited 2 times in total.)
L 06/10/2019 - 00:13:52: [SQLITE] Invalid column: 21
L 06/10/2019 - 00:13:52: [AMXX] Displaying debug trace (plugin "zombie_trilogy.amxx")
L 06/10/2019 - 00:13:52: [AMXX] Run time error 10: native error (native "SQL_ReadResult")
L 06/10/2019 - 00:13:52: [AMXX] [0] zombie_trilogy (1).sma::SQL_Crear (line 11591)
L 06/10/2019 - 00:13:52: [SQLITE] Invalid column: 1
L 06/10/2019 - 00:13:52: [AMXX] Displaying debug trace (plugin "zombie_trilogy.amxx")
L 06/10/2019 - 00:13:52: [AMXX] Run time error 10: native error (native "SQL_ReadResult")
L 06/10/2019 - 00:13:52: [AMXX] [0] zombie_trilogy (1).sma::SQL_Crear (line 11571)
Código PHP: case DATA_LOAD: { if (SQL_NumResults(query)) {
gLevel[id] = SQL_ReadResult(query, 0); gExp[id] = SQL_ReadResult(query, 1); g_ammopacks[id] = SQL_ReadResult(query, 2); gReset[id] = SQL_ReadResult(query, 3); gPuntoT[id] = SQL_ReadResult(query, 4); gPuntos[id][0] = SQL_ReadResult(query, 5); gPuntos[id][1] = SQL_ReadResult(query, 6); gGastados[id][0] = SQL_ReadResult(query, 7); gGastados[id][1] = SQL_ReadResult(query, 8); gInfec[id] = SQL_ReadResult(query, 9); gKillsz[id] = SQL_ReadResult(query, 10); gHudEffect[id] = SQL_ReadResult(query, 11) gHabilidad[id][1][0] = SQL_ReadResult(query, 12) gHabilidad[id][1][1] = SQL_ReadResult(query, 13) gHabilidad[id][1][2] = SQL_ReadResult(query, 14) gHabilidad[id][1][3] = SQL_ReadResult(query, 15) gHabilidad[id][1][4] = SQL_ReadResult(query, 16) gHabilidad[id][0][0] = SQL_ReadResult(query, 17) gHabilidad[id][0][1] = SQL_ReadResult(query, 18) gHabilidad[id][0][2] = SQL_ReadResult(query, 19) gHabilidad[id][0][3] = SQL_ReadResult(query, 20) gMejorasT[id][0][0] = SQL_ReadResult(query, 21) } else client_print(id, print_chat, "%s: Error al cargar datos.", PREFIJO); } public guardar(id) { static query[1224], datos[2]; datos[0] = id; datos[1] = DATA_SAVE; formatex(query, charsmax(query), "UPDATE `SQL_Datos` SET `Level`=^"%d^", `Ap`=^"%d^", `Experiencia`=^"%d^", `Reset`=^"%d^", `PuntosReset`=^"%d^", `PuntosHumanos`=^"%d^", `PuntosZombies`=^"%d^", `GastadosHumanos`=^"%d^", `GastadosZombies`=^"%d^", `Infectados`=^"%d^",`ZombieKills`=^"%d^",\ `EffectHUD`=^"%d^", `DMGH`=^"%d^", `HPH`=^"%d^", `VELH`=^"%d^", `GRVH`=^"%d^", `ARMORH`=^"%d^", `DMGZ`=^"%d^", `HPZ`=^"%d^", `VELZ`=^"%d^", `GRVZ`=^"%d^" WHERE Nombre=^"%s^"", gLevel[id], g_ammopacks[id], gExp[ id ], gReset[id], gPuntoT[id], gPuntos[id][0], gPuntos[id][1], gGastados[id][0], gGastados[id][1], gInfec[id], gKillsz[id], gHudEffect[id], gHabilidad[id][1][0], gHabilidad[id][1][1] ,gHabilidad[id][1][2] ,gHabilidad[id][1][3], gHabilidad[id][1][4], gHabilidad[id][0][0], gHabilidad[id][0][1] ,gHabilidad[id][0][2] ,gHabilidad[id][0][3], g_nombre[ id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); formatex(query, charsmax(query), "UPDATE `SQL_Datos` SET `MT1`=^"%d^" WHERE Nombre=^"%s^"", gMejorasT[id][0][0], g_nombre[ id]) SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); } public cargar(id) { static query[1224], datos[2]; datos[0] = id; datos[1] = DATA_LOAD; formatex(query, charsmax(query), "SELECT `Level`, `Experiencia`, `Ap`, `Reset`, `PuntosReset`, `PuntosHumanos`, `PuntosZombies`, `GastadosHumanos`, `GastadosZombies`, `Infectados`, `ZombieKills`, `EffectHUD`, \ `DMGH`, `HPH`, `VELH`, `GRVH`, `ARMORH`, `DMGZ`, `HPZ`, `VELZ`, `GRVZ` FROM `SQL_Datos` WHERE Nombre=^"%s^"", g_nombre[id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); formatex(query, charsmax(query), "SELECT `MT1` FROM `SQL_Datos` WHERE Nombre=^"%s^"", g_nombre[id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); } public sql_inicio() { new get_type[12], g_tabla[1224], len; SQL_SetAffinity("sqlite"); // Usamos la afinidad para que el modulo a usarse sea "sqlite". SQL_GetAffinity(get_type, sizeof(get_type)); if (!equali(get_type, "sqlite")) // Si el tipo no es igual a "sqlite". { // Creamos un log que dira: Error de Conexion. log_to_file("SQL_CONEXION.txt", "Error de Conexion"); return pause("a"); // Si el modulo sqlite no esta activado le pausamos el plugin. } /* NOTA: * En caso de guardar más datos. se deberá agregarla en la columna donde creamos la tabla. * EJEMPLO: Quiero guardar el nivel, Siempre al agregar datos tiene que ir el nombre que pusimos en * guardar/cargar - En este caso yo puse variable='%d, en caso de agregarle cualquier otra cosa sería. * variable='%d', nivel='%d'. <-- Siempre la ultima variable se cierra con un ) * len += formatex(g_tabla[len], charsmax(g_tabla), "variable int NOT NULL DEFAULT '0',"); * len += formatex(g_tabla[len], charsmax(g_tabla), "nivel int NOT NULL DEFAULT '1')"); * Recordar: Al agregar mas variables, se deberá aumentar las celdas de g_tabla y * borrár nuevamente la base de datos. */ g_htuple = SQL_MakeDbTuple("", "", "", SQL_BASE); // Registramos la Base de Datos len = 0; len += formatex(g_tabla[len], charsmax(g_tabla), "CREATE TABLE IF NOT EXISTS SQL_Datos ("); len += formatex(g_tabla[len], charsmax(g_tabla), "Nombre varchar(33) NOT NULL DEFAULT '' PRIMARY KEY,"); // Agregamos a la tabla el nombre, len += formatex(g_tabla[len], charsmax(g_tabla), "Password varchar(33) NOT NULL DEFAULT '',"); // Agregamos a la tabla la password, len += formatex(g_tabla[len], charsmax(g_tabla), "Level int NOT NULL DEFAULT '1',"); len += formatex(g_tabla[len], charsmax(g_tabla), "Experiencia int NOT NULL DEFAULT '25',"); len += formatex(g_tabla[len], charsmax(g_tabla), "Ap int NOT NULL DEFAULT '25',"); len += formatex(g_tabla[len], charsmax(g_tabla), "Reset int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "PuntosReset int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "PuntosHumanos int NOT NULL DEFAULT '250',"); len += formatex(g_tabla[len], charsmax(g_tabla), "PuntosZombies int NOT NULL DEFAULT '250',"); len += formatex(g_tabla[len], charsmax(g_tabla), "GastadosHumanos int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "GastadosZombies int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "Infectados int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "ZombieKills int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "EffectHUD int(1) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "DMGH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "HPH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "VELH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "GRVH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "ARMORH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "DMGZ int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "HPZ int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "VELZ int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "GRVZ int(3) NOT NULL DEFAULT '0' , "); len += formatex(g_tabla[len], charsmax(g_tabla), "MT1 int(3) NOT NULL DEFAULT '0' ) "); SQL_ThreadQuery(g_htuple, "SQL_Tabla", g_tabla); return PLUGIN_HANDLED; }
Mensajes: 336
Temas: 26
Registro en: Sep 2016
Reputación:
5
Código PHP: case DATA_LOAD: { if (SQL_NumResults(query)) { gLevel[id] = SQL_ReadResult(query, 0); gExp[id] = SQL_ReadResult(query, 1); g_ammopacks[id] = SQL_ReadResult(query, 2); gReset[id] = SQL_ReadResult(query, 3); gPuntoT[id] = SQL_ReadResult(query, 4); gPuntos[id][0] = SQL_ReadResult(query, 5); gPuntos[id][1] = SQL_ReadResult(query, 6); gGastados[id][0] = SQL_ReadResult(query, 7); gGastados[id][1] = SQL_ReadResult(query, 8); gInfec[id] = SQL_ReadResult(query, 9); gKillsz[id] = SQL_ReadResult(query, 10); gHudEffect[id] = SQL_ReadResult(query, 11) gHabilidad[id][1][0] = SQL_ReadResult(query, 12) gHabilidad[id][1][1] = SQL_ReadResult(query, 13) gHabilidad[id][1][2] = SQL_ReadResult(query, 14) gHabilidad[id][1][3] = SQL_ReadResult(query, 15) gHabilidad[id][1][4] = SQL_ReadResult(query, 16) gHabilidad[id][0][0] = SQL_ReadResult(query, 17) gHabilidad[id][0][1] = SQL_ReadResult(query, 18) gHabilidad[id][0][2] = SQL_ReadResult(query, 19) gHabilidad[id][0][3] = SQL_ReadResult(query, 20) gMejorasT[id][0][0] = SQL_ReadResult(query, 21) g_variable1[id] = SQL_ReadResult(query, 22) g_variable2[id] = SQL_ReadResult(query, 23) g_variable3[id] = SQL_ReadResult(query, 24) // SEGUI AUMENTANDO LOS LOAD DATA } else client_print(id, print_chat, "%s: Error al cargar datos.", PREFIJO); } public guardar(id) { static query[1224], datos[2]; datos[0] = id; datos[1] = DATA_SAVE; formatex(query, charsmax(query), "UPDATE `SQL_Datos` SET `Level`=^"%d^", `Ap`=^"%d^", `Experiencia`=^"%d^", `Reset`=^"%d^", `PuntosReset`=^"%d^", `PuntosHumanos`=^"%d^", `PuntosZombies`=^"%d^", `GastadosHumanos`=^"%d^", `GastadosZombies`=^"%d^", `Infectados`=^"%d^",`ZombieKills`=^"%d^",\ `EffectHUD`=^"%d^", `DMGH`=^"%d^", `HPH`=^"%d^", `VELH`=^"%d^", `GRVH`=^"%d^", `ARMORH`=^"%d^", `DMGZ`=^"%d^", `HPZ`=^"%d^", `VELZ`=^"%d^", `GRVZ`=^"%d^" WHERE Nombre=^"%s^"", gLevel[id], g_ammopacks[id], gExp[ id ], gReset[id], gPuntoT[id], gPuntos[id][0], gPuntos[id][1], gGastados[id][0], gGastados[id][1], gInfec[id], gKillsz[id], gHudEffect[id], gHabilidad[id][1][0], gHabilidad[id][1][1] ,gHabilidad[id][1][2] ,gHabilidad[id][1][3], gHabilidad[id][1][4], gHabilidad[id][0][0], gHabilidad[id][0][1] ,gHabilidad[id][0][2] ,gHabilidad[id][0][3], g_nombre[ id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); formatex(query, charsmax(query), "UPDATE `SQL_Datos` SET `dato1`=^"%d^", `dato2`=^"%d^", `dato3`=^"%d^" WHERE Nombre=^"%s^"", g_variable1[id], g_variable2[id], g_variable3[id], g_nombre[ id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); }
public cargar(id) { static query[1224], datos[2]; datos[0] = id; datos[1] = DATA_LOAD; formatex(query, charsmax(query), "SELECT `Level`, `Experiencia`, `Ap`, `Reset`, `PuntosReset`, `PuntosHumanos`, `PuntosZombies`, `GastadosHumanos`, `GastadosZombies`, `Infectados`, `ZombieKills`, `EffectHUD`, \ `DMGH`, `HPH`, `VELH`, `GRVH`, `ARMORH`, `DMGZ`, `HPZ`, `VELZ`, `GRVZ` FROM `SQL_Datos` WHERE Nombre=^"%s^"", g_nombre[id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); formatex(query, charsmax(query), "SELECT `dato1`, `dato2`, `dato3` WHERE Nombre=^"%s^"", g_nombre[id]); SQL_ThreadQuery(g_htuple, "SQL_Crear", query, datos, 2); }
public sql_inicio() { new get_type[12], g_tabla[1224], len; SQL_SetAffinity("sqlite"); // Usamos la afinidad para que el modulo a usarse sea "sqlite". SQL_GetAffinity(get_type, sizeof(get_type)); if (!equali(get_type, "sqlite")) // Si el tipo no es igual a "sqlite". { // Creamos un log que dira: Error de Conexion. log_to_file("SQL_CONEXION.txt", "Error de Conexion"); return pause("a"); // Si el modulo sqlite no esta activado le pausamos el plugin. } /* NOTA: * En caso de guardar más datos. se deberá agregarla en la columna donde creamos la tabla. * EJEMPLO: Quiero guardar el nivel, Siempre al agregar datos tiene que ir el nombre que pusimos en * guardar/cargar - En este caso yo puse variable='%d, en caso de agregarle cualquier otra cosa sería. * variable='%d', nivel='%d'. <-- Siempre la ultima variable se cierra con un ) * len += formatex(g_tabla[len], charsmax(g_tabla), "variable int NOT NULL DEFAULT '0',"); * len += formatex(g_tabla[len], charsmax(g_tabla), "nivel int NOT NULL DEFAULT '1')"); * Recordar: Al agregar mas variables, se deberá aumentar las celdas de g_tabla y * borrár nuevamente la base de datos. */ g_htuple = SQL_MakeDbTuple("", "", "", SQL_BASE); // Registramos la Base de Datos len = 0; len += formatex(g_tabla[len], charsmax(g_tabla), "CREATE TABLE IF NOT EXISTS SQL_Datos ("); len += formatex(g_tabla[len], charsmax(g_tabla), "Nombre varchar(33) NOT NULL DEFAULT '' PRIMARY KEY,"); // Agregamos a la tabla el nombre, len += formatex(g_tabla[len], charsmax(g_tabla), "Password varchar(33) NOT NULL DEFAULT '',"); // Agregamos a la tabla la password, len += formatex(g_tabla[len], charsmax(g_tabla), "Level int NOT NULL DEFAULT '1',"); len += formatex(g_tabla[len], charsmax(g_tabla), "Experiencia int NOT NULL DEFAULT '25',"); len += formatex(g_tabla[len], charsmax(g_tabla), "Ap int NOT NULL DEFAULT '25',"); len += formatex(g_tabla[len], charsmax(g_tabla), "Reset int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "PuntosReset int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "PuntosHumanos int NOT NULL DEFAULT '250',"); len += formatex(g_tabla[len], charsmax(g_tabla), "PuntosZombies int NOT NULL DEFAULT '250',"); len += formatex(g_tabla[len], charsmax(g_tabla), "GastadosHumanos int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "GastadosZombies int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "Infectados int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "ZombieKills int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "EffectHUD int(1) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "DMGH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "HPH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "VELH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "GRVH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "ARMORH int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "DMGZ int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "HPZ int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "VELZ int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "GRVZ int(3) NOT NULL DEFAULT '0' , "); len += formatex(g_tabla[len], charsmax(g_tabla), "MT1 int(3) NOT NULL DEFAULT '0', "); len += formatex(g_tabla[len], charsmax(g_tabla), "dato1 int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "dato2 int NOT NULL DEFAULT '0',"); len += formatex(g_tabla[len], charsmax(g_tabla), "dato3 int NOT NULL DEFAULT '0'"); SQL_ThreadQuery(g_htuple, "SQL_Tabla", g_tabla); return PLUGIN_HANDLED; }
Mensajes: 454
Temas: 95
Registro en: May 2015
Reputación:
8
Me sigue tirando los mismos errores bro
Mensajes: 336
Temas: 26
Registro en: Sep 2016
Reputación:
5
algo debes estar haciendo mal.... seguro que esta exedida la otra tabla
Mensajes: 454
Temas: 95
Registro en: May 2015
Reputación:
8
Mensajes: 336
Temas: 26
Registro en: Sep 2016
Reputación:
5
10/06/2019, 12:56 AM
(Última modificación: 10/06/2019, 12:59 AM por GoldenCosta. Edited 2 times in total.)
(10/06/2019, 12:54 AM)Blackk escribió: son casi 24 columnas XXD
no tienen q ver la cantidad de columnas sino los caracteres que usas de cada tabla al guardar y cargar datos por cada formatex
query[1224] nose si esta bien q me corrija alguien por que creo q llega solo a 999.... y ahi solo tomara 122
Mensajes: 546
Temas: 65
Registro en: Jan 2017
Reputación:
4
Tienes que borrar la BD cada ves que agregas un dato nuevo a la tabla así se crea o editarla tu mismo con el mismo programa que usas para ver los datos
Mensajes: 454
Temas: 95
Registro en: May 2015
Reputación:
8
(10/06/2019, 01:21 AM)warrior escribió: Tienes que borrar la BD cada ves que agregas un dato nuevo a la tabla así se crea o editarla tu mismo con el mismo programa que usas para ver los datos
si lo hago, uso este sistema de cuentas
https://amxmodx-es.com/Thread-Sistema-de...LITE--5318
Mensajes: 3,238
Temas: 47
Registro en: Feb 2015
Reputación:
34
10/06/2019, 07:05 PM
(Última modificación: 10/06/2019, 07:06 PM por Skylar. Edited 1 time in total.)
No tenes que mandar update cuando seguís la columna
Ejemplo:
Código PHP: formatex( query, charsmax( query ), "UPDATE %s SET Variable1='%d', Variable2='%d',", szDb, variable1[ id ], variable2[ id ] ); // Seguís la columna formatex( query, charsmax( query ), "Variable3='%d', Variable4='%d' WHERE Nombre = ^"%s^"", variable3[ id ], variable4[ id ], g_playername[ id ] );
Mensajes: 6,664
Temas: 81
Registro en: Jan 2014
Reputación:
68
(10/06/2019, 07:05 PM)Skylar escribió: No tenes que mandar update cuando seguís la columna
Ejemplo:
Código PHP: formatex( query, charsmax( query ), "UPDATE %s SET Variable1='%d', Variable2='%d',", szDb, variable1[ id ], variable2[ id ] ); // Seguís la columna formatex( query, charsmax( query ), "Variable3='%d', Variable4='%d' WHERE Nombre = ^"%s^"", variable3[ id ], variable4[ id ], g_playername[ id ] );
En tu ejemplo no la esta 'siguiendo', te falta algo importante, que es mover los caracteres
► NO DOY AYUDA VIA MENSAJE PRIVADO ◄
* Si requieres algún servicio de pago puedes contactarme vía MP o en mi facebook
Mensajes: 454
Temas: 95
Registro en: May 2015
Reputación:
8
(10/06/2019, 09:06 PM)kikizon2 escribió: (10/06/2019, 07:05 PM)Skylar escribió: No tenes que mandar update cuando seguís la columna
Ejemplo:
Código PHP: formatex( query, charsmax( query ), "UPDATE %s SET Variable1='%d', Variable2='%d',", szDb, variable1[ id ], variable2[ id ] ); // Seguís la columna formatex( query, charsmax( query ), "Variable3='%d', Variable4='%d' WHERE Nombre = ^"%s^"", variable3[ id ], variable4[ id ], g_playername[ id ] );
En tu ejemplo no la esta 'siguiendo', te falta algo importante, que es mover los caracteres
iba comentar justo ese error xDD
Mensajes: 205
Temas: 52
Registro en: Aug 2016
Reputación:
0
10/06/2019, 11:01 PM
(Última modificación: 10/06/2019, 11:02 PM por |-|Tuli|-|. Edited 1 time in total.)
mira fijate si te sirve
asi las guarde yo
solo adaptalo con tu variables
edit: siempre tene en cuenta que las ilen se suma osea que se va agregando lo de abajo
Código PHP: public guardar_datos( id ) { if( g_estado[ id ] != LOGUEADO ) return; static iData[1]; iData[0] = id new szBuffer[ 1024 ]; new iLen = 0; iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "UPDATE %s SET Nivel=^"%d^", Frags=^"%d^", Matados=^"%d^", Muertes=^"%d^", Resets=^"%d^", Rojo=^"%d^", Verde=^"%d^", Azul=^"%d^",", TABLE, g_Nivel[id], g_Frags[id], g_Matados[id], g_Muertes[id], g_Reset[id], red[id], green[id], blue[id] ); iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "PC=^"%d^", FC=^"%d^", Pan=^"%d^", Almas=^"%d^", Pisadas=^"%d^", M0=^"%d^", M1=^"%d^", M2=^"%d^", M3=^"%d^", M4=^"%d^", M5=^"%d^",", g_Puntos[id], g_Frags_Carnage[id], g_Pandora[id], g_Almas[id], g_pisadas[id], g_Mejoras[id][0], g_Mejoras[id][1], g_Mejoras[id][2], g_Mejoras[id][3], g_Mejoras[id][4], g_Mejoras[id][5] ); iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "HT0=^"%d^", HT1=^"%d^", HT2=^"%d^", HT3=^"%d^", HT4=^"%d^", HT5=^"%d^", HT6=^"%d^", HC0=^"%d^", HC1=^"%d^", HC2=^"%d^", HC3=^"%d^", HC4=^"%d^",", g_HabilidadTT[id][0], g_HabilidadTT[id][1], g_HabilidadTT[id][2], g_HabilidadTT[id][3], g_HabilidadTT[id][4], g_HabilidadTT[id][5], g_HabilidadTT[id][6], g_HabilidadCT[id][0], g_HabilidadCT[id][1], g_HabilidadCT[id][2], g_HabilidadCT[id][3], g_HabilidadCT[id][4] ); iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "GastadoT=^"%d^", GastadoCT=^"%d^", GastadoM=^"%d^", Hr=^"%d^", Min=^"%d^", Hats=^"%d^", Rango=^"%d^", PX=^"%f^", PY=^"%f^", HT7=^"%d^" WHERE id=^"%d^"", g_Puntos_Gastados[id], g_Puntos_GastadosCT[id], g_Mejoras_Gastados[id], g_tiempo[id][2], g_tiempo[id][1], g_sombrero[id], g_Rango[id], HUD_STATS_X[id], HUD_STATS_Y[id],g_HabilidadTT[id][7], g_id[id] ); SQL_ThreadQuery(g_hTuple, "DataHandler", szBuffer, iData, 2 ); arrayset( szBuffer, EOS, sizeof( szBuffer ) ); iLen = 0; }
public cargar_datos( id ) { static szQuery[ 1024 ], iData[ 2 ]; new iLen = 0 iData[ 0 ] = id; iData[ 1 ] = CARGAR_DATOS; iLen += formatex(szQuery[iLen], charsmax(szQuery) - iLen, "SELECT id, Nivel, Frags, Matados, Muertes, Resets, Rojo, Verde, Azul,") iLen += formatex(szQuery[iLen], charsmax(szQuery) - iLen, "PC, FC, Pan, Almas, Pisadas, M0, M1, M2, M3, M4, M5,") iLen += formatex(szQuery[iLen], charsmax(szQuery) - iLen, "HT0, HT1, HT2, HT3, HT4, HT5, HT6, HC0, HC1, HC2, HC3, HC4,") iLen += formatex(szQuery[iLen], charsmax(szQuery) - iLen, "GastadoT, GastadoCT, GastadoM, Hr, Min, Hats, Rango, PX, PY, HT7 FROM %s WHERE Usuario=^"%s^"", TABLE, g_usuario[ id ] ); SQL_ThreadQuery( g_hTuple, "DataHandler", szQuery, iData, 2 ); }
Mensajes: 3,238
Temas: 47
Registro en: Feb 2015
Reputación:
34
(10/06/2019, 09:06 PM)kikizon2 escribió: (10/06/2019, 07:05 PM)Skylar escribió: No tenes que mandar update cuando seguís la columna
Ejemplo:
Código PHP: formatex( query, charsmax( query ), "UPDATE %s SET Variable1='%d', Variable2='%d',", szDb, variable1[ id ], variable2[ id ] ); // Seguís la columna formatex( query, charsmax( query ), "Variable3='%d', Variable4='%d' WHERE Nombre = ^"%s^"", variable3[ id ], variable4[ id ], g_playername[ id ] );
En tu ejemplo no la esta 'siguiendo', te falta algo importante, que es mover los caracteres
No me percaté de eso, gracias
Mensajes: 417
Temas: 53
Registro en: May 2014
15/06/2019, 09:03 AM
(Última modificación: 15/06/2019, 09:08 AM por Ipolito. Edited 1 time in total.)
Normalmente cuando estas aprendiendo es todo a prueba y error. Cada uno intenta a su forma. Te dejo una forma de guardar mia (un poco vieja), pero capaz te sirve viendo como lo utilizo.
Código PHP: Save( id, disconnect ) { new iLen;
if(disconnect) { iLen = 0;
static szDate[ 11 ] get_time("%d/%m/%Y", szDate, charsmax( szDate ) )
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "UPDATE `%s` SET `Last Loggin`='%s', `Visit Days`='%d', `Day`='%d' WHERE `UserID`=^"%s^"", szTableAccounts, szDate, g_VisitDays[id], g_DayNow[id], g_AccountUser[ id ][ 1 ] ) mysql_query( g_Connection, "IgnoreHandle", g_szQuery )
g_player_data[id][TIME_SEC] = (get_systime() - g_SysTime_Connect[id]); // si se desconecta le ponemos esto y le guardamos
if(g_Clan[id][CLAN_ID]) { iLen = 0;
static szDate[ 11 ], szHour[11]
get_time("%d/%m/%Y", szDate, charsmax( szDate ) ) get_time("%H:%M:%S", szHour, charsmax(szHour))
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "UPDATE `%s` SET `RANGO`='%d', `LAST_DAY`=^"%s^", `LAST_HOUR`=^"%s^", `MALDAD`=^"%d^", `Level`=^"%d^", `PJ_ID`=^"%d^" WHERE `MEMBER`=^"%s^"", szTableClanMembers, g_Clan[id][CLAN_RANGO], szDate, szHour, g_Clan[id][CLAN_MALDAD], g_level[id], g_CharacterID[id], g_playername[id]) mysql_query( g_Connection, "IgnoreHandle", g_szQuery )
}
} else { g_player_data[id][TIME_SEC] = (get_systime() - g_SysTime_Connect[id]); // si no se desconecta le ponemos esto y guardamos g_SysTime_Connect[id] = get_systime(); // si no se desconecta }
iLen = 0 iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "UPDATE `%s` SET PlayedTime=`PlayedTime`+'%d', `Level`='%d', `Aps`='%d', `Reset`='%d', ", szTableData, g_player_data[id][TIME_SEC], g_level[ id ], g_ammopacks[ id ], g_PlayerRange[id] )
static sPoints[20] formatex(sPoints, 19, "%d %d %d", g_points[ id ][ GOLD ], g_points[ id ][ ZOMBIE ], g_points[ id ][ HUMAN ] )
static sZombieHabs[14] formatex(sZombieHabs, 13, "%d %d %d %d", g_zombie_hab[id][Z_VIT], g_zombie_hab[id][Z_DMG], g_zombie_hab[id][Z_VEL], g_zombie_hab[id][Z_GRAV])
static sHumanHabs[17] formatex(sHumanHabs, 16, "%d %d %d %d %d", g_human_hab[id][H_DMG], g_human_hab[id][H_VIT], g_human_hab[id][H_VEL], g_human_hab[id][H_GRAV], g_human_hab[id][H_BENGALA])
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`Points`=^"%s^", `ZombieHabs`=^"%s^", `HumanHabs`=^"%s^", ", sPoints, sZombieHabs, sHumanHabs )
static sGoldHabs[67] formatex(sGoldHabs, 66, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", g_gold_hab[id][G_SUPERCOMBO], g_gold_hab[id][G_BUBBLE], g_gold_hab[id][G_RADIOACTIVO], g_gold_hab[id][G_POTENCIAR], g_gold_hab[id][G_POTENCIARTIME], g_gold_hab[id][G_BUNNY], g_gold_hab[id][G_MINERO], g_gold_hab[id][G_FROST], g_gold_hab[id][G_REFORZADO], g_gold_hab[id][G_LASERREFORZADO], g_gold_hab[id][G_COMPA], g_gold_hab[id][G_SHOTGUNPRO], g_gold_hab[id][G_FRANCOTIRADOR], g_gold_hab[id][G_PISTOLERO], g_gold_hab[id][G_JASON], g_gold_hab[id][G_RENACIMIENTO], g_gold_hab[id][G_MOCHILA], g_gold_hab[id][G_ZENTRENADO], g_gold_hab[id][G_ASESINOPRO])
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`GoldHabs`=^"%s^", ", sGoldHabs )
static sHumanSkins[16] formatex(sHumanSkins, 15, "%d %d %d %d %d %d %d", g_modelhuman_desblock[ id ][SKIN_8], g_modelhuman_desblock[ id ][SKIN_9], g_modelhuman_desblock[ id ][SKIN_10], g_modelhuman_desblock[ id ][SKIN_11], g_modelhuman_desblock[ id ][SKIN_12], g_modelhuman_desblock[ id ][SKIN_13], g_modelhuman_desblock[ id ][SKIN_14])
static sPrimaryUnBlock[19] formatex(sPrimaryUnBlock, 18, "%d %d %d %d %d %d %d %d", g_weapon_prim_block[id][EDITED_WA2000], g_weapon_prim_block[id][EDITED_M200], g_weapon_prim_block[id][EDITED_M4A16FREEZ], g_weapon_prim_block[id][EDITED_RANDY], g_weapon_prim_block[id][EDITED_TACTICALM24], g_weapon_prim_block[id][EDITED_M4A15], g_weapon_prim_block[id][EDITED_STYLISH], g_weapon_prim_block[id][EDITED_P90ADVANCED])
static sSecondaryUnBlock[8] formatex(sSecondaryUnBlock, 7, "%d %d %d", g_weapon_sec_block[id][W_AKIMBO], g_weapon_sec_block[id][W_COLT], g_weapon_sec_block[id][W_BULL])
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`HumanSkins`=^"%s^", `PrimaryUnBlock`=^"%s^", `SecondaryUnBlock`=^"%s^", ", sHumanSkins, sPrimaryUnBlock, sSecondaryUnBlock)
static sTerciaryUnBlock[12] formatex(sTerciaryUnBlock, 11, "%d %d %d %d %d", g_weapon_ter_block[id][W_KNIFE7], g_weapon_ter_block[id][W_KNIFE8], g_weapon_ter_block[id][W_KNIFE9], g_weapon_ter_block[id][W_KNIFE10], g_weapon_ter_block[id][W_KNIFE11])
static sLasermineUnBlock[10] formatex(sLasermineUnBlock, 9, "%d %d %d %d", g_weapon_lm_block[id][LM_FROZEN], g_weapon_lm_block[id][LM_FIRE], g_weapon_lm_block[id][LM_FROZEN2], g_weapon_lm_block[id][LM_FIRE2])
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`TerciaryUnBlock`=^"%s^", `LasermineUnBlock`=^"%s^", ", sTerciaryUnBlock, sLasermineUnBlock)
static sHumanUnBlock[18] formatex(sHumanUnBlock, 17, "%d %d %d %d %d %d %d %d", g_hclass_block[id][HCLASS9], g_hclass_block[id][HCLASS10], g_hclass_block[id][HCLASS11], g_hclass_block[id][HCLASS12], g_hclass_block[id][HCLASS13], g_hclass_block[id][HCLASS14], g_hclass_block[id][HCLASS15], g_hclass_block[id][HCLASS16])
static sSurvUnBlock[14] formatex(sSurvUnBlock, 13, "%d %d %d %d %d %d", g_sclass_block[id][SURVIVOR_CLASS1], g_sclass_block[id][SURVIVOR_CLASS2], g_sclass_block[id][SURVIVOR_CLASS3], g_sclass_block[id][SURVIVOR_CLASS4], g_sclass_block[id][SURVIVOR_CLASS5], g_sclass_block[id][SURVIVOR_CLASS6])
static sNemBlock[7] formatex(sNemBlock, 8, "%d %d", g_nclass_block[id][NEMESIS_CLASS1], g_nclass_block[id][NEMESIS_CLASS2])
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`HumanUnBlock`=^"%s^", `SurvivorUnBlock`=^"%s^", `NemesisUnBlock`=^"%s^", ", sHumanUnBlock, sSurvUnBlock, sNemBlock)
static sHatsBlock[22] formatex(sHatsBlock, 21, "%d %d %d %d %d %d %d %d %d %d", g_hats_desblock[id][HAT_JASON], g_hats_desblock[id][HAT_ELEGANT], g_hats_desblock[id][HAT_PAPERBAG], g_hats_desblock[id][HAT_FOOTBALL], g_hats_desblock[id][HAT_ELF], g_hats_desblock[id][HAT_DEVIL], g_hats_desblock[id][HAT_ANGEL], g_hats_desblock[id][HAT_SUPERMAN], g_hats_desblock[id][HAT_HALLOWEEN], g_hats_desblock[id][HAT_SPARTAN])
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`HatsUnBlock`=^"%s^", ", sHatsBlock)
static sClasses[36]
formatex(sClasses, 35, "%d %d %d %d %d %d %d %d %d %d %d %d", g_class_select[id][HUMAN], g_class_next[id][HUMAN], g_class_select[id][ZOMBIE], g_class_next[id][ZOMBIE], g_class_select[id][SURVIVOR], g_class_next[id][SURVIVOR], g_class_select[id][NEMESIS], g_class_next[id][NEMESIS], g_model_equiped[ id ][MODEL_HUMAN], g_model_next[ id ][MODEL_HUMAN], g_model_equiped[id][MODEL_HAT], g_model_next[ id ][MODEL_HAT])
static sWeapons[32] formatex(sWeapons, 31, "%d %d %d %d %d %d %d %d %d %d", g_weapon_select[ id ][ PRIMARY ], g_weapon_next[ id ][ PRIMARY ], g_weapon_select[ id ][ SECONDARY ], g_weapon_next[ id ][ SECONDARY ], g_weapon_select[ id ][ TERCIARY ], g_weapon_next[ id ][ TERCIARY ], g_weapon_select[ id ][ LASERMINE ], g_weapon_next[ id ][ LASERMINE ], g_grenade_pack[id], g_autobuy[id] )
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`ClassesSelect`=^"%s^", `WeaponsSelect`=^"%s^", ", sClasses, sWeapons )
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`P_NKILL`='%d', `P_ZKILL`='%d', `P_HKILL`='%d', `P_SKILL`='%d', `P_HINFEC`='%d', ", g_player_data[ id ][ NEMESIS_KILL ], g_player_data[ id ][ ZOMBIE_KILL ], g_player_data[ id ][ HUMAN_KILL ], g_player_data[ id ][ SURVIVOR_KILL ], g_player_data[ id ][ HUMAN_INFECT ])
static sConfig[19] formatex(sConfig, 18, "%d %d %d %d %d %d %d", g_config[ id ][ HUD_EFFECT ], g_config[ id ][ HUD_DESAC ], g_config[ id ][ FLARE_COLOR ], g_config[ id ][ HUD_COLOR ], g_config[ id ][ NVG_COLOR ], g_config[ id ][ LOW_FPS ], g_GroupInvitationAccept[id]);
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`CONFIG`=^"%s^", `HUD_X`='%f', `HUD_Y`='%f', `COMBO_Y`='%f', `IN_CLAN`='%d'", sConfig, g_HudStats[id][X], g_HudStats[id][Y], g_HudCombo[id][Y], g_Clan[id][CLAN_ID] )
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, " WHERE `UserID`=^"%s^" AND `Character`=^"%s^"", g_AccountUser[ id ][ 1 ], g_playername[ id ] ) mysql_query( g_Connection, "IgnoreHandle", g_szQuery )
}
pd:
ej:
Código PHP: new iLen; iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "UPDATE `%s` SET PlayedTime=`PlayedTime`+'%d', `Level`='%d', `Aps`='%d', `Reset`='%d', ", szTableData, g_player_data[id][TIME_SEC], g_level[ id ], g_ammopacks[ id ], g_PlayerRange[id] )
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`Points`=^"%d^", g_points[id] )
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "`GoldPints`=^"%d^" ", g_golds[id])
iLen += formatex( g_szQuery[ iLen ], charsmax( g_szQuery ) - iLen, "WHERE `UserID`=^"%s^" AND `Character`=^"%s^"", g_AccountUser[ id ][ 1 ], g_playername[ id ] ) mysql_query( g_Connection, "IgnoreHandle", g_szQuery )
|