Well, as the title says, I have a BIG problem with my login command, Sometimes it says that the password is wrong when its Correct, well, heres the CMD:
[pawn]else if ( strcmp( cmd, "conectar", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) return SendClientMessage( playerid, COLOR_GREEN, "Usa /c Conectar (Clave)" );
if ( IsRegistered( playerid ) ) return SendClientMessage( playerid, COLOR_RED, "Error: No Estas Registrado En El Server, Usa /c registrar" );
if ( IsLoggedIn( playerid ) ) return SendClientMessage( playerid, COLOR_RED, "Error: Ya Estas Logueado!" );
new pass_confirm[ 256 ];
pass_confirm = dini_Get( file, "Password" );
if ( strcmp( encrypt( tmp ), pass_confirm, true ) == 0 )
{
format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );
new level, stats, nogoto, noloc, cash, szMsg[ 128 ], IP[ 24 ];
level = dini_Int( file, "Level" );
stats = dini_Int( file, "Stats" );
nogoto = dini_Int( file, "NoGoto" );
noloc = dini_Int( file, "NoLoc" );
cash = dini_Int( file, "Cash" );
GetPlayerIp( playerid, IP, 24 );
PlayerInfo[ playerid ][ Logged ] = 1;
PlayerInfo[ playerid ][ Level ] = level;
PlayerInfo[ playerid ][ Stats ] = stats;
PlayerInfo[ playerid ][ NoGoto ] = nogoto;
PlayerInfo[ playerid ][ NoLoc ] = noloc;
UpDateFile( USERS_FILE, gPlayers[ playerid ], "Login", "1" );
UpDateFile( USERS_FILE, gPlayers[ playerid ], "Ip", IP );
SendClientMessageToAll(COLOR_YELLOW,">> %s Se a conectado correctamente.", gPlayers[playerid] );
MensajePM( playerid, COLOR_GREEN, "Te as conectado correctamente." );
format( szMsg, 128, "Tu IP:[ %s ]", IP );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
format( szMsg, sizeof( szMsg ), "Nick:[ %s ] Nivel:[ %d ] Estado:[ %s ]", gPlayers[ playerid ], level, StatusTag( level ) );
MensajePM( playerid, COLOR_GREEN, szMsg );
SetPlayerMoney( playerid, cash );
}
else
{
PlayerInfo[ playerid ][ FalseLogins ]++;
if ( PlayerInfo[ playerid ][ FalseLogins ] >= LOGIN_ATTEMPTS )
{
format(str, sizeof( str ), ">> %s a sido kickeado por [ Fallo Conectarse ]", gPlayers[ playerid ] );
SendClientMessageToAll( COLOR_RED, str );
PlayerInfo[ playerid ][ FalseLogins ] = 0;
Kick( playerid );
}
else
{
SendClientMessageToAll(COLOR_YELLOW,">> %s a introducido la clave incorrecta.", gPlayers[playerid] );
MensajePM( playerid, COLOR_RED, " Error: Clave Incorrecta." );
GameTextForPlayer( playerid, "~o~Clave incorrecta.");
}
}
return 1;
}[/pawn]
Theres other bug, the auto-login bug, when you have the same IP, it dosent login, you have to use the /c conectar CMD to login
System:
[pawn]format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );
loggedin = dini_Int( file, "Login" ), lluip = dini_Get( file, "Ip" );
if ( dini_Exists( file ) )
{
if ( loggedin == 1 && CompariseIp( playerid ) == 1 )
{
new level, stats, nogoto, noloc, cash, szMsg[ 128 ];
level = dini_Int( file, "Level" );
stats = dini_Int( file, "Stats" );
nogoto = dini_Int( file, "NoGoto" );
noloc = dini_Int( file, "NoLoc" );
cash = dini_Int( file, "Cash" );
GetPlayerIp( playerid, IP, 24 );
PlayerInfo[ playerid ][ Logged ] = 1;
PlayerInfo[ playerid ][ Level ] = level;
PlayerInfo[ playerid ][ Stats ] = stats;
PlayerInfo[ playerid ][ NoGoto ] = nogoto;
PlayerInfo[ playerid ][ NoLoc ] = noloc;
MensajePM( playerid, COLOR_GREEN, "Te Has Auto-Logueado!" );
format( szMsg, sizeof( szMsg ), "Nick:[ %s ] Nivel:[ %d ] Estado:[ %s ]", gPlayers[ playerid ], level,StatusTag( level ) );
MensajePM( playerid, COLOR_GREEN, szMsg );
SetPlayerMoney( playerid, 0 );
SetPlayerMoney( playerid, cash );
}
else
{
MensajePM( playerid, COLOR_GREEN, "Porfavor Logueate Para Poder Usar Los Commandos." );
MensajePM( playerid, COLOR_GREEN, "Usa /c conectar Para Loguearse" );
TogglePlayerControllable(playerid, 1);
PlayerInfo[ playerid ][ Logged ] = 0;
}
}
else
{
MensajePM( playerid, COLOR_GREEN, "Tu Nick No Esta Registrado En El Server, Registrate" );
MensajePM( playerid, COLOR_GREEN, "Para Proteger Tu Nick y Poder Usar Los Commandos" );
MensajePM( playerid, COLOR_GREEN, "Usa /c Registrar Para Registrarse" );
GameTextForPlayer( playerid,"~p~RE~x~~y~Gis~w~TRO ~o~NE~q~SECARIO");
PlayerInfo[ playerid ][ Logged ] = 2;
PlayerInfo[ playerid ][ Stats ] = 2;
}
return 1;
}[/pawn]
I have tryed and tryed to fix it but i CANT, dont know whats the problem, pls help, The GM base is Gups by the way