case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Making your account...","{FF0000}You have entered an invalid password.\n{FFFFFF}Type your password below to register a new account.","Register","Quit");
new pass[129];
WP_Hash(pass, sizeof(pass), inputtext);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File, "Password", pass);
INI_WriteInt(File, "Cash", 1000);
INI_WriteInt(File, "Bank", 25000);
INI_WriteInt(File, "Admin", 0);
INI_WriteInt(File, "Moderator", 0);
INI_WriteInt(File, "VIP", 0);
INI_WriteInt(File, "Level", 1);
INI_WriteInt(File, "Kills", 0);
INI_WriteInt(File, "Deaths", 0);
INI_WriteInt(File, "Faction", 0);
INI_WriteInt(File, "FRank", 0);
INI_WriteInt(File, "SpawnCity", 0);
INI_WriteInt(File, "Tutorial", 0);
INI_WriteInt(File, "Car", 999);
INI_WriteInt(File, "Car2", 999);
INI_WriteInt(File, "Wanted", 0);
INI_WriteInt(File, "Warns", 0);
INI_WriteInt(File, "MuteTime", 0);
INI_WriteString(File, "sRank", " ");
INI_WriteInt(File, "Job", 0);
new day, month, year;
getdate(year, month, day);
format(string, sizeof(string), "%d.%d.%d", day, month, year);
INI_WriteString(File, "Register Date", string);
INI_Close(File);
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Type your password to login.", "OK", "Quit");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Crash ( playerid );
if( response )
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "You must enter a password.", "OK", "Quit");
else
{
new password[129];
WP_Hash(password, sizeof(password), inputtext);
if(!strcmp(password, PlayerData[playerid][Pass]))
{
GivePlayerMoney(playerid, PlayerData[playerid][Cash]);
RespawnPlayer(playerid);
StopAudioStreamForPlayer(playerid);
loggedin[playerid] = 1;
}
else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an incorrect password.\n{FFFFFF}Type your password below to login.","Login","Exit");
}
}
}
666847E02F6C42DE55BC690A1E107B290ADC45D56AC4DE195C02AA81DF1AD4047BDD47E03793F5072C06B7EA6E6CDD6A60D42A08774214AF34937860CF5A348B//good password
666847E02F6C42DE55BC690A1E107B290ADC45D56AC4DE195C02AA81DF1AD4047BDD47E03793F5072C06B7EA6E6CDD6A60D42A08774214AF34937860CF5A348//in the .ini file
WP Error: Insufficient buffer size (must be at least 129) |
new pass[129], apass[64];
WP_Hash(pass, sizeof(pass), inputtext);
strmid(apass, pass, 20, 84);
INI_WriteString(File, "Password", apass);