Problems with Whirlpool
#1

You see, when I do give the correct password, it will say incorrect password.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case RegisterDialog:
        {
            new Name[MAX_PLAYER_NAME], File[256];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(File, sizeof(File), UserFile, Name);
            if(!response)
            {
                printf("**%s(Id:%i) has been kicked. Reason: Failed to login.", Name, playerid);
                Kick(playerid);
            }
            else if(!strlen(inputtext))
            {
                SendError(playerid, "You must input a password!");
            }
            else
            {
                new LoginMsg[128], RegisterMsg[128], PassBuffer[129];
                DOF2_CreateFile(File);
                WP_Hash(PassBuffer, sizeof(PassBuffer), inputtext);
                DOF2_SetString(File, "Password", PassBuffer);
                DOF2_SetInt(File, "AdminLevel", 0);
                DOF2_SetInt(File, "VIPLevel", 0);
                DOF2_SetInt(File, "Score", 0);
                DOF2_SetInt(File, "Cash", 0);
                DOF2_SetInt(File, "Jailed", 0);
                DOF2_SetInt(File, "JailTime", 0);
                DOF2_SetInt(File, "Muted", 0);
                DOF2_SetInt(File, "MuteTime", 0);
                DOF2_SetInt(File, "Frozen", 0);
                DOF2_SetInt(File, "FreezeTime", 0);
                DOF2_SaveFile();
                format(LoginMsg, sizeof(LoginMsg), "[JOIN]:{FFFFFF} %s(Id:%i) has just made a account! Welcome them to the server!", Name, playerid);
                format(RegisterMsg, sizeof(RegisterMsg), "You have created the account {80FF00}%s{FFFFFF} under the password {FF8000}%s", Name, inputtext);
                SendClientMessageToAll(COLOR_GREEN, LoginMsg);
                SendClientMessage(playerid, COLOR_WHITE, RegisterMsg);
                printf("**%s(Id:%i) has just created a account!", Name, playerid);
                PlayerLogged[playerid] = 1;
            }
        }
        case LoginDialog:
        {
            new Name[MAX_PLAYER_NAME], File[256], PassBuffer[129];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(File, sizeof(File), UserFile, Name);
            if(!response)
            {
                printf("**%s(Id:%i) has been kicked. Reason: Failed to login.", Name, playerid);
                Kick(playerid);
            }
            else if(!strlen(inputtext))
            {
                SendError(playerid, "You must input a password!");
            }
            else if(WP_Hash(PassBuffer, sizeof(PassBuffer), inputtext) == DOF2_GetInt(File, "Password"))
            {
                new LoginMsg[128], WelcomeMsg[128];
                PlayerInfo[playerid][AdminLevel] = DOF2_GetInt(File, "AdminLevel");
                PlayerInfo[playerid][VIPLevel] = DOF2_GetInt(File, "VIPLevel");
                SetPlayerScore(playerid, DOF2_GetInt(File, "Score"));
                SetPlayerMoney(playerid, DOF2_GetInt(File, "Cash"));
                PlayerInfo[playerid][Jailed] = DOF2_GetInt(File, "Jailed");
                PlayerInfo[playerid][JailTime] = DOF2_GetInt(File, "JailTime");
                PlayerInfo[playerid][Muted] = DOF2_GetInt(File, "Muted");
                PlayerInfo[playerid][MuteTime] = DOF2_GetInt(File, "MuteTime");
                PlayerInfo[playerid][Frozen] = DOF2_GetInt(File, "Frozen");
                PlayerInfo[playerid][FreezeTime] = DOF2_GetInt(File, "FreezeTime");
                format(LoginMsg, sizeof(LoginMsg), "[JOIN]:{FFFFFF} %s(Id:%i) has joined the server! Welcome back!", Name, playerid);
                format(WelcomeMsg, sizeof(WelcomeMsg), "Welcome back {80FF00}%s{FFFFFF}. Your stats are: Money: %d, Score: %d, VIP: %d, Admin: %d", Name, GetPlayerMoney(playerid), GetPlayerScore(playerid), ReturnYesNo(PlayerInfo[playerid][VIPLevel]), ReturnYesNo(PlayerInfo[playerid][AdminLevel]));
                SendClientMessageToAll(COLOR_GREEN, LoginMsg);
                SendClientMessage(playerid, COLOR_WHITE, WelcomeMsg);
                printf("**%s(Id:%i) has logged in!", Name, playerid);
                PlayerLogged[playerid] = 1;
            }
            else
            {
                SendError(playerid, "Wrong password!");
                printf("**%s(Id:%i) has been kicked. Reason: Wrong password.", Name, playerid);
                Kick(playerid);
            }
        }
    }
    return 1;
}
Help?
Reply
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case RegisterDialog:
        {
            new Name[MAX_PLAYER_NAME], File[256];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(File, sizeof(File), UserFile, Name);
            if(!response)
            {
                printf("**%s(Id:%i) has been kicked. Reason: Failed to login.", Name, playerid);
                Kick(playerid);
            }
            else if(!strlen(inputtext))
            {
                SendError(playerid, "You must input a password!");
            }
            else
            {
                new LoginMsg[128], RegisterMsg[128], PassBuffer[129];
                DOF2_CreateFile(File);
                WP_Hash(PassBuffer, sizeof(PassBuffer), inputtext);
                DOF2_SetString(File, "Password", PassBuffer);
                DOF2_SetInt(File, "AdminLevel", 0);
                DOF2_SetInt(File, "VIPLevel", 0);
                DOF2_SetInt(File, "Score", 0);
                DOF2_SetInt(File, "Cash", 0);
                DOF2_SetInt(File, "Jailed", 0);
                DOF2_SetInt(File, "JailTime", 0);
                DOF2_SetInt(File, "Muted", 0);
                DOF2_SetInt(File, "MuteTime", 0);
                DOF2_SetInt(File, "Frozen", 0);
                DOF2_SetInt(File, "FreezeTime", 0);
                DOF2_SaveFile();
                format(LoginMsg, sizeof(LoginMsg), "[JOIN]:{FFFFFF} %s(Id:%i) has just made a account! Welcome them to the server!", Name, playerid);
                format(RegisterMsg, sizeof(RegisterMsg), "You have created the account {80FF00}%s{FFFFFF} under the password {FF8000}%s", Name, inputtext);
                SendClientMessageToAll(COLOR_GREEN, LoginMsg);
                SendClientMessage(playerid, COLOR_WHITE, RegisterMsg);
                printf("**%s(Id:%i) has just created a account!", Name, playerid);
                PlayerLogged[playerid] = 1;
            }
        }
        case LoginDialog:
        {
            new Name[MAX_PLAYER_NAME], File[256], PassBuffer[129];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(File, sizeof(File), UserFile, Name);
            if(!response)
            {
                printf("**%s(Id:%i) has been kicked. Reason: Failed to login.", Name, playerid);
                Kick(playerid);
            }
            else if(!strlen(inputtext))
            {
                SendError(playerid, "You must input a password!");
            }
            WP_Hash(PassBuffer, sizeof(PassBuffer), inputtext);
            else if( !strcmp ( PassBuffer, DOF2_GetString(File, "Password" ) ) )
            {
                new LoginMsg[128], WelcomeMsg[128];
                PlayerInfo[playerid][AdminLevel] = DOF2_GetInt(File, "AdminLevel");
                PlayerInfo[playerid][VIPLevel] = DOF2_GetInt(File, "VIPLevel");
                SetPlayerScore(playerid, DOF2_GetInt(File, "Score"));
                SetPlayerMoney(playerid, DOF2_GetInt(File, "Cash"));
                PlayerInfo[playerid][Jailed] = DOF2_GetInt(File, "Jailed");
                PlayerInfo[playerid][JailTime] = DOF2_GetInt(File, "JailTime");
                PlayerInfo[playerid][Muted] = DOF2_GetInt(File, "Muted");
                PlayerInfo[playerid][MuteTime] = DOF2_GetInt(File, "MuteTime");
                PlayerInfo[playerid][Frozen] = DOF2_GetInt(File, "Frozen");
                PlayerInfo[playerid][FreezeTime] = DOF2_GetInt(File, "FreezeTime");
                format(LoginMsg, sizeof(LoginMsg), "[JOIN]:{FFFFFF} %s(Id:%i) has joined the server! Welcome back!", Name, playerid);
                format(WelcomeMsg, sizeof(WelcomeMsg), "Welcome back {80FF00}%s{FFFFFF}. Your stats are: Money: %d, Score: %d, VIP: %d, Admin: %d", Name, GetPlayerMoney(playerid), GetPlayerScore(playerid), ReturnYesNo(PlayerInfo[playerid][VIPLevel]), ReturnYesNo(PlayerInfo[playerid][AdminLevel]));
                SendClientMessageToAll(COLOR_GREEN, LoginMsg);
                SendClientMessage(playerid, COLOR_WHITE, WelcomeMsg);
                printf("**%s(Id:%i) has logged in!", Name, playerid);
                PlayerLogged[playerid] = 1;
            }
            else
            {
                SendError(playerid, "Wrong password!");
                printf("**%s(Id:%i) has been kicked. Reason: Wrong password.", Name, playerid);
                Kick(playerid);
            }
        }
    }
    return 1;
}
Reply
#3

Код:
C:\DOCUME~1\Ed\MYDOCU~1\SA-MPH~1\Server\GAMEMO~1\HIGHWA~1.PWN(387) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Ed\MYDOCU~1\SA-MPH~1\Server\GAMEMO~1\HIGHWA~1.PWN(387) : warning 215: expression has no effect
C:\DOCUME~1\Ed\MYDOCU~1\SA-MPH~1\Server\GAMEMO~1\HIGHWA~1.PWN(387) : error 001: expected token: ";", but found "if"
C:\DOCUME~1\Ed\MYDOCU~1\SA-MPH~1\Server\GAMEMO~1\HIGHWA~1.PWN(387) : error 035: argument type mismatch (argument 2)
C:\DOCUME~1\Ed\MYDOCU~1\SA-MPH~1\Server\GAMEMO~1\HIGHWA~1.PWN(387) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
else if( !strcmp ( PassBuffer, DOF2_GetInt(File, "Password" ) ) )
Reply
#4

You write the password as a string, but load it as an integer.

else if ( !strcmp ( PassBuffer, DOF2_GetInt(File, "Password" ) ) )

Should be:

else if ( !strcmp ( PassBuffer, DOF2_GetString(File, "Password" ) ) )
Reply
#5

Ok, I swapped GetInt for GetString.

This is now what I have.

Код:
C:\DOCUME~1\Ed\MYDOCU~1\SA-MPH~1\Server\GAMEMO~1\HIGHWA~1.PWN(402) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Ed\MYDOCU~1\SA-MPH~1\Server\GAMEMO~1\HIGHWA~1.PWN(402) : warning 215: expression has no effect
C:\DOCUME~1\Ed\MYDOCU~1\SA-MPH~1\Server\GAMEMO~1\HIGHWA~1.PWN(402) : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Still same line.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)