Account system bugged, please help!
#1

Hello,
I have a really annoying problem with my accountsystem. If you register a account and after that you try to login it will fail, even if you have the right password. Sometimes this bugg shows up and sometimes not. I think the password that the script reads from the file and the password the player gives don't match, because the symbols that i use are wrong, but i dont know how to fix it, here you see the code :

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new string[128];
	if(dialogid == 123)
	{
	    GetPlayerName(playerid, pname, sizeof (pname));
	    if (!dini_Exists(udb_encode(pname)))
     	{
      		dini_Create(udb_encode(playername));
        	dini_IntSet(udb_encode(pname), "password", udb_hash(inputtext));
         	dini_IntSet(udb_encode(pname), "adminlevel", 0);
          	dini_IntSet(udb_encode(pname), "money", 0);
           	dini_IntSet(udb_encode(pname), "license", 0);
            dini_IntSet(udb_encode(pname), "job", 1);
            dini_IntSet(udb_encode(pname), "skin", 0);
            dini_FloatSet(udb_encode(pname), "health", 100.0);
            dini_FloatSet(udb_encode(pname), "armour", 0.0);
            dini_IntSet(udb_encode(pname), "bankmoney", 100);
            dini_IntSet(udb_encode(pname), "fightstyle", 0);
            dini_IntSet(udb_encode(pname), "carlocks", 0);
            dini_IntSet(udb_encode(pname), "cigarets", 0);
            dini_IntSet(udb_encode(pname), "beer", 0);
            dini_IntSet(udb_encode(pname), "sprunk", 0);
            dini_IntSet(udb_encode(pname), "rope", 0);
            dini_IntSet(udb_encode(pname), "weed", 0);
    	   	dini_FloatSet(udb_encode(pname),"spawnX", 2462.5);
	       	dini_FloatSet(udb_encode(pname),"spawnY", -1756.5);
		   	dini_FloatSet(udb_encode(pname),"spawnZ", 13.5);
		   	dini_IntSet(udb_encode(pname),"jerrycan", 0);
          	format(string, sizeof(string), "SERVER: %s succesfully created, you can now log in with the password: %s", playername, strval(inputtext));
          	SendClientMessage(playerid, COLOR_YELLOW, string);
          	ShowPlayerDialog(playerid,124,DIALOG_STYLE_INPUT,"Login","Welcome to RedStreets RolePlay.\nThis account exist, please log in.\n\nPassword:","Login","Quit");
       	}
        else
        {
        	format(string, sizeof(string), "%s already registered, please come back with another name.", playername); Kick(playerid);
         	SendClientMessage(playerid, COLOR_RED, string);
      	}
		return 1;
}
	if(dialogid == 124)
	{
	    if(response == 0) Kick(playerid);
	    {
	        if(response == 1)
	        {
	    		if (dini_Exists(udb_encode(playername)))
     			{
              		new password = dini_Int(playername, "password");
     				if(udb_hash(inputtext) != password)
       				{
       					SendClientMessage(playerid, COLOR_RED, "SERVER: Wrong password! Please try again.");
       					ShowPlayerDialog(playerid,124,DIALOG_STYLE_INPUT,"Login","Welcome to RedStreets RolePlay.\nThis account exist, please log in.\n\nPassword:","Login","Quit");
          			}
           			else
            		{
                		logged[playerid] = 1;
						LoadPlayerStats(playerid);
						SetTimerEx("Loadmorestats",100,0,"i",playerid);
						LoadJob(playerid);
						SetPlayerMapIcons(playerid);
                		SetCameraBehindPlayer(playerid);
            		}
				}
  				else
    			{
  					format(string, sizeof(string), "SERVER: The account %s doesen't exist, you can register it now.", playername);
       				SendClientMessage(playerid, COLOR_RED, string);
       				ShowPlayerDialog(playerid,123,DIALOG_STYLE_INPUT,"Create an account","Welcome to RedStreets RolePlay.\nYou don't have an account on this server\n Please create one by typing your new password below\n\nPassword:","Create","Quit");
       			}
 			}
 		}
 	}
  	return 1;
}
Please, if you have an idea whats possible wrong tell it me!
Greetz,
Danny

EDIT: The forum system has screwed up the indentation, its not my fault!
Reply
#2

Im new with it bug hope i see some { } wrong...
Reply
#3

I make error was but* peace
Reply
#4

Not sure but you could try strval(inputtext) instead of udb_hash(inputtext)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)