29.06.2014, 02:52
Password of Data of the players of the server saved with hash password so, i changed it to inputtext, and it saved with inputtext, but when i login again, it said that it is a wrong password.
Password of Data of the players of the server saved with hash password so |
new hashpass[129], date[20], year, month, day, str[200]; new random_color = ( 16777216 * random( 256 ) ) + ( 65536 * random( 256 ) ) + ( 256 * random( 256 ) ) + 255; WP_Hash(hashpass, sizeof(hashpass), inputtext); getdate(year, month, day); format(date, sizeof(date), "%d/%d/%d", day, month, year); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File, "Player's Data"); INI_WriteString(File, "Password", hashpass); INI_WriteString(File, "Registered_On", date); INI_WriteInt(File,"Admin", 0); INI_WriteInt(File,"VIP", 0); INI_WriteInt(File,"Cash", 0); INI_WriteInt(File,"Score", 0); INI_WriteInt(File,"Kills", 0); INI_WriteInt(File,"Deaths", 0); INI_WriteInt(File, "Hours", 0); INI_WriteInt(File, "Minutes", 0); INI_Close(File); gTotalRegisters++; GivePlayerMoney(playerid, 100000); PlayerInfo[playerid][Hours] = 0; PlayerInfo[playerid][Minutes] = 0; PlayerInfo[playerid][POS_X] = -2355.9038; PlayerInfo[playerid][POS_Y] = -1635.4912; PlayerInfo[playerid][POS_Z] = 483.7031; PlayerInfo[playerid][Helmet] = 1; SendClientMessage(playerid, COLOR_PINK, ""PREMIUM"*** "LIGHTBLUE"Thank you for registering your account!"); PlayerInfo[playerid][RegOn] = date; SpawnPlayer(playerid); format(str, sizeof(str), ""RED"[EsF] {%06x}%s(%d) {2BD9F8}has registered, making the server have total {008FFB}%d {2BD9F8}players registered.", random_color >>> 8, GetName(playerid), playerid, gTotalRegisters); SetPlayerColor(playerid, random_color); SendClientMessageToAll(0x2BD9F8FF, str); new INI:FILE_SERVER_STATS = INI_Open(ServerStats); INI_SetTag(FILE_SERVER_STATS, "Server_Statistics"); INI_WriteInt(FILE_SERVER_STATS, "Total_Registered_Users", gTotalRegisters); INI_Close(FILE_SERVER_STATS); PlayerInfo[playerid][Spawned] = 1; PlayerInfo[playerid][LoggedIn] = 1; TD_MSG(playerid, 3000, "~b~~h~You have successfully registered!~w~~b~~h~~n~~b~~h~$100000 bonus for registering!"); new regInfo[300]; format(regInfo, sizeof(regInfo), ""YELLOW"Hello!\n\n"GREEN"» Your nick: "YELLOW"%s\n"GREEN"\n"GREEN"» Your password: "YELLOW"%s\n\n"LIGHTGREEN"Never share your password with anyone!\nYou'll need it for logging next time.", GetName(playerid), inputtext); ShowPlayerDialog(playerid, DIALOG_CONFIRM_REGISTER, DIALOG_STYLE_MSGBOX, ""RED"Register Info", regInfo, "OK", ""); return 1;
if (dialogid == REGISTER) { if (!response) return Kick(playerid); if (response) { if (!strlen(inputtext)) { ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, ""RED">> "PREMIUM"Account Register", ""WHITE"Welcome to "RED"Extreme Street Fighters"WHITE"!\n"WHITE"This account is "RED"not "WHITE"registered.\n\n"YELLOW"» Please enter a password below to register.", "Register", "Quit"); return 1; } new hashpass[129], date[20], year, month, day, str[200]; new random_color = ( 16777216 * random( 256 ) ) + ( 65536 * random( 256 ) ) + ( 256 * random( 256 ) ) + 255; WP_Hash(hashpass, sizeof(hashpass), inputtext); getdate(year, month, day); format(date, sizeof(date), "%d/%d/%d", day, month, year); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File, "Player's Data"); INI_WriteString(File, "Password", hashpass); INI_WriteString(File, "Registered_On", date); INI_WriteInt(File,"Admin", 0); INI_WriteInt(File,"VIP", 0); INI_WriteInt(File,"Cash", 0); INI_WriteInt(File,"Score", 0); INI_WriteInt(File,"Kills", 0); INI_WriteInt(File,"Deaths", 0); INI_WriteInt(File, "Hours", 0); INI_WriteInt(File, "Minutes", 0); INI_Close(File); gTotalRegisters++; GivePlayerMoney(playerid, 100000); PlayerInfo[playerid][Hours] = 0; PlayerInfo[playerid][Minutes] = 0; PlayerInfo[playerid][POS_X] = -2355.9038; PlayerInfo[playerid][POS_Y] = -1635.4912; PlayerInfo[playerid][POS_Z] = 483.7031; PlayerInfo[playerid][Helmet] = 1; SendClientMessage(playerid, COLOR_PINK, ""PREMIUM"*** "LIGHTBLUE"Thank you for registering your account!"); PlayerInfo[playerid][RegOn] = date; SpawnPlayer(playerid); format(str, sizeof(str), ""RED"[EsF] {%06x}%s(%d) {2BD9F8}has registered, making the server have total {008FFB}%d {2BD9F8}players registered.", random_color >>> 8, GetName(playerid), playerid, gTotalRegisters); SetPlayerColor(playerid, random_color); SendClientMessageToAll(0x2BD9F8FF, str); new INI:FILE_SERVER_STATS = INI_Open(ServerStats); INI_SetTag(FILE_SERVER_STATS, "Server_Statistics"); INI_WriteInt(FILE_SERVER_STATS, "Total_Registered_Users", gTotalRegisters); INI_Close(FILE_SERVER_STATS); PlayerInfo[playerid][Spawned] = 1; PlayerInfo[playerid][LoggedIn] = 1; TD_MSG(playerid, 3000, "~b~~h~You have successfully registered!~w~~b~~h~~n~~b~~h~$100000 bonus for registering!"); new regInfo[300]; format(regInfo, sizeof(regInfo), ""YELLOW"Hello!\n\n"GREEN"» Your nick: "YELLOW"%s\n"GREEN"\n"GREEN"» Your password: "YELLOW"%s\n\n"LIGHTGREEN"Never share your password with anyone!\nYou'll need it for logging next time.", GetName(playerid), inputtext); ShowPlayerDialog(playerid, DIALOG_CONFIRM_REGISTER, DIALOG_STYLE_MSGBOX, ""RED"Register Info", regInfo, "OK", ""); return 1; } } if (dialogid == LOGIN) { if (!response) return Kick(playerid); if (response) { new hashpass[129]; WP_Hash(hashpass,sizeof(hashpass),inputtext); if(!strcmp(hashpass, PlayerInfo[playerid][Password], false)) { new str[250], AdminRank[50], msg[128], str2[128]; INI_ParseFile(UserPath(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid); SetPlayerScore(playerid, PlayerInfo[playerid][Score]); GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]); SetPlayerColor(playerid, PlayerInfo[playerid][Color]); switch(PlayerInfo[playerid][Admin]) { case 1: AdminRank = "Moderator"; case 2: AdminRank = "Administrator"; case 3: AdminRank = "Head Administrator"; case 4: AdminRank = "Server Owner"; } if (PlayerInfo[playerid][VIP] >= 1 && isnull(PlayerInfo[playerid][AltName])) { format(msg, sizeof(msg), "{FFD700}[EsF] {87F5EA}VIP {%06x}%s(%d) {A1D4CF}{87F5EA}has logged in.", (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid); SendClientMessageToAll(-1, msg); } else if (PlayerInfo[playerid][VIP] >= 1) { format(msg, sizeof(msg), "{FFD700}[EsF] {87F5EA}VIP {%06x}%s(%d) {A1D4CF}(%s) {87F5EA}has logged in.", (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid, PlayerInfo[playerid][AltName]); SendClientMessageToAll(-1, msg); } if (PlayerInfo[playerid][Admin] >= 1) { format(msg, sizeof(msg), "{FFD700}[EsF] {DEF968}%s {%06x}%s(%d) {DEF968}has logged in.", AdminRank, (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid); SendClientMessageToAll(-1, msg); } format(str, sizeof(str), "** Welcome back, %s! You were last online on {CB6CE6}%s{FFB6C1}!", GetName(playerid), lastactive[playerid]); SendClientMessage(playerid, COLOR_PINK, str); format(str2, sizeof(str2), "** You have been online for %i hours and %i minutes in total.", PlayerInfo[playerid][Hours], PlayerInfo[playerid][Minutes]); SendClientMessage(playerid, 0xFFD70075, str2); TD_MSG(playerid, 3000, "~b~~h~Welcome back!~n~~b~~h~You have successfully logged in!"); SpawnPlayer(playerid); gOnlineTime = SetTimerEx("TimeOnServer", 60000, true, "i", playerid); PlayerInfo[playerid][Spawned] = 1; PlayerInfo[playerid][LoggedIn] = 1; }
if (dialogid == REGISTER) { if (!response) return Kick(playerid); if (response) { if (!strlen(inputtext)) { ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, ""RED">> "PREMIUM"Account Register", ""WHITE"Welcome to "RED"Extreme Street Fighters"WHITE"!\n"WHITE"This account is "RED"not "WHITE"registered.\n\n"YELLOW"» Please enter a password below to register.", "Register", "Quit"); return 1; } new date[20], year, month, day, str[200]; new random_color = ( 16777216 * random( 256 ) ) + ( 65536 * random( 256 ) ) + ( 256 * random( 256 ) ) + 255; getdate(year, month, day); format(date, sizeof(date), "%d/%d/%d", day, month, year); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File, "Player's Data"); INI_WriteString(File, "Password", inputtext); INI_WriteString(File, "Registered_On", date); INI_WriteInt(File,"Admin", 0); INI_WriteInt(File,"VIP", 0); INI_WriteInt(File,"Cash", 0); INI_WriteInt(File,"Score", 0); INI_WriteInt(File,"Kills", 0); INI_WriteInt(File,"Deaths", 0); INI_WriteInt(File, "Hours", 0); INI_WriteInt(File, "Minutes", 0); INI_Close(File); gTotalRegisters++; GivePlayerMoney(playerid, 100000); PlayerInfo[playerid][Hours] = 0; PlayerInfo[playerid][Minutes] = 0; PlayerInfo[playerid][POS_X] = -2355.9038; PlayerInfo[playerid][POS_Y] = -1635.4912; PlayerInfo[playerid][POS_Z] = 483.7031; PlayerInfo[playerid][Helmet] = 1; SendClientMessage(playerid, COLOR_PINK, ""PREMIUM"*** "LIGHTBLUE"Thank you for registering your account!"); PlayerInfo[playerid][RegOn] = date; SpawnPlayer(playerid); format(str, sizeof(str), ""RED"[EsF] {%06x}%s(%d) {2BD9F8}has registered, making the server have total {008FFB}%d {2BD9F8}players registered.", random_color >>> 8, GetName(playerid), playerid, gTotalRegisters); SetPlayerColor(playerid, random_color); SendClientMessageToAll(0x2BD9F8FF, str); new INI:FILE_SERVER_STATS = INI_Open(ServerStats); INI_SetTag(FILE_SERVER_STATS, "Server_Statistics"); INI_WriteInt(FILE_SERVER_STATS, "Total_Registered_Users", gTotalRegisters); INI_Close(FILE_SERVER_STATS); PlayerInfo[playerid][Spawned] = 1; PlayerInfo[playerid][LoggedIn] = 1; TD_MSG(playerid, 3000, "~b~~h~You have successfully registered!~w~~b~~h~~n~~b~~h~$100000 bonus for registering!"); new regInfo[300]; format(regInfo, sizeof(regInfo), ""YELLOW"Hello!\n\n"GREEN"» Your nick: "YELLOW"%s\n"GREEN"\n"GREEN"» Your password: "YELLOW"%s\n\n"LIGHTGREEN"Never share your password with anyone!\nYou'll need it for logging next time.", GetName(playerid), inputtext); ShowPlayerDialog(playerid, DIALOG_CONFIRM_REGISTER, DIALOG_STYLE_MSGBOX, ""RED"Register Info", regInfo, "OK", ""); return 1; } } if (dialogid == LOGIN) { if (!response) return Kick(playerid); if (response) { if(!strcmp( PlayerInfo[playerid][Password],inputtext, false)) { new str[250], AdminRank[50], msg[128], str2[128]; INI_ParseFile(UserPath(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid); SetPlayerScore(playerid, PlayerInfo[playerid][Score]); GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]); SetPlayerColor(playerid, PlayerInfo[playerid][Color]); switch(PlayerInfo[playerid][Admin]) { case 1: AdminRank = "Moderator"; case 2: AdminRank = "Administrator"; case 3: AdminRank = "Head Administrator"; case 4: AdminRank = "Server Owner"; } if (PlayerInfo[playerid][VIP] >= 1 && isnull(PlayerInfo[playerid][AltName])) { format(msg, sizeof(msg), "{FFD700}[EsF] {87F5EA}VIP {%06x}%s(%d) {A1D4CF}{87F5EA}has logged in.", (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid); SendClientMessageToAll(-1, msg); } else if (PlayerInfo[playerid][VIP] >= 1) { format(msg, sizeof(msg), "{FFD700}[EsF] {87F5EA}VIP {%06x}%s(%d) {A1D4CF}(%s) {87F5EA}has logged in.", (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid, PlayerInfo[playerid][AltName]); SendClientMessageToAll(-1, msg); } if (PlayerInfo[playerid][Admin] >= 1) { format(msg, sizeof(msg), "{FFD700}[EsF] {DEF968}%s {%06x}%s(%d) {DEF968}has logged in.", AdminRank, (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid); SendClientMessageToAll(-1, msg); } format(str, sizeof(str), "** Welcome back, %s! You were last online on {CB6CE6}%s{FFB6C1}!", GetName(playerid), lastactive[playerid]); SendClientMessage(playerid, COLOR_PINK, str); format(str2, sizeof(str2), "** You have been online for %i hours and %i minutes in total.", PlayerInfo[playerid][Hours], PlayerInfo[playerid][Minutes]); SendClientMessage(playerid, 0xFFD70075, str2); TD_MSG(playerid, 3000, "~b~~h~Welcome back!~n~~b~~h~You have successfully logged in!"); SpawnPlayer(playerid); gOnlineTime = SetTimerEx("TimeOnServer", 60000, true, "i", playerid); PlayerInfo[playerid][Spawned] = 1; PlayerInfo[playerid][LoggedIn] = 1; }