16.12.2013, 17:56
N intendi,
pawn Код:
if(dialogid == 12346)
{
Encrypt(inputtext);
new string2[128];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), ACCOUNTS_FOLDER, playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Senha" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(AccountInfo[playerid][aSenha], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(AccountInfo[playerid][aSenha],inputtext, true ) == 0)
{
if(strlen(inputtext))
{
for(new p = 0; p < strlen(AccountInfo[playerid][aSenha]); p++)
{
inputtext[p] = '?';
}
SetTimerEx("LogIn", LOGIN_DELAY*1000, 0, "d", playerid);
printf("%s esta logando.",playername2);
new key[256];
new Data[256];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
/*if(strcmp(key, "AdminLevel", true) == 0) // This is only an example if you want to add more stuff to store in a file.
{
val = ini_GetValue( Data );
AccountInfo[playerid][AdminLevel] = strval(val); // Uncommenting this will give you errors if the variable isn't defined.
}
*/
}
fclose(UserFile);
}
}
else
{
if(strlen(inputtext))
{
new girismsg[256];
printf("%s esta usando senha errada.",playername2);
format(girismsg,256,"SENHA ERRADA\n\nSenha:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
registro[playerid] = 0;
fclose(UserFile);
return 1;
}
}
if(!strlen(inputtext))
{
new girismsg[256];
printf("%s nao esta entrando com senha.",playername2);
format(girismsg,256,"SENHA ERRADA\n\nSenha:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
registro[playerid] = 0;
fclose(UserFile);
return 1;
}
}
}