SA-MP Forums Archive
Errors of login - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Errors of login (/showthread.php?tid=430412)



Errors of login - DerickClark - 13.04.2013

it gave me alots of Errors
Код:
warning 219: local variable "Name" shadows a variable at a preceding level
Код:
// Process the login-dialog
Dialog_Login(playerid, response, inputtext[])
{
    switch (response) // Check which button was clicked
    {
        case 1: // Player clicked "Login"
        {
            // Check if the player entered a password
            if (strlen(inputtext) > 0)
            {
                // Check if the entered password is the same as the password saved in the player's account
                if (strcmp(APlayerData[playerid][PlayerPassword], inputtext, false) == 0)
                {
                    APlayerData[playerid][LoggedIn] = true; // The player has logged in properly
                    BankFile_Load(playerid); // Load your bank account (if it exists, the player will be notified about this)
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_LoggedIn); // Send a message to the client to inform him that he logged in properly
                }
                else
                {
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                    Kick(playerid);
                }
            }
            else
            {
            new strs[256];
            FailLogin[playerid]++;
            format(string, sizeof(string), "The password you have entered was incorrect. Attempts(%d)", FailLogin[playerid]);
            ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login",strs,"Login","Cancel");
            if(FailLogin[playerid] == MAX_FAIL_LOGINS)
            {
            new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)",Name(playerid) );
            SendClientMessageToAll(-1, string);
            Kick(playerid);
            }
            }
        }
        case 0: // Player clicked "Cancel"
        {
            // Show a message that the player must be logged in to play on this server
            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);
            // Kick the player
            Kick(playerid);
        }
    }
    return 1;
}



Re: Errors of login - Isolated - 13.04.2013

Where ever you have "name" Defined.. Change it to "pName" then use it where it is needed. Basically it's outputting that you have used it, redefined it, then used it.


Re: Errors of login - DerickClark - 13.04.2013

Код:
Thanks for the alots of errors but i got error

error 017: undefined symbol "string"
error 017: undefined symbol "string"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

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


4 Errors.



Re: Errors of login - Isolated - 13.04.2013

pawn Код:
new string[size];
Wherever you use the string definition.


Re: Errors of login - SilverKiller - 13.04.2013

I think the error is in this line :

pawn Код:
format(string, sizeof(string), "The password you have entered was incorrect, Attempts(%d)",FailLogin[playerid]);
Change it to :

pawn Код:
format(strs, sizeof(strs), "The password you have entered was incorrect, Attempts(%d)",FailLogin[playerid]);



Re: Errors of login - DerickClark - 13.04.2013

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
I think the error is in this line :

pawn Код:
format(string, sizeof(string), "The password you have entered was incorrect, Attempts(%d)",FailLogin[playerid]);
Change it to :

pawn Код:
format(strs, sizeof(strs), "The password you have entered was incorrect, Attempts(%d)",FailLogin[playerid]);
Код:
error 076: syntax error in the expression, or invalid function call
error 017: undefined symbol "pName"
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Derick\Desktop\Natural Trucking\pawno\include\PPC_Dialogs.inc(714) : warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Edit:
i delete it 
i got dis
// Process the login-dialog
Код:
Dialog_Login(playerid, response, inputtext[])
{
    switch (response) // Check which button was clicked
    {
        case 1: // Player clicked "Login"
        {
            // Check if the player entered a password
            if (strlen(inputtext) > 0)
            {
                // Check if the entered password is the same as the password saved in the player's account
                if (strcmp(APlayerData[playerid][PlayerPassword], inputtext, false) == 0)
                {
                    APlayerData[playerid][LoggedIn] = true; // The player has logged in properly
                    BankFile_Load(playerid); // Load your bank account (if it exists, the player will be notified about this)
                }
                else
                {
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                    Kick(playerid);
                }
            }
            else
            {
            new strs[256];
            FailLogin[playerid]++;
            format(string, sizeof(string), "The password you have entered was incorrect. Attempts(%d)", FailLogin[playerid]);
            ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login",strs,"Login","Cancel");
            if(FailLogin[playerid] == MAX_FAIL_LOGINS)
            {
            new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)",pName(playerid) );
            SendClientMessageToAll(-1, string);
            Kick(playerid);
            }
            }
        }
        case 0: // Player clicked "Cancel"
        {
            // Show a message that the player must be logged in to play on this server
            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);
            // Kick the player
            Kick(playerid);
        }
    }

    return 1;
}
Код:
error 017: undefined symbol "string"
error 017: undefined symbol "string"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

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


4 Errors.
2 Errors.



Re: Errors of login - SilverKiller - 13.04.2013

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Код:
error 076: syntax error in the expression, or invalid function call
error 017: undefined symbol "pName"
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Derick\Desktop\Natural Trucking\pawno\include\PPC_Dialogs.inc(714) : warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
warning 219: local variable "pName" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Edit:
i delete it 
i got dis
// Process the login-dialog
Код:
Dialog_Login(playerid, response, inputtext[])
{
    switch (response) // Check which button was clicked
    {
        case 1: // Player clicked "Login"
        {
            // Check if the player entered a password
            if (strlen(inputtext) > 0)
            {
                // Check if the entered password is the same as the password saved in the player's account
                if (strcmp(APlayerData[playerid][PlayerPassword], inputtext, false) == 0)
                {
                    APlayerData[playerid][LoggedIn] = true; // The player has logged in properly
                    BankFile_Load(playerid); // Load your bank account (if it exists, the player will be notified about this)
                }
                else
                {
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                    Kick(playerid);
                }
            }
            else
            {
            new strs[256];
            FailLogin[playerid]++;
            format(string, sizeof(string), "The password you have entered was incorrect. Attempts(%d)", FailLogin[playerid]);
            ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login",strs,"Login","Cancel");
            if(FailLogin[playerid] == MAX_FAIL_LOGINS)
            {
            new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)",pName(playerid) );
            SendClientMessageToAll(-1, string);
            Kick(playerid);
            }
            }
        }
        case 0: // Player clicked "Cancel"
        {
            // Show a message that the player must be logged in to play on this server
            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);
            // Kick the player
            Kick(playerid);
        }
    }

    return 1;
}
Код:
error 017: undefined symbol "string"
error 017: undefined symbol "string"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

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


4 Errors.
2 Errors.
Show the error line.


Re: Errors of login - DerickClark - 14.04.2013

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
Show the error line.
i think it's the

Код:
format(string, sizeof(string), "The password you have entered was incorrect. Attempts(%d)", FailLogin[playerid]);
and

Код:
SendClientMessageToAll(-1, string);
i think it's dis

Код:
            new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)",pName(playerid) );