Help wiith mysql
#1

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')
Reply
#2

any help?
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)