mysql rename not working properly
#1

I have the following codes below, but I wonder why it only creates another account and when it creates a new account, all the stats were gone. Need help!

Код:
	if(dialogid == DIALOG_RENAME)
	{
	    if(!response)
		{
			ShowLoginScreen(playerid);
		}
		if(response)
		{
		    if(strlen(inputtext) < 4)
		    {
		          SendClientMessage(playerid, -1, ""RED"[PASS] "WHITE"Please enter a username GREATER than 3 characters.");
		          ShowRenameScreen(playerid);
		    }
			  new Query[100];
			  format(Query,sizeof(Query),"SELECT * FROM `users` WHERE `Name` = '%s'",inputtext);
			  mysql_function_query(cHandle, Query, true, "RenamePlayer", "ds", playerid, inputtext);
		}
	}
Код:
public RenamePlayer(playerid,name[])
{
    new rows, fields;
    cache_get_data(rows, fields, cHandle);
    if(rows)
    {
		SendClientMessageEx(playerid,-1,""RED"[RENAME] "WHITE"The username %s is already exists in the database, please try another username.", name);
		ShowLoginScreen(playerid);
		return 1;
	}
	SetPlayerName(playerid, name);
	ShowRegisterScreen(playerid);
	SendClientMessageEx(playerid,-1,""RED"[RENAME] "GREEN"You have successfully changed your name to %s", name);
	return 1;
	
}
Reply
#2

There is not code for creating account. Maybe show function ShowRegisterScreen.
Reply
#3

Quote:
Originally Posted by Raweresh
Посмотреть сообщение
There is not code for creating account. Maybe show function ShowRegisterScreen.
Well, im guessing that the code I gave is only for creating another account but not renaming?

Код:
public ShowRegisterScreen(playerid)
{
    new string[300];
	format(string, sizeof(string), "{FFFFFF}Welcome to {00CC66}E{FFFFFF}nchanted {00CC66}L{FFFFFF}and {00CC66}F{FFFFFF}reeroam{00CC66}!{FFFFFF}\n\nType your desired password here to register a new account {FFD700} \n\nNOTE:\n {FFFFFF}- Your password should have atleast 4 characters \n - Never give out your password to anyone");
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{00CC66}Account Registration", string, "Register", "Leave");
    return 1;
}
thanks for helping me again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)