Mysql Login System[Problem]
#1

Hello,

When I join my server, I can't log in, register or do anything. I'm using Mysql. Here are it's lines :
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
	    case DIALOG_LOGIN:
	    {
	        new szHashedPassword[129];
	        WP_Hash(szHashedPassword, 129, inputtext);
	        
	        if(!response) return KickPlayer(playerid);
	        if(response)
	        {
         		if(!strcmp(AccountData[playerid][pPassword], szHashedPassword, true, 128))
         		{
         		    LoginPlayer(playerid);
         		}
         		else
         		{
         		    SendClientMessage(playerid, -1, "Incorrect password, please try again.");
					format(szOutput, sizeof(szOutput), "{FFFFFF}Hello, welcome to "SERVER_NAME"! We have found you are registered.\n\n[Username]: {E3DD3B}%s{FFFFFF} - [IP]: {E3DD3B}%s{FFFFFF}\n\nPlease enter your password below to login.", ReturnPlayerName(playerid), AccountData[playerid][pIP]);
		        	ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{42C2F5}["SERVER_NAME": {FFFFFF}Login{42C2F5}]", szOutput, "Login", "");
         		}
	        }
	    }
	    case DIALOG_REGISTER:
	    {
	        if(!response) return KickPlayer(playerid);
			if(strlen(inputtext) < 6)
			{
			    SendClientMessage(playerid, -1, "You're account password must consist of atleast 6 characters.");
				format(szOutput, sizeof(szOutput), "{FFFFFF}Hello, welcome to "SERVER_NAME"! We have found you are not registered.\n\n[Username]: {E3DD3B}%s{FFFFFF} - [IP]: {E3DD3B}%s{FFFFFF}\n\nIt seems you are not registered, enter a password below to do-so!", ReturnPlayerName(playerid), AccountData[playerid][pIP]);
		        return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{42C2F5}["SERVER_NAME": {FFFFFF}Login{42C2F5}]", szOutput, "Register", "Quit");
			}
	        if(response)
	        {
	            WP_Hash(AccountData[playerid][pPassword], 129, inputtext);

	            format(szQuery, sizeof(szQuery), "INSERT INTO `accounts` (username, password, ip, adminlevel) VALUES ('%s', '%s', '%s', '0')", ReturnPlayerName(playerid), AccountData[playerid][pPassword], AccountData[playerid][pIP]);
                mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);

                ShowPlayerDialog(playerid,DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Enter your age below:", "Procceed", "");
		    }
	    }
	    case DIALOG_AGE:
	    {
	        if(!response) return ShowPlayerDialog(playerid,DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Enter your age below:", "Procceed", "");
	        if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Enter your age below:", "Procceed", "");
			if(strval(inputtext) < 1 || strval(inputtext) > 99)
			{
			    SendClientMessage(playerid, -1, "You're account password must consist of atleast 6 characters.");
                ShowPlayerDialog(playerid,DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Enter your age below\nInvalid age specified", "Procceed", "");
			}
	        if(response)
	        {
	            new string[64];
	            AccountData[playerid][pAge] = strval(inputtext);
	            format(string, sizeof(string), "Okay, we know that you are %d years old", AccountData[playerid][pAge]);
	            
	            ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_LIST, "Select your gender", "Male\nFemale", "Choose", "");
		    }
	    }
	    case DIALOG_GENDER:
	    {
	        if(!response) return ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_LIST, "Select your gender", "Male\nFemale", "Choose", "");
	        if(response)
	        {
	            new string[64];
	            AccountData[playerid][pGender] = listitem+1;
	            format(string, sizeof(string), "Okay, we know that you are a %s", GetGender(playerid, false));
	            
	            TogglePlayerSpectating(playerid, 0);
	            SetPlayerInterior(playerid, 0);
	            SetPlayerVirtualWorld(playerid, 0);

	            AccountData[playerid][pCash] = 500;
	            AccountData[playerid][pHealth] = 100;
	            AccountData[playerid][pAutoLogin] = 1;
			    AccountData[playerid][pMusicStreaming] = 1;
			    AccountData[playerid][pNewbieToggled] = 1;
			    AccountData[playerid][pAdmin] = 0;
	            AccountData[playerid][pLevel] = 1;
	            GivePlayerMoney(playerid, AccountData[playerid][pCash]);
	            SetPlayerScore(playerid, AccountData[playerid][pLevel]);
	            
	            new
				    day,
				    month,
				    year,
				    hour,
				    minute,
				    second
			  	;
How to fix it ?
Thank You.
Also, How to put Pawno Code ?
Reply


Messages In This Thread
Mysql Login System[Problem] - by EgyptForLife - 21.05.2014, 17:03
Re: Mysql Login System[Problem] - by EgyptForLife - 21.05.2014, 19:17
Re: Mysql Login System[Problem] - by Koala818 - 21.05.2014, 19:22
Re: Mysql Login System[Problem] - by EgyptForLife - 21.05.2014, 19:26
Re: Mysql Login System[Problem] - by Koala818 - 21.05.2014, 19:30
Re: Mysql Login System[Problem] - by EgyptForLife - 21.05.2014, 19:34
Re: Mysql Login System[Problem] - by Koala818 - 21.05.2014, 19:37
Re: Mysql Login System[Problem] - by EgyptForLife - 21.05.2014, 19:39
Re: Mysql Login System[Problem] - by EgyptForLife - 21.05.2014, 21:15
Re: Mysql Login System[Problem] - by AndySedeyn - 21.05.2014, 21:26

Forum Jump:


Users browsing this thread: 1 Guest(s)