06.07.2011, 15:31
here you go: my password processing works fine, maybe you find some useful lines in that snippet.
remove the //commented-debug-chat-spam (showing passwords etc) lines, maybe it helps you at spotting your bug...
remove the //commented-debug-chat-spam (showing passwords etc) lines, maybe it helps you at spotting your bug...
Код:
case DIALOG_REGISTER: { new PassWordStringInput[24]; new buffer[129]; new filename[32]; new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); if(response) { if(!sscanf(inputtext,"s[24]",PassWordStringInput)) { // SendClientMessage(playerid,MSGCMDS_COLOR,PassWordStringInput); WP_Hash(buffer,sizeof(buffer),PassWordStringInput); // SendClientMessage(playerid,MSGCMDS_COLOR,buffer); format(filename, sizeof(filename),"userdata/%s.txt",Name); new File:PWFile=fopen(filename,io_readwrite); fwrite(PWFile,buffer); fclose(PWFile); WelcomeMessage(playerid); } else { Kick(playerid); } } else { Kick(playerid); } return 1; } case DIALOG_LOGIN: { new PassWordStringInput[24]; new buffer[129]; new readbuffer[129]; new filename[32]; new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); if(response) { if(!sscanf(inputtext,"s[24]",PassWordStringInput)) { // SendClientMessage(playerid,MSGCMDS_COLOR,PassWordStringInput); WP_Hash(buffer,sizeof(buffer),PassWordStringInput); // SendClientMessage(playerid,MSGCMDS_COLOR,buffer); format(filename, sizeof(filename),"userdata/%s.txt",Name); new File:PWFile=fopen(filename,io_read); fread(PWFile,readbuffer); fclose(PWFile); if(strfind(readbuffer,buffer,false,0)==0) { WelcomeMessage(playerid); // SendClientMessage(playerid,MSGSUCC_COLOR,"match"); } else { Kick(playerid); } } else { Kick(playerid); } } else { Kick(playerid); } return 1; }