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; }
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); }
if(dialogid == 2)
{
if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Your Password Cannot be left Blank");
return 1;
}
OnPlayerLogin(playerid, inputtext);
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You canceled!");
Kick(playerid);
}
}
Originally Posted by Don Correlli
Try this:
pawn Код:
|
Originally Posted by _Xerxes_
It seems that your password your entering (or the password it is returning) is incorrect, since the only place that OnPlayerLogin wouldn't do anything, is after the password is incorrect. (It would only close the file, thus no indication)
|
Originally Posted by Don Correlli
Then try to debug your dialog-code and OnPlayerLogin callback.
|
if ( UserFile ) {
new File: UserFile = fopen(string2, io_read); if ( UserFile ) {