Strange? What's Wrong With This
#1

Something's not working in my OnPlayerLogin function, When you join the server you will get a dialog saying to login, When you type it in(Your password, whtever) Nothing happens. Code Below for (OnPlayerLogin):

Код:
public OnPlayerLogin(playerid,password[])
{
  new string2[128];
  new name[MAX_PLAYER_NAME], string[48];
  GetPlayerName(playerid, name, sizeof(name));
	format(string2, sizeof(string2), "South-WestRP/%s.ini", name);
	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 , "Key" , true ) == 0 )
		{
			valtmp = ini_GetValue( PassData );
			strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
		}
		if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
		{
			  new key[ 256 ] , val[ 256 ];
			  new Data[ 256 ];
			  while ( fread( UserFile , Data , sizeof( Data ) ) )
				{
					key = ini_GetKey( Data );
					if( strcmp( key , "Age" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAge] = strval( val ); }
					if( strcmp( key , "Religon" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pReligon] = strval( val ); }
        }
        fclose(UserFile);
		}
		else
		{

			ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login to your account","Note - A account with this name was found inside the database,\n If this is your account,type in your password\n if not press cancel!","Login","Cancel");
		  SendClientMessage(playerid, 0xFFFFFFFF, "Password does not match the username!");
		  LoginTry[playerid] += 1;
		  if(LoginTry[playerid] == MAX_TRY)
		  {
		    SendClientMessage(playerid, COLOR_SYSTEM, "-------------------------------");
		    SendClientMessage(playerid, COLOR_SYSTEM, "    You Were Banned     ");
		    SendClientMessage(playerid, COLOR_SYSTEM, "Admin who banned you - SYSTEM");
		    SendClientMessage(playerid, COLOR_SYSTEM, "Reason - Failure to login to account maximum times");
		    SendClientMessage(playerid, COLOR_SYSTEM, "Type - Perma. Ban");
		    SendClientMessage(playerid, COLOR_SYSTEM, "   Press F8 to take a picture of this");
		    SendClientMessage(playerid, COLOR_SYSTEM, "-------------------------------");
		    BanEx(playerid, "Failure to login 3 times");
		  }
	    fclose(UserFile);
	    return 1;
		}
	}
	return 1;
}
'

Here is the code on OnDialogResponse
Код:
if(dialogid == 2)
  {
    if(!strlen(inputtext))
    {
      SendClientMessage(playerid, 0xFFFFFFFF, "Your Password Cannot be left Blank");
      return 1;
    }
    if(!response){ SendClientMessage(playerid, 0xFFFFFFFF, "You canceled!"); Kick(playerid); return 0; }
    OnPlayerLogin(playerid,inputtext);
	}
Reply


Messages In This Thread
Strange? What's Wrong With This - by Eazy_Efolife - 05.12.2009, 23:50
Re: Strange? What's Wrong With This - by Grim_ - 05.12.2009, 23:58
Re: Strange? What's Wrong With This - by Correlli - 05.12.2009, 23:59
Re: Strange? What's Wrong With This - by Eazy_Efolife - 06.12.2009, 00:03
Re: Strange? What's Wrong With This - by Correlli - 06.12.2009, 00:04
Re: Strange? What's Wrong With This - by Grim_ - 06.12.2009, 00:06
Re: Strange? What's Wrong With This - by Eazy_Efolife - 06.12.2009, 00:12
Re: Strange? What's Wrong With This - by Eazy_Efolife - 06.12.2009, 01:36

Forum Jump:


Users browsing this thread: 1 Guest(s)