I need help to check if player exist MYSQL
#7

Quote:
Originally Posted by Shinja
Посмотреть сообщение
What is this Nameid?
Change it to inputtext or nlocalreffer

And in your CheckRefferExist there are 2 params while you gave 3 in tquery

PHP код:
mysql_format(ConnectMYSQLrefferquerysizeof(refferquery), "SELECT `Username` FROM accounts WHERE Username = '%s' LIMIT 1"inputtext);
                    
mysql_tquery(ConnectMYSQLrefferquery"CheckRefferExist""iss"playeridinputtext); 
And i think your variable nlocalreffer is useless since the name is saved in inputtext
Look the main code, i was edited

Quote:
Originally Posted by GangstaSunny
Посмотреть сообщение
You dont even ask if the player exsits.
I dont know your mysql plugin version so well, send me the code where you check if the username exists when a player is connecting to your server and i will fix the referrer problem for you.
Код:
public OnPlayerConnect(playerid) {
    new query[512];
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    mysql_format(ConnectMYSQL, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Username` = '%s'", Nome(playerid) ); //SELECT * FROM accounts WHERE Name = %s TROQUE PELA QUAL ESTA NO SEU BANCO DE DADOS
    mysql_function_query(ConnectMYSQL, query, true, "OnConnection","i",playerid);
Код:
forward OnConnection(playerid); public OnConnection(playerid) {
	new rows, fields;
	cache_get_data(rows, fields);
	if(rows) {
		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Your account has been found - Log-in", "Your account has been found in our database.\nPlease insert your password to continue.", "Log-in", "Quit");
	}
	else {
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Your account hasn't been found - Register", "Your account couldn't be found in our database.\nPlease insert a new password to complete the registration.", "Register", "Quit");
	}
	return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)