SA-MP Forums Archive
SQLite problem! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite problem! (/showthread.php?tid=626276)



SQLite problem! - BrianFaria - 12.01.2017

Hello, well, I was doing an sqlite log, and suddenly I stopped working. The registry works, it registers the user all well, but then when I want to log in I go out again to register, what is it? Thank you.

Pastebin


Re: SQLite problem! - BrianFaria - 13.01.2017

Help!


Re: SQLite problem! - xTURBOx - 13.01.2017

Just skimming through the text,
i don't see you LOADING the data from database


Re: SQLite problem! - BrianFaria - 13.01.2017

Код:
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);
		}
	}



Re: SQLite problem! - Jefff - 13.01.2017

http://pastebin.com/xXFYWWZR