Threading queries.
#1

I just want to make sure I'm doing this right. I'm using BlueG's MySQL plugin and I am trying to thread queries. I have checked a lot of tutrials, but can't really seem to figure it out.

Код:
public OnPlayerConnect(playerid)
{
	new query[128], name[MAX_PLAYER_NAME + 1];
	GetPlayerName(playerid, name, sizeof(name));
	mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `username` = '%e' LIMIT 1", name);
	mysql_tquery(mysql, query, "OnChechPlayerRegistered", "i", playerid);
	return 1;
}
Код:
forward OnChechPlayerRegistered(playerid);
public OnChechPlayerRegistered(playerid)
{
	new rows, fields;
	cache_get_data(rows, fields);
	if(rows == 0)
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Your username was not found in our database.\nPlease register by entering your password below.", "Confirm", "Cancel");
	else
		ShowPlayerDialog(playerid, DIALOG_LOG_IN, DIALOG_STYLE_PASSWORD, "Log In", "Your username was found in our database.\nPlease log in by entering your password below.", "Confirm", "Cancel");
	printf("(Extraid: %i)", playerid);
	return 1;
}
Reply
#2

And where exactly is your problem? The code seems correct.
Reply
#3

Quote:
Originally Posted by Shetch
Посмотреть сообщение
I just want to make sure I'm doing this right.
4char
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)