[FIXED] cache_get_data issue
#1

Hello everyone, I was wondering if someone could tell me what is wrong with this code.. when I connect to the server, it runs the query and checks if there is an account under my username, which there is; however it doesn't return any rows.

Код:
public OnPlayerConnect(playerid)
{
	MasterData[playerid][uName] = GetPlayerName(playerid, str, sizeof(str));
	mysql_format(sql, query, sizeof(query), "SELECT * FROM masterdata WHERE uName = '%s'", MasterData[playerid][uName]);
	mysql_tquery(sql, query, "ExistingAccount", "i", playerid);
	return 1;
}
Код:
public ExistingAccount(playerid)
{
	cache_get_data(rows, fields);
	printf("There are %i rows and %i fields", rows, fields);
	if(rows > 0)
	{
		format(str, sizeof(str), "Welcome back, %s!\nPlease enter your account password below:", MasterData[playerid][uName]);
		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Duck's Roleplay - Login", str, "Login", "Quit");
	}
	else
	{
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Duck's Roleplay - Registration", "Welcome to Duck's Roleplay!\nPlease enter a password for your account below:", "Create", "Quit");
	}
	return 1;
}
When you connect to the server, it is supposed to get your data, i.e. check if there is an account by checking if there is an ID with the your username, and if there is; then it is supposed to show the dialog "Welcome back, %s!" however because it isn't returning the rows, it just sends you to the "Welcome to Duck's Roleplay!". Please help, Thank you.
Reply
#2

It doesn't return the name:
pawn Код:
GetPlayerName(playerid, MasterData[playerid][uName], MAX_PLAYER_NAME);
Reply
#3

Oh yeah, Thanks; I didn't think I left that in, It's working now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)