06.07.2012, 07:41
Hi. I need a little help, because I need this for today.
It's about a password system, it's not like normal but specially generated passwords for quiz.
The problem is when I'm entering an invalid password, which is not avaliable. Here's the code, I'll explain.
Print messages are debug - everything works well when I enter a valid password. But when I enter an invalid password, only "1" shows, "2" no (even if it shows 'false' instead of 'true', "3" also don't appear). Problem is with "if(AccountInfoStatistics[LoggedInAs[playerid]][0] == 1)", but I can't see anything wrong with it. When it's valid, it works, but when invalid it doesn't - no sense? The array for it looks good, take a look:
Ok, let's say there's always 0 at start ([0]), so it should say if is invalid and it should do 'else' thing. But it stops here.
I hope someone will find what's wrong here...
It's about a password system, it's not like normal but specially generated passwords for quiz.
The problem is when I'm entering an invalid password, which is not avaliable. Here's the code, I'll explain.
pawn Код:
new bool:IsValidPassword = false;
for(new i = 0; i < MaxAccounts; i++)
{
if(!strcmp(inputtext,AccountInfo[i][1],false))
{
IsValidPassword = true;
LoggedInAs[playerid] = i;
}
}
print("1");
if(AccountInfoStatistics[LoggedInAs[playerid]][0] == 1)
{
print("2");
//Here's an information when I enter a password but I already finished the test (variable changes in the end of test)
}
else
{
print("3");
if(IsValidPassword == false)
{
print("4");
//That problem is here. When I enter an invalid password, this can't show
}
else
{
print("5");
//Here's the code if I enter a valid password and I can start a test. Works well.
}
}
pawn Код:
new AccountInfoStatistics[MaxAccounts][4] =
{
{0, 1, 0, 6},
{0, 1, 0, 12},
{0, 1, 0, 5},
{0, 1, 0, 11},
{0, 1, 0, 6},
{0, 1, 0, 7},
{0, 1, 0, 7},
//etc...
I hope someone will find what's wrong here...