SA-MP Forums Archive
Help wiith mysql - 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: Help wiith mysql (/showthread.php?tid=619166)



Help with mysql - arkerooz - 14.10.2016

Hi guys! Just having a problem with mysql

So i want to make a system that users with the column value 4 can login and the users without it are going to get kicked

My script

Код:
CheckAccountExists(account[])
{
	new string[128];
    format(string, sizeof(string), "SELECT Certificado FROM usuarios WHERE Nombre = '%s'", account);
    mysql_query(1, string);

	mysql_store_result();
	return true;
}
Код:
    if(CheckAccountExists(Nombre) == 4){JugadorCertificado[playerid] = 1;}
Код:
	if(JugadorCertificado[playerid] == 0)
	{
		new string[128];
		new Nombre[MAX_PLAYER_NAME];
		LimpiarChat(playerid, 12);
		format(Nombre, sizeof(Nombre),"%s", GetPlayerNameRP(playerid));
		format(string, sizeof(string), "Departamento de inmigraciуn: Aъn no has sido aceptado para ingresar al paнs '%s'.", Nombre);
		SendClientMessage(playerid, Amarillo, string);
		SendClientMessage(playerid, Amarillo, "Deberбs certificar tu cuenta primero.");
		KickL(playerid);
	}
My error

Код:
GetRowDataByName() - invalid row index ('0')



Respuesta: Help wiith mysql - arkerooz - 14.10.2016

any help?


Re: Help wiith mysql - TheDrx - 15.10.2016

So, your "certificate" variable is JugadorCertificado[playerid], right?

You need to ask the MySQL server using a querry and wait for a response. The response can be either 0 or 1. Then, in your script you need to give this example to a function. The function will either let the player in when 1 or Kick() when 0.

If you still need help le me know.