Author Topic: Need help on Login cmd  (Read 3036 times)

0 Members and 1 Guest are viewing this topic.

Offline The_Lucifer

  • Street Thug
  • *
  • Posts: 20
    • View Profile
Need help on Login cmd
« on: May 19, 2014, 05:46:09 am »
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

Offline MatheuS

  • Made Man
  • ***
  • Posts: 207
  • Pawn And Squirrel Scripter
    • View Profile
    • Brazillian Community
Re: Need help on Login cmd
« Reply #1 on: May 19, 2014, 05:27:37 pm »
Code: [Select]
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 );
}
}
    return 1;
}

Pon eso O.o

Offline The_Lucifer

  • Street Thug
  • *
  • Posts: 20
    • View Profile
Re: Need help on Login cmd
« Reply #2 on: May 19, 2014, 10:43:31 pm »
Ya puse el cmd que me pasaste amigo, pero, no se si se arreglo el bug, ya que como dije anteriormente, solo pasa aveses cuando tumban el server o algo, y tambien cuando pones la clave incorrecta no pasa nada, pero no se, Si quieres puedes ir al server para que intentes conectarte sin problema, la ip es 189.182.101.64:8190, gracias por la ayuda :P

Offline The_Lucifer

  • Street Thug
  • *
  • Posts: 20
    • View Profile
Re: Need help on Login cmd
« Reply #3 on: May 19, 2014, 11:56:55 pm »
Sabes amigo creo que si se arreglo el bug, usuarios an entrado y no me an dicho que no reconose las contraseñas, Gracias, y te puse en los creditos :D

Offline The_Lucifer

  • Street Thug
  • *
  • Posts: 20
    • View Profile
Re: Need help on Login cmd
« Reply #4 on: May 20, 2014, 05:27:29 am »
No amigo no se arreglo paso lo mismo de nuevo :s