08.09.2012, 06:04
@RedFusion,
Sure, but how can I make them save in a better way?
@Sniperwars, I would love to learn how to use Whirlpool
UPDATE: After removing the " INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]); " from the SavePlayerStats AND OnPlayerDisconnect and putting the password to save in registration like this:
Password saves, but when I try to reconnect then put the password, it says that the password is wrong.
UPDATE:
I have put the Whirlpool plugin and did this:
But the password again saves as 0.
Sure, but how can I make them save in a better way?
@Sniperwars, I would love to learn how to use Whirlpool
UPDATE: After removing the " INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]); " from the SavePlayerStats AND OnPlayerDisconnect and putting the password to save in registration like this:
pawn Code:
INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
INI_Close(File);
print("(File) has been closed and password is saved.");
UPDATE:
I have put the Whirlpool plugin and did this:
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
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,"PlayerData");
//INI_WriteString(File,"Password",udb_hash(inputtext));
new buf[145];
WP_Hash(buf, sizeof(buf), inputtext);
//if(strcmp(Password, buf) == true)
INI_WriteInt(File,"Password",WP_Hash(buf, sizeof(buf), inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",-1);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Zombie",0);
INI_WriteInt(File,"Score",1);
INI_WriteInt(File,"Team",-1);
INI_WriteInt(File,"Registered",1);
INI_WriteInt(File,"Logged",1);
PlayerInfo[playerid][pTeam] = -1;
PlayerInfo[playerid][pAdmin] = -1;
INI_Close(File);
print("(File) has been opened and Password was saved. ");
INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
INI_Close(File);
print("(File) has been closed and password is saved.");
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
new buf[145];
if(WP_Hash(buf, sizeof(buf), inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}