public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
case DIALOG_INGRESO:
{
if(response)
{
new query[520];
mysql_format(MySQL,query,sizeof(query),"SELECT * FROM `cuentas` WHERE `Nombre`='%s' AND `Password`='%s'",NombreJugador(playerid),inputtext);
mysql_pquery(MySQL, query, "IngresoJugador","d", playerid);
}
else
{
Kick(playerid);
}
}
}
return 1;
}
forward IngresoJugador(playerid);
public IngresoJugador(playerid)
{
if(cache_get_row_count() == 0)
{
ShowPlayerDialog(playerid, DIALOG_INGRESO, DIALOG_STYLE_INPUT, "Ingreso", "ЎError!\n\nLa contraseсa no es correcta.", "Continuar", "Cancelar");
}
else
{
Informacion[playerid][pNivel] = cache_get_row_int(0, 4, MySQL);
Informacion[playerid][pSkin] = cache_get_row_int(0, 5, MySQL);
Informacion[playerid][pPosX] = cache_get_row_float(0, 6, MySQL);
Informacion[playerid][pPosY] = cache_get_row_float(0, 7, MySQL);
Informacion[playerid][pPosZ] = cache_get_row_float(0, 8, MySQL);
Informacion[playerid][pSexo] = cache_get_row_int(0, 9, MySQL);
Informacion[playerid][pVida] = cache_get_row_float(0, 10, MySQL);
Informacion[playerid][pChaleco] = cache_get_row_float(0, 11, MySQL);
Informacion[playerid][pFaccion] = cache_get_row_int(0, 12, MySQL);
Informacion[playerid][pRango] = cache_get_row_int(0, 13, MySQL);
Informacion[playerid][pTrabajo] = cache_get_row_int(0, 14, MySQL);
Informacion[playerid][pDinero] = cache_get_row_int(0, 15, MySQL);
Informacion[playerid][pInterior] = cache_get_row_int(0, 16, MySQL);
Informacion[playerid][pVirtualWord] = cache_get_row_int(0, 17, MySQL);
Informacion[playerid][pEdad] = cache_get_row_int(0, 18, MySQL);
Informacion[playerid][pRaza] = cache_get_row_int(0, 19, MySQL);
Informacion[playerid][pColorOjos] = cache_get_row_int(0, 20, MySQL);
Informacion[playerid][pColorCabello] = cache_get_row_int(0, 21, MySQL);
Informacion[playerid][pRegistrado] = cache_get_row_int(0, 22, MySQL);
Informacion[playerid][pAngle] = cache_get_row_int(0, 23, MySQL);
SetPVarInt(playerid, "PuedeIngresar", 1);
IngresarJugador(playerid);
}
return 1;
}
forward IngresarJugador(playerid);
public IngresarJugador(playerid)
{
SetSpawnInfo(playerid, 0, Informacion[playerid][pSkin], Informacion[playerid][pPosX],Informacion[playerid][pPosY],Informacion[playerid][pPosZ], Informacion[playerid][pAngle], 0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerHealth(playerid,Informacion[playerid][pVida]);
SetPlayerArmour(playerid,Informacion[playerid][pChaleco]);
GivePlayerMoney(playerid,Informacion[playerid][pDinero]);
SetPlayerVirtualWorld(playerid,Informacion[playerid][pVirtualWord]);
SetPlayerInterior(playerid,Informacion[playerid][pInterior]);
SetPlayerSkin(playerid,Informacion[playerid][pSkin]);
SetPlayerScore(playerid, Informacion[playerid][pNivel]);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw38);
if(GetPVarInt(playerid, "PuedeIngresar") == 0)
{
Kick(playerid);
}
return 1;
}
|
Yo de mysql no se nada, pero revisa que tienes bien colocada la variable de cuentas en las public de OnPlayerDisconnect, y tengas en OnPlayerConnect la variable de conectado algo asi mas o menos debes revisar, yo soy algo noob xD
|
public OnPlayerConnect(playerid)
{
new query[520],nombre[MAX_PLAYER_NAME];
GetPlayerName(playerid, nombre, sizeof(nombre));
ResetVariables(playerid);
CrearTextdraws(playerid);
mysql_format(MySQL, query, sizeof(query), "SELECT * FROM `cuentas` WHERE `Nombre`='%s'", nombre);
mysql_pquery(MySQL, query, "VerificarUsuario","d", playerid);
//* Removes del Servidor *//
/* ЎCancha de Idlewood! */
RemoveBuildingForPlayer(playerid, 5551, 2140.5156, -1735.1406, 15.8906, 0.25);
RemoveBuildingForPlayer(playerid, 5410, 2140.5156, -1735.1406, 15.8906, 0.25);
/* ЎUrbanizaciуn Ayutamiento! */
RemoveBuildingForPlayer(playerid, 4055, 1394.3594, -1620.6641, 32.1484, 0.25);
RemoveBuildingForPlayer(playerid, 4220, 1370.6406, -1643.4453, 33.1797, 0.25);
RemoveBuildingForPlayer(playerid, 647, 1378.8125, -1623.3828, 14.4609, 0.25);
RemoveBuildingForPlayer(playerid, 620, 1379.2422, -1622.4531, 12.8672, 0.25);
RemoveBuildingForPlayer(playerid, 647, 1375.6406, -1621.8672, 14.5859, 0.25);
RemoveBuildingForPlayer(playerid, 647, 1382.0469, -1621.8672, 14.4844, 0.25);
RemoveBuildingForPlayer(playerid, 4006, 1394.3594, -1620.6641, 32.1484, 0.25);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawDestroy(Textdraw0[playerid]);
TextDrawDestroy(Textdraw1[playerid]);
TextDrawDestroy(Textdraw2[playerid]);
TextDrawDestroy(Textdraw3[playerid]);
TextDrawDestroy(Textdraw4[playerid]);
TextDrawDestroy(Textdraw5[playerid]);
TextDrawDestroy(Textdraw6[playerid]);
TextDrawDestroy(Textdraw7[playerid]);
TextDrawDestroy(Textdraw8[playerid]);
TextDrawDestroy(Textdraw9[playerid]);
TextDrawDestroy(Textdraw10[playerid]);
TextDrawDestroy(Textdraw11[playerid]);
TextDrawDestroy(Textdraw12[playerid]);
TextDrawDestroy(Textdraw13[playerid]);
TextDrawDestroy(Textdraw17[playerid]);
TextDrawDestroy(Textdraw18[playerid]);
TextDrawDestroy(Textdraw19[playerid]);
TextDrawDestroy(Textdraw20[playerid]);
TextDrawDestroy(Textdraw21[playerid]);
TextDrawDestroy(Textdraw22[playerid]);
TextDrawDestroy(Textdraw23[playerid]);
TextDrawDestroy(Textdraw24[playerid]);
TextDrawDestroy(Textdraw25[playerid]);
TextDrawDestroy(Textdraw26[playerid]);
TextDrawDestroy(Textdraw27[playerid]);
TextDrawDestroy(Textdraw28[playerid]);
TextDrawDestroy(Textdraw29[playerid]);
TextDrawDestroy(Textdraw30[playerid]);
TextDrawDestroy(Textdraw31[playerid]);
TextDrawDestroy(Textdraw32[playerid]);
TextDrawDestroy(Textdraw33[playerid]);
TextDrawDestroy(Textdraw34[playerid]);
TextDrawDestroy(Textdraw35[playerid]);
TextDrawDestroy(Textdraw36[playerid]);
TextDrawDestroy(Textdraw37[playerid]);
GuardarJugador(playerid);
return 1;
}
|
cache_get_row_int inicia desde el cero por si las moscas, intenta hacer un debug de la consulta que envias y de los valores que toman algunas variables. Tambien verifica si no hay errores en el mysql_log
mysql_log(LOG_ERROR | LOG_WARNING, LOG_TYPE_HTML); |
|
cache_get_row_int inicia desde el cero por si las moscas, intenta hacer un debug de la consulta que envias y de los valores que toman algunas variables. Tambien verifica si no hay errores en el mysql_log
mysql_log(LOG_ERROR | LOG_WARNING, LOG_TYPE_HTML); |
stock Float:cache_get_field_float(row, field_name[], conexion = 0)
{
new str[16];
cache_get_field_content(row, field_name, str, conexion);
return floatstr(str);
}
stock cache_get_field_int(row, field_name[], conexion = 0)
{
new str[12];
cache_get_field_content(row, field_name, str, conexion);
return strval(str);
}
new Nivel = cache_get_field_int(0, "Nivel");
|
que estбs iniciando desde el index incorrecto a recolectar los datos.
Ejemplo, supongamos que tu estructura MySQL es asн: 0 | 1 | 2 | 3 | 4 ID | Nombre | Skin | Nivel | PosX ID es el 0, y asн que PosX es el 4. Ahora si tъ haces esto: new Nivel = cache_get_row_int(0, 4, conexion); PosX imagino que tiene tageado el Float, y la funciуn no puede sacarlo.. Entonces iniciaste del index incorrecto, porque me parece tambiйn que accediste al 23 y sуlo hay 22. Por tanto serнa asн: new Nivel = cache_get_row_int(0, 3, conexion); Podrias utilizar estas funciones: PHP код:
PHP код:
|

Informacion[playerid][pNivel] = cache_get_row_int(0, 4, MySQL); Informacion[playerid][pSkin] = cache_get_row_int(0, 5, MySQL); Informacion[playerid][pPosX] = cache_get_row_float(0, 6, MySQL); Informacion[playerid][pPosY] = cache_get_row_float(0, 7, MySQL); Informacion[playerid][pPosZ] = cache_get_row_float(0, 8, MySQL); Informacion[playerid][pSexo] = cache_get_row_int(0, 9, MySQL); Informacion[playerid][pVida] = cache_get_row_float(0, 10, MySQL); Informacion[playerid][pChaleco] = cache_get_row_float(0, 11, MySQL); Informacion[playerid][pFaccion] = cache_get_row_int(0, 12, MySQL); Informacion[playerid][pRango] = cache_get_row_int(0, 13, MySQL); Informacion[playerid][pTrabajo] = cache_get_row_int(0, 14, MySQL); Informacion[playerid][pDinero] = cache_get_row_int(0, 15, MySQL); Informacion[playerid][pInterior] = cache_get_row_int(0, 16, MySQL); Informacion[playerid][pVirtualWord] = cache_get_row_int(0, 17, MySQL); Informacion[playerid][pEdad] = cache_get_row_int(0, 18, MySQL); Informacion[playerid][pRaza] = cache_get_row_int(0, 19, MySQL); Informacion[playerid][pColorOjos] = cache_get_row_int(0, 20, MySQL); Informacion[playerid][pColorCabello] = cache_get_row_int(0, 21, MySQL); Informacion[playerid][pRegistrado] = cache_get_row_int(0, 22, MySQL); Informacion[playerid][pAngle] = cache_get_row_int(0, 23, MySQL); SetPVarInt(playerid, "PuedeIngresar", 1); IngresarJugador(playerid);