case THREAD_CHECK_ACCOUNT:
{
if(Filas == 1)
{
new contenido[8];
cache_get_field_content(0, "SQLID", JugadorInfo[extraid][jSQLID]);
cache_get_field_content(0, "Clave", JugadorInfo[extraid][jClave]);
cache_get_field_content(0, "Email", JugadorInfo[extraid][jEmail]);
cache_get_field_content(0, "Registrado", JugadorInfo[extraid][jRegistrado]);
if(JugadorInfo[playerid][jConexion] == 1 && JugadorInfo[playerid][jRegistrado] == 0)
{
LimpiarChat(playerid, 50);
format(string, sizeof(string), GM_NAME" » "E_COLOR_BLANCO"Bienvenido a Los Angeles, %s. Su ъltima visita fue el dd-mm-aa a las hh:ss", NombreIC(nombre));
Mensaje(playerid, AZULSITO, string);
SetPlayerPos(playerid, JugadorInfo[playerid][jCoordX], JugadorInfo[playerid][jCoordY], JugadorInfo[playerid][jCoordZ]);
SetPlayerColor(playerid, COLOR_BLANCO);
SetPlayerVirtualWorld(playerid, JugadorInfo[playerid][jVirtualWorld]);
SetPlayerInterior(playerid, JugadorInfo[playerid][jInterior]);
FijarVida(playerid, JugadorInfo[playerid][jVida]);
FijarChaleco(playerid, JugadorInfo[playerid][jChaleco]);
SetPlayerSkin(playerid, JugadorInfo[playerid][jSkin]);
GivePlayerMoney(playerid, JugadorInfo[playerid][jDinero]);
}
public OnPlayerDisconnect(playerid, reason)
{
GuardarCuenta(playerid);
return 1;
}
stock GuardarCuenta(playerid)
{
Mensaje(playerid, ROJO, "Su cuenta estб siendo guardada.");
format(Query, sizeof(Query), "UPDATE `cuentas` SET `ip` = '%s', `email` = '%s', `Registrado` = '%d', `Nivel` = '%d', `Sexo` = '%d', `GrupoSanguineo` = '%d', `Edad` = '%d', `Pais` = '%d', `DiaNacimiento` = '%d', `MesNacimiento` = '%d', `AnoNacimiento` = '%d' WHERE `username` = '%s'",
JugadorInfo[playerid][jIP], JugadorInfo[playerid][jEmail], JugadorInfo[playerid][jRegistrado], JugadorInfo[playerid][jNivel],
JugadorInfo[playerid][jSexo], JugadorInfo[playerid][jGrupoSanguineo], JugadorInfo[playerid][jEdad],
JugadorInfo[playerid][jPais], JugadorInfo[playerid][jDiaNacimiento], JugadorInfo[playerid][jMesNacimiento], JugadorInfo[playerid][jAnoNacimiento],NombreOOC(playerid));
mysql_function_query(MainPipeline, Query, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
format(Query, sizeof(Query), "UPDATE `cuentas` SET `Altura` = '%d', `Peso` = '%d', `Raza` = '%d', `ColorOjos` = '%d', `ColorCabello` = '%d', `EstadoCivil` = '%d', `Experiencia` = '%d', `HorasJugadas` = '%d', `Interior` = '%d', `VirtualWorld` = '%d', `Skin` = '%d', `PuntosRol` = '%d', `Donador` = '%d', `TiempoDonador` = '%d', `Administrador` = '%d' WHERE `username` = '%s'",
JugadorInfo[playerid][jAltura], JugadorInfo[playerid][jPeso], JugadorInfo[playerid][jRaza], JugadorInfo[playerid][jColorOjos], JugadorInfo[playerid][jColorCabello],
JugadorInfo[playerid][jEstadoCivil], JugadorInfo[playerid][jExperiencia], JugadorInfo[playerid][jHorasJugadas], JugadorInfo[playerid][jInterior],
JugadorInfo[playerid][jVirtualWorld], JugadorInfo[playerid][jSkin], JugadorInfo[playerid][jPuntosRol], JugadorInfo[playerid][jDonador], JugadorInfo[playerid][jTiempoDonador], JugadorInfo[playerid][jAdministrador],NombreOOC(playerid));
mysql_function_query(MainPipeline, Query, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
format(Query, sizeof(Query), "UPDATE `cuentas` SET `Lider` = '%d', `Miembro` = '%d', `DivisionLAPD` = '%d', `DivisionLAED` = '%d', `Frecuencia` = '%d', `Trabajo` = '%d', `Trabajo2` = '%d', `Contrato` = '%d', `Dinero` = '%d', `CuentaBancaria` = '%d', `EstiloCaminar` = '%d', `EstiloPelea` = '%d' WHERE `username` = '%s'",
JugadorInfo[playerid][jLider], JugadorInfo[playerid][jMiembro], JugadorInfo[playerid][jDivisionLAPD], JugadorInfo[playerid][jDivisionLAED], JugadorInfo[playerid][jFrecuencia], JugadorInfo[playerid][jTrabajo], JugadorInfo[playerid][jTrabajo2],
JugadorInfo[playerid][jContrato], JugadorInfo[playerid][jDinero], JugadorInfo[playerid][jCuentaBancaria], JugadorInfo[playerid][jEstiloCaminar], JugadorInfo[playerid][jEstiloPelea],NombreOOC(playerid));
mysql_function_query(MainPipeline, Query, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
GetPlayerPos(playerid,JugadorInfo[playerid][jCoordX],JugadorInfo[playerid][jCoordY], JugadorInfo[playerid][jCoordZ]);
GetPlayerHealth(playerid,JugadorInfo[playerid][jVida]); GetPlayerArmour(playerid,JugadorInfo[playerid][jChaleco]);
format(Query, sizeof(Query), "UPDATE `cuentas` SET `Fuerza` = '%d', `HabilidadBoxeo` = '%d', `HabilidadKneehead` = '%d', `HabilidadKungFu` = '%d', `HabilidadEscNormal` = '%d', `HabilidadEscCombate` = '%d', `HabilidadMP5` = '%d', `HabilidadAK47` = '%d', `HabilidadM4` = '%d', `HabilidadSniper` = '%d', `Muertes` = '%d', `Asesinatos` = '%d', `Arrestos` = '%d', `NivelBusqueda` = '%d', `Vida` = '%f', `Chaleco` = '%f', `CoordX` = '%f', `CoordY` = '%f', `CoordZ` = '%f' WHERE `username` = '%s'",
JugadorInfo[playerid][jFuerza], JugadorInfo[playerid][jHabilidadBoxeo], JugadorInfo[playerid][jHabilidadKneehead], JugadorInfo[playerid][jHabilidadKungFu], JugadorInfo[playerid][jHabilidadEscNormal],
JugadorInfo[playerid][jHabilidadEscCombate], JugadorInfo[playerid][jHabilidadMP5], JugadorInfo[playerid][jHabilidadAK47], JugadorInfo[playerid][jHabilidadM4], JugadorInfo[playerid][jHabilidadSniper], JugadorInfo[playerid][jMuertes], JugadorInfo[playerid][jAsesinatos],
JugadorInfo[playerid][jArrestos], JugadorInfo[playerid][jNivelBusqueda], JugadorInfo[playerid][jVida], JugadorInfo[playerid][jChaleco], JugadorInfo[playerid][jCoordX],
JugadorInfo[playerid][jCoordY], JugadorInfo[playerid][jCoordZ],NombreOOC(playerid));
mysql_function_query(MainPipeline, Query, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
Mensaje(playerid, ROJO, "El proceso de guardado de su cuenta ha sido exitoso.");
JugadorInfo[playerid][jConexion] = 1;
return 1;
}
forward OnQueryFinish(resultid, extraid, ConnectionHandle);
public OnQueryFinish(resultid, extraid, ConnectionHandle)
{
new Filas, Campos, string[256];
if(resultid != THREAD_NO_RESULT)
{
cache_get_data(Filas, Campos);
}
switch(resultid)
{
case THREAD_CHECK_ACCOUNT:
{
if(Filas == 1)
{
new contenido[8];
cache_get_field_content(0, "SQLID", JugadorInfo[extraid][jSQLID]);
cache_get_field_content(0, "Clave", JugadorInfo[extraid][jClave]);
cache_get_field_content(0, "Email", JugadorInfo[extraid][jEmail]);
cache_get_field_content(0, "Registrado", JugadorInfo[extraid][jRegistrado]);
cache_get_field_content(0, "Nivel", JugadorInfo[extraid][jNivel]);
cache_get_field_content(0, "Sexo", JugadorInfo[extraid][jSexo]);
cache_get_field_content(0, "GrupoSanguineo", JugadorInfo[extraid][jGrupoSanguineo]);
cache_get_field_content(0, "Edad", JugadorInfo[extraid][jEdad]);
cache_get_field_content(0, "Pais", JugadorInfo[extraid][jPais]);
cache_get_field_content(0, "DiaNacimiento", JugadorInfo[extraid][jDiaNacimiento]);
cache_get_field_content(0, "MesNacimiento", JugadorInfo[extraid][jMesNacimiento]);
cache_get_field_content(0, "AnoNacimiento", JugadorInfo[extraid][jAnoNacimiento]);
cache_get_field_content(0, "Altura", JugadorInfo[extraid][jAltura]);
cache_get_field_content(0, "Peso", JugadorInfo[extraid][jPeso]);
cache_get_field_content(0, "Raza", JugadorInfo[extraid][jRaza]);
cache_get_field_content(0, "ColorOjos", JugadorInfo[extraid][jColorOjos]);
cache_get_field_content(0, "ColorCabello", JugadorInfo[extraid][jColorCabello]);
cache_get_field_content(0, "EstadoCivil", JugadorInfo[extraid][jEstadoCivil]);
cache_get_field_content(0, "HorasJugadas", JugadorInfo[extraid][jHorasJugadas]);
cache_get_field_content(0, "Interior", JugadorInfo[extraid][jInterior]);
cache_get_field_content(0, "VirtualWorld", JugadorInfo[extraid][jVirtualWorld]);
cache_get_field_content(0, "Skin", JugadorInfo[extraid][jSkin]);
cache_get_field_content(0, "PuntosRol", JugadorInfo[extraid][jPuntosRol]);
cache_get_field_content(0, "Donador", JugadorInfo[extraid][jDonador]);
cache_get_field_content(0, "TiempoDonador", JugadorInfo[extraid][jTiempoDonador]);
cache_get_field_content(0, "Administrador", JugadorInfo[extraid][jAdministrador]);
cache_get_field_content(0, "Lider", JugadorInfo[extraid][jLider]);
cache_get_field_content(0, "Miembro", JugadorInfo[extraid][jMiembro]);
cache_get_field_content(0, "Rango", JugadorInfo[extraid][jRango]);
cache_get_field_content(0, "DivisionLAPD", JugadorInfo[extraid][jDivisionLAPD]);
cache_get_field_content(0, "DivisionLAED", JugadorInfo[extraid][jDivisionLAED]);
cache_get_field_content(0, "Frecuencia", JugadorInfo[extraid][jFrecuencia]);
cache_get_field_content(0, "Trabajo", JugadorInfo[extraid][jTrabajo]);
cache_get_field_content(0, "Trabajo2", JugadorInfo[extraid][jTrabajo2]);
cache_get_field_content(0, "Contrato", JugadorInfo[extraid][jContrato]);
cache_get_field_content(0, "Dinero", JugadorInfo[extraid][jDinero]);
cache_get_field_content(0, "CuentaBancaria", JugadorInfo[extraid][jCuentaBancaria]);
cache_get_field_content(0, "Alcoholemia", JugadorInfo[extraid][jAlcoholemia]);
cache_get_field_content(0, "Drogadiccion", JugadorInfo[extraid][jDrogadiccion]);
cache_get_field_content(0, "EstiloCaminar", JugadorInfo[extraid][jEstiloCaminar]);
cache_get_field_content(0, "EstiloPelea", JugadorInfo[extraid][jEstiloPelea]);
cache_get_field_content(0, "Fuerza", JugadorInfo[extraid][jFuerza]);
cache_get_field_content(0, "HabilidadBoxeo", JugadorInfo[extraid][jHabilidadBoxeo]);
cache_get_field_content(0, "HabilidadKneehead", JugadorInfo[extraid][jHabilidadKneehead]);
cache_get_field_content(0, "HabilidadKungFu", JugadorInfo[extraid][jHabilidadKungFu]);
cache_get_field_content(0, "HabilidadEscNormal", JugadorInfo[extraid][jHabilidadEscNormal]);
cache_get_field_content(0, "HabilidadEscCombate", JugadorInfo[extraid][jHabilidadEscCombate]);
cache_get_field_content(0, "HabilidadMP5", JugadorInfo[extraid][jHabilidadMP5]);
cache_get_field_content(0, "HabilidadAK47", JugadorInfo[extraid][jHabilidadAK47]);
cache_get_field_content(0, "HabilidadM4", JugadorInfo[extraid][jHabilidadM4]);
cache_get_field_content(0, "HabilidadSniper", JugadorInfo[extraid][jHabilidadSniper]);
cache_get_field_content(0, "Muertes", JugadorInfo[extraid][jMuertes]);
cache_get_field_content(0, "Asesinatos", JugadorInfo[extraid][jAsesinatos]);
cache_get_field_content(0, "Arrestos", JugadorInfo[extraid][jArrestos]);
cache_get_field_content(0, "NivelBusqueda", JugadorInfo[extraid][jNivelBusqueda]);
cache_get_field_content(0, "Vida", contenido); JugadorInfo[extraid][jVida] = floatstr(contenido);
cache_get_field_content(0, "Chaleco", contenido); JugadorInfo[extraid][jChaleco] = floatstr(contenido);
cache_get_field_content(0, "CoordX", contenido); JugadorInfo[extraid][jCoordX] = floatstr(contenido);
cache_get_field_content(0, "CoordY", contenido); JugadorInfo[extraid][jCoordY] = floatstr(contenido);
cache_get_field_content(0, "CoordZ", contenido); JugadorInfo[extraid][jCoordZ] = floatstr(contenido);
cache_get_field_content(0, "Experiencia", JugadorInfo[extraid][jExperiencia]);
}
else if(!Filas)
{
//
}
}
case THREAD_CHECK_PASS:
{
if(Filas == 1)
{
cache_get_field_content(0, "Clave", JugadorInfo[extraid][jClave]);
format(string, sizeof(string), "El personaje %s se encuentra registrado en nuestra base de datos.\n\nColoca la contraseсa en el siguiente campo si deseas iniciar sesiуn:", NombreOOC(extraid));
ShowPlayerDialog(extraid, LOGIN, DIALOG_STYLE_PASSWORD,GM_NAME" - Iniciar sesiуn",string,"Enviar","Salir");
}
else if(!Filas)
{
GetPlayerIp(extraid, JugadorInfo[extraid][jIP], 16);
format(string, sizeof(string), "El personaje %s no se encuentra registrado en nuestra base de datos.\n\nColoca una contraseсa si deseas registrarte con este nombre:", NombreOOC(extraid));
ShowPlayerDialog(extraid, REGISTRO, DIALOG_STYLE_PASSWORD,GM_NAME" - Registrar personaje",string,"Enviar","Salir");
}
}
}
return 1;
}
stock IniciarConexionMySQL()
{
printf("Iniciando conexiуn: (Servidor: '%s', Usuario: '%s', Clave: '%s', Base de Datos: '%s')", MySQL_Servidor, MySQL_Usuario, MySQL_Clave, MySQL_BD);
MainPipeline = mysql_connect(MySQL_Servidor, MySQL_Usuario, MySQL_BD,MySQL_Clave);
printf(" ");
if(mysql_ping() == 1)
{
printf("Conexiуn a la base de datos terminada.");
}
else
{
print("Conexiуn a la base de datos no realizada.");
mysql_close();
SendRconCommand("exit");
}
printf(" ");
printf(" ");
printf(" ");
printf(" ");
printf(" ");
printf(" ");
return 1;
}
case THREAD_CHECK_ACCOUNT:
{
if(Filas == 1)
{
new contenido[8];
cache_get_field_content(0, "SQLID", JugadorInfo[extraid][jSQLID]);
cache_get_field_content(0, "Clave", JugadorInfo[extraid][jClave]);
cache_get_field_content(0, "Email", JugadorInfo[extraid][jEmail]);
cache_get_field_content(0, "Registrado", JugadorInfo[extraid][jRegistrado]);
La variable "contenido" esta de bonito?
La funciуn "cache_get_field_content" obtiene valores en cadena de carбcteres ("strings") y lo que tu quieres obtener es un nъmero por lo que deberнas obtener el valor con la variable de bonito y luego usar "strval" para entregarle el numйrico a "JugadorInfo[extraid][jRegistrado]". pawn Код:
|
forward OnQueryFinish(resultid, extraid, ConnectionHandle);
public OnQueryFinish(resultid, extraid, ConnectionHandle)
{
new Filas, Campos, string[256];
if(resultid != THREAD_NO_RESULT)
{
cache_get_data(Filas, Campos);
}
switch(resultid)
{
case THREAD_CHECK_ACCOUNT:
{
if(Filas == 1)
{
new contenido[8];
cache_get_field_content(0, "SQLID", JugadorInfo[extraid][jSQLID]);
cache_get_field_content(0, "Clave", JugadorInfo[extraid][jClave]);
cache_get_field_content(0, "Email", JugadorInfo[extraid][jEmail]);
cache_get_field_content(0, "Registrado", JugadorInfo[extraid][jRegistrado]);
cache_get_field_content(0, "Nivel", JugadorInfo[extraid][jNivel]);
cache_get_field_content(0, "Sexo", JugadorInfo[extraid][jSexo]);
cache_get_field_content(0, "GrupoSanguineo", JugadorInfo[extraid][jGrupoSanguineo]);
cache_get_field_content(0, "Edad", JugadorInfo[extraid][jEdad]);
cache_get_field_content(0, "Pais", JugadorInfo[extraid][jPais]);
cache_get_field_content(0, "DiaNacimiento", JugadorInfo[extraid][jDiaNacimiento]);
cache_get_field_content(0, "MesNacimiento", JugadorInfo[extraid][jMesNacimiento]);
cache_get_field_content(0, "AnoNacimiento", JugadorInfo[extraid][jAnoNacimiento]);
cache_get_field_content(0, "Altura", JugadorInfo[extraid][jAltura]);
cache_get_field_content(0, "Peso", JugadorInfo[extraid][jPeso]);
cache_get_field_content(0, "Raza", JugadorInfo[extraid][jRaza]);
cache_get_field_content(0, "ColorOjos", JugadorInfo[extraid][jColorOjos]);
cache_get_field_content(0, "ColorCabello", JugadorInfo[extraid][jColorCabello]);
cache_get_field_content(0, "EstadoCivil", JugadorInfo[extraid][jEstadoCivil]);
cache_get_field_content(0, "HorasJugadas", JugadorInfo[extraid][jHorasJugadas]);
cache_get_field_content(0, "Interior", JugadorInfo[extraid][jInterior]);
cache_get_field_content(0, "VirtualWorld", JugadorInfo[extraid][jVirtualWorld]);
cache_get_field_content(0, "Skin", JugadorInfo[extraid][jSkin]);
cache_get_field_content(0, "PuntosRol", JugadorInfo[extraid][jPuntosRol]);
cache_get_field_content(0, "Donador", JugadorInfo[extraid][jDonador]);
cache_get_field_content(0, "TiempoDonador", JugadorInfo[extraid][jTiempoDonador]);
cache_get_field_content(0, "Administrador", JugadorInfo[extraid][jAdministrador]);
cache_get_field_content(0, "Lider", JugadorInfo[extraid][jLider]);
cache_get_field_content(0, "Miembro", JugadorInfo[extraid][jMiembro]);
cache_get_field_content(0, "Rango", JugadorInfo[extraid][jRango]);
cache_get_field_content(0, "DivisionLAPD", JugadorInfo[extraid][jDivisionLAPD]);
cache_get_field_content(0, "DivisionLAED", JugadorInfo[extraid][jDivisionLAED]);
cache_get_field_content(0, "Frecuencia", JugadorInfo[extraid][jFrecuencia]);
cache_get_field_content(0, "Trabajo", JugadorInfo[extraid][jTrabajo]);
cache_get_field_content(0, "Trabajo2", JugadorInfo[extraid][jTrabajo2]);
cache_get_field_content(0, "Contrato", JugadorInfo[extraid][jContrato]);
cache_get_field_content(0, "Dinero", JugadorInfo[extraid][jDinero]);
cache_get_field_content(0, "CuentaBancaria", JugadorInfo[extraid][jCuentaBancaria]);
cache_get_field_content(0, "Alcoholemia", JugadorInfo[extraid][jAlcoholemia]);
cache_get_field_content(0, "Drogadiccion", JugadorInfo[extraid][jDrogadiccion]);
cache_get_field_content(0, "EstiloCaminar", JugadorInfo[extraid][jEstiloCaminar]);
cache_get_field_content(0, "EstiloPelea", JugadorInfo[extraid][jEstiloPelea]);
cache_get_field_content(0, "Fuerza", JugadorInfo[extraid][jFuerza]);
cache_get_field_content(0, "HabilidadBoxeo", JugadorInfo[extraid][jHabilidadBoxeo]);
cache_get_field_content(0, "HabilidadKneehead", JugadorInfo[extraid][jHabilidadKneehead]);
cache_get_field_content(0, "HabilidadKungFu", JugadorInfo[extraid][jHabilidadKungFu]);
cache_get_field_content(0, "HabilidadDesert", JugadorInfo[extraid][jHabilidadDesert]);
cache_get_field_content(0, "HabilidadEscNormal", JugadorInfo[extraid][jHabilidadEscNormal]);
cache_get_field_content(0, "HabilidadEscCombate", JugadorInfo[extraid][jHabilidadEscCombate]);
cache_get_field_content(0, "HabilidadMP5", JugadorInfo[extraid][jHabilidadMP5]);
cache_get_field_content(0, "HabilidadAK47", JugadorInfo[extraid][jHabilidadAK47]);
cache_get_field_content(0, "HabilidadM4", JugadorInfo[extraid][jHabilidadM4]);
cache_get_field_content(0, "HabilidadSniper", JugadorInfo[extraid][jHabilidadSniper]);
cache_get_field_content(0, "Muertes", JugadorInfo[extraid][jMuertes]);
cache_get_field_content(0, "Asesinatos", JugadorInfo[extraid][jAsesinatos]);
cache_get_field_content(0, "Arrestos", JugadorInfo[extraid][jArrestos]);
cache_get_field_content(0, "NivelBusqueda", JugadorInfo[extraid][jNivelBusqueda]);
cache_get_field_content(0, "Vida", contenido); JugadorInfo[extraid][jVida] = floatstr(contenido);
cache_get_field_content(0, "Chaleco", contenido); JugadorInfo[extraid][jChaleco] = floatstr(contenido);
cache_get_field_content(0, "CoordX", contenido); JugadorInfo[extraid][jCoordX] = floatstr(contenido);
cache_get_field_content(0, "CoordY", contenido); JugadorInfo[extraid][jCoordY] = floatstr(contenido);
cache_get_field_content(0, "CoordZ", contenido); JugadorInfo[extraid][jCoordZ] = floatstr(contenido);
cache_get_field_content(0, "Experiencia", JugadorInfo[extraid][jExperiencia]);
}
else if(!Filas)
{
//
}
}
case THREAD_CHECK_PASS:
{
if(Filas == 1)
{
cache_get_field_content(0, "Clave", JugadorInfo[extraid][jClave]);
format(string, sizeof(string), "El personaje %s se encuentra registrado en nuestra base de datos.\n\nColoca la contraseсa en el siguiente campo si deseas iniciar sesiуn:", NombreOOC(extraid));
ShowPlayerDialog(extraid, LOGIN, DIALOG_STYLE_PASSWORD,GM_NAME" - Iniciar sesiуn",string,"Enviar","Salir");
}
else if(!Filas)
{
GetPlayerIp(extraid, JugadorInfo[extraid][jIP], 16);
format(string, sizeof(string), "El personaje %s no se encuentra registrado en nuestra base de datos.\n\nColoca una contraseсa si deseas registrarte con este nombre:", NombreOOC(extraid));
ShowPlayerDialog(extraid, REGISTRO, DIALOG_STYLE_PASSWORD,GM_NAME" - Registrar personaje",string,"Enviar","Salir");
}
}
}
return 1;
}