SA-MP Forums Archive
Register System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Register System (/showthread.php?tid=566802)



Register System - MrCallum - 08.03.2015

On my script I am currently developing, my friend went onto it, registered, relogged and he apparently could not get in 'Invalid password' so I checked his account in the 'Accounts' folder and his password was '0' and he had set his password in text, please help


CODE:

Код:
public OnPlayerDisconnect(playerid, reason)
{
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Password",PlayerInfo[playerid][pKey]);
	INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
	INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
	INI_WriteInt(File,"RespectPoints",PlayerInfo[playerid][pConnectTime]);
    INI_WriteInt(File,"Registered",PlayerInfo[playerid][pReg]);
    INI_WriteInt(File,"Gender",PlayerInfo[playerid][pSex]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    INI_WriteInt(File,"Tutorial",PlayerInfo[playerid][pTut]);
	INI_Close(File);
	return 1;
}
Код:
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
				INI_WriteInt(File,"Level",0);
				INI_WriteInt(File,"Admin",0);
				INI_WriteInt(File,"RespectPoints",0);
    			INI_WriteInt(File,"Registered",0);
    			INI_WriteInt(File,"Gender",0);
	    		INI_WriteInt(File,"Age",0);
  			  	INI_WriteInt(File,"Cash",0);
    			INI_WriteInt(File,"Tutorial",0);
                INI_Close(File);
   				SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
      			SpawnPlayer(playerid);
			}
EDIT: They can log in when they do not enter a password, the dialog box comes up, they press enter with nothing inside and they log in?


Re: Register System - Gammix - 08.03.2015

Why would you save player password on every disconnect.
Remove:
pawn Код:
INI_WriteInt(File, "Password", ...);
Actually passwords are always strings. Why have you got it as an integer :v
Use
pawn Код:
INI_WriteString(...)
in dialog response.

Suggest: stop using udb_hash, its outdated and insecure. Try whirlpool.


Re: Register System - MrCallum - 08.03.2015

Gammix, could you help me?

Hit me up on Skype: e.r.r.y

I really need some help!