Код:
if(dialogid == Logeo)
{
new DBResult: result, field[100];
if(response)
{
format(query, sizeof(query), "SELECT * FROM `Usuarios` WHERE `Nick` = '%s' AND `Pass` = '%s' COLLATE NOCASE",
DB_Escape(DarNick(playerid)),DB_Escape(inputtext));
result = db_query(BaseDeDatos, query);
if(db_num_rows(result))
{
db_get_field_assoc(result, "Ip", field, sizeof(field));
if(strcmp(GetPlayerIP(playerid), field, true) != 0)
{
format(query, sizeof(query), "UPDATE `Usuarios` SET Ip = '%s' WHERE `Nick` = '%s' COLLATE NOCASE",
DB_Escape(GetPlayerIP(playerid)),
DB_Escape(DarNick(playerid)));
db_query(BaseDeDatos, query);
}
db_get_field_assoc(result, "USERID", field, sizeof(field));
Inf[playerid][Userid] = strval(field);
db_get_field_assoc(result, "Skin", field, sizeof(field));
Inf[playerid][SkinID] = strval(field);
SetPlayerSkin(playerid, Inf[playerid][SkinID]);
db_get_field_assoc(result, "GSkin", field, sizeof(field));
Inf[playerid][SkinGuardado] = strval(field);
db_get_field_assoc(result, "Score", field, sizeof(field));
Inf[playerid][Score] = strval(field);
SetPlayerScore(playerid, Inf[playerid][Score]);
db_get_field_assoc(result, "Dinero", field, sizeof(field));
Inf[playerid][Dinero] = strval(field);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, Inf[playerid][Dinero]);
db_get_field_assoc(result, "Admin", field, sizeof(field));
Inf[playerid][AdminLvL] = strval(field);
db_get_field_assoc(result, "Vip", field, sizeof(field));
Inf[playerid][VipLvL] = strval(field);
db_get_field_assoc(result, "Puntos", field, sizeof(field));
Inf[playerid][Puntos] = strval(field);
PlayerPlaySound(playerid,4201,0.0,0.0,0.0);
}
else
{
format(StrGlo,sizeof(StrGlo),"Loguate ",DarNick(playerid));
ShowPlayerDialog(playerid,Logeo,DIALOG_STYLE_INPUT,"{2AEE2A}• Ingreso",StrGlo,"Ingresar","Salir");
PlayerPlaySound(playerid,21002,0.0,0.0,0.0);
}
db_free_result(result);
}
}