18.12.2009, 19:11
hey im using this FS: http://forum.sa-mp.com/index.php?topic=122308.0
but it dont register dont happen nothing can any guy say to me what is the problem....
here is my code:
but it dont register dont happen nothing can any guy say to me what is the problem....
here is my code:
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (response == 1)
{
if(dialogid == 12345)
{
if(strlen(inputtext))
{
Encrypt(inputtext);
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, 50);
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), ACCOUNTS_FOLDER, playername3);
new ip[20];
GetPlayerIp(playerid,ip,sizeof(ip));
new File: hFile = fopen(string3, io_write);
if (hFile)
{
strmid(PlayerInfo[playerid][aPassword], inputtext, 0, strlen(inputtext), 255);
new var[128];
format(var, 128, "Password == %s\n", PlayerInfo[playerid][aPassword]);fwrite(hFile, var);
format(var, 128, "Kills == %d\r\n", PlayerInfo[playerid][pKills]);fwrite(hFile, var);
format(var, 128, "Deaths == %d\r\n", PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
format(var, 128, "Money == %d\r\n", PlayerInfo[playerid][pCash]);fwrite(hFile, var);
format(var, 128, "BankMoney == %d\r\n", PlayerInfo[playerid][pBank]);fwrite(hFile, var);
format(var, 128, "Team == %d\r\n", PlayerInfo[playerid][pTeam]);fwrite(hFile, var);
format(var, 128, "Banned == %d\r\n", PlayerInfo[playerid][pBanned]);fwrite(hFile, var);
format(var, 128, "Level == %d\r\n", PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 128, "Exp == %d\r\n", PlayerInfo[playerid][pExp]);fwrite(hFile, var);
format(var, 128, "Menber == %d\r\n", PlayerInfo[playerid][pMember]);fwrite(hFile, var);
format(var, 128, "Admin == %d\r\n", PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
format(var, 128, "Rank == %d\r\n", PlayerInfo[playerid][pRank]);fwrite(hFile, var);
format(var, 128, "Leader == %d\r\n", PlayerInfo[playerid][pLeader]);fwrite(hFile, var);
format(var, 128, "FailLogin == %d\r\n", PlayerInfo[playerid][FailLogin]);fwrite(hFile, var);
format(var, 128, "PlayerING == %d\r\n", PlayerInfo[playerid][PlayerING]);fwrite(hFile, var);
format(var, 128, "PlayerPT == %d\r\n", PlayerInfo[playerid][PlayerPT]);fwrite(hFile, var);
format(var, 128, "Int == %d\r\n", PlayerInfo[playerid][pInt]);fwrite(hFile, var);
format(var, 128, "Local == %d\r\n", PlayerInfo[playerid][pLocal]);fwrite(hFile, var);
format(var, 128, "HouseKey == %d\r\n", PlayerInfo[playerid][pPhousekey]);fwrite(hFile, var);
format(var, 128, "BisKey == %d\r\n", PlayerInfo[playerid][pPbiskey]);fwrite(hFile, var);
fclose(hFile);
printf("%s is signed up.",playername3);
SendClientMessage(playerid, GREEN, "|- Have you registered. You can login now. -|");
new girismsg[256];
format(girismsg,256,"Welcome to the server\n\nUser Name: %s\n\nEnter your password:",playername3);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
register[playerid] = 0;
login[playerid] = 1;
}
}
else if(!strlen(inputtext))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new kayitmsg[256];
format(kayitmsg,256,"Welcome to the server\n\n%s please open a new account\n\nEnter the new password:",name);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",kayitmsg,"Register","Quit");
register[playerid] = 1;
login[playerid] = 0;
}
}
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 , "Password" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][aPassword], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][aPassword],inputtext, true ) == 0)
{
if(strlen(inputtext))
{
for(new p = 0; p < strlen(PlayerInfo[playerid][aPassword]); p++)
{
inputtext[p] = '?';
}
SetTimerEx("LogIn", LOGIN_DELAY*1000, 0, "d", playerid);
printf("%s is logged in.",playername2);
new key[256] , val[256];
new Data[256];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
if( strcmp( key , "BankMoney" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
if( strcmp( key , "Team" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTeam] = strval( val ); }
if( strcmp( key , "Banned" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBanned] = strval( val ); }
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
if( strcmp( key , "Exp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
if( strcmp( key , "Menber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMember] = strval( val ); }
if( strcmp( key , "Admin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
if( strcmp( key , "Leader" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLeader] = strval( val ); }
if( strcmp( key , "FailLogin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][FailLogin] = strval( val ); }
if( strcmp( key , "PlayerING" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][PlayerING] = strval( val ); }
if( strcmp( key , "PlayerPT" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][PlayerPT] = strval( val ); }
if( strcmp( key , "Int" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pInt] = strval( val ); }
if( strcmp( key , "Local" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLocal] = strval( val ); }
if( strcmp( key , "HouseKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhousekey] = strval( val ); }
if( strcmp( key , "BisKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPbiskey] = strval( val ); }
}
fclose(UserFile);
}
}
else
{
if(strlen(inputtext))
{
new girismsg[256];
printf("%s is used the wrong password.",playername2);
format(girismsg,256,"WRONG PASSWORD\n\nPlease enter your password:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
if(!strlen(inputtext))
{
new girismsg[256];
printf("%s did not enter the password.",playername2);
format(girismsg,256,"WRONG PASSWORD\n\nPlease enter your password:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
}
if(dialogid == 12347)
{
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 , "Password" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][aPassword], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][aPassword],inputtext, true ) == 0)
{
if(strlen(inputtext))
{
for(new p = 0; p < strlen(PlayerInfo[playerid][aPassword]); p++)
{
inputtext[p] = '?';
}
SetTimerEx("LogIn", LOGIN_DELAY*1000, 0, "d", playerid);
printf("%s is logged in.",playername2);
new key[256] , val[256];
new Data[256];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
if( strcmp( key , "BankMoney" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
if( strcmp( key , "Team" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTeam] = strval( val ); }
if( strcmp( key , "Banned" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBanned] = strval( val ); }
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
if( strcmp( key , "Exp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
if( strcmp( key , "Menber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMember] = strval( val ); }
if( strcmp( key , "Admin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
if( strcmp( key , "Leader" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLeader] = strval( val ); }
if( strcmp( key , "FailLogin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][FailLogin] = strval( val ); }
if( strcmp( key , "PlayerING" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][PlayerING] = strval( val ); }
if( strcmp( key , "PlayerPT" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][PlayerPT] = strval( val ); }
if( strcmp( key , "Int" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pInt] = strval( val ); }
if( strcmp( key , "Local" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLocal] = strval( val ); }
if( strcmp( key , "HouseKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhousekey] = strval( val ); }
if( strcmp( key , "BisKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPbiskey] = strval( val ); }
}
fclose(UserFile);
}
}
else
{
if(strlen(inputtext))
{
new girismsg[256];
printf("%s is used the wrong password.",playername2);
format(girismsg,256,"WRONG PASSWORD\n\nPlease enter your password:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
if(!strlen(inputtext))
{
new girismsg[256];
printf("%s did not enter the password.",playername2);
format(girismsg,256,"WRONG PASSWORD\n\nPlease enter your password:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
}
}
else return Kick(playerid);