Login Dialog problem
#1

Alright all the errors have been fixed, but now register system works but when you try to login with your password it says its incorrect but if you don't fill in anything at all and click login you will just login. So this the code we use:

pawn Код:
case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                //if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                if(strlen(inputtext) == PInfo[playerid][Password]) {
                //if(strcmp(inputtext, PInfo[playerid][Password])) {
                    new file[64], password2[23], PlayerName[24];
                    GetPlayerName(playerid,PlayerName,sizeof PlayerName);
                    format(file,sizeof file,"Admin/%s.ini",PlayerName);
                    INI_Open(file);//Opening the file with SII include
                    INI_ReadString(password2,"Password");
                    PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
                    PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player
                    PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player
                    INI_Close();//"Closing the file", that means that we're not using it anymore :P
                    SendClientMessage(playerid,-1,"You have been successfully logged in!");
                    PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
                    SetPlayerScore(playerid, PInfo[playerid][Score]);
                    GivePlayerMoney(playerid, PInfo[playerid][Money]);
                } else {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
Reply
#2

Show me you definition 'COLOR_WHITE' please, also, which line is line 377?
Reply
#3

"COLOR_WHITE" is not the problem, in your case it looks like you missed out a ";" at a end of a function.
Show more code above this one
Reply
#4

Quote:
Originally Posted by ikkentim
Посмотреть сообщение
Show me you definition 'COLOR_WHITE' please, also, which line is line 377?
Код:
#define COLOR_WHITE 0xFFFFFFFF
and this is line 377

Код:
ShowPlayerDialog(playerid, 997, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Register Below", ""COLOR_WHITE"Enter A Password To Register And Play!", "Register", "Quit");
And for the other guy

Код:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid,-1,"Welcome to United Kingdom TDM! Dont forget to check /updates ! ");
    new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "** %s has joined United Kingdom TDM", name);
    IsOnAdminDuty[playerid] = false;
    SendClientMessageToAll(-1, string);
    PMEnabled[playerid] = 1;

    new file[64],PlayerName[25];//Creating a variable where we can store the file path, and the variable to store the player's name.
    GetPlayerName(playerid,PlayerName,sizeof PlayerName);//Storing the players name in the PlayerName variable.
    format(file,sizeof file,"Admin/%s.ini",PlayerName);//Storing the file path with the players name.
    if(!fexist(file)) {
        format(file,sizeof file,"Admin/%s.ini",PlayerName);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Login Below", "Enter Your Password To Login!", "Login", "Quit");
        //ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Soldier Class\nSniper Class\nEngineer Class\nJet-Trooper Class\nPilot Class\nSpy Class", "Choose","");
    } else {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Register Below", ""COLOR_WHITE"Enter A Password To Register And Play!", "Register", "Quit");
    }
    return 1;
}
Reply
#5

COLOR_WHITE was in fact your problem. These are very capable of causing these errors, as for implementation, they need to be in the form of {FFFFFF} rather than hexadecimal values such as 0xFFFFFFFF. Therefore, just change the line to:

pawn Код:
#define COLOR_WHITE {FFFFFF}
Reply
#6

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
COLOR_WHITE was in fact your problem. These are very capable of causing these errors, as for implementation, they need to be in the form of {FFFFFF} rather than hexadecimal values such as 0xFFFFFFFF. Therefore, just change the line to:

pawn Код:
#define COLOR_WHITE {FFFFFF}
Now getting alot more errors

Код:
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(946) : error 017: undefined symbol "UserPath"
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(946) : warning 213: tag mismatch
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(947) : error 017: undefined symbol "INI_SetTag"
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(948) : error 035: argument type mismatch (argument 1)
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(949) : error 035: argument type mismatch (argument 1)
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(950) : error 035: argument type mismatch (argument 1)
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(951) : error 035: argument type mismatch (argument 1)
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(952) : error 035: argument type mismatch (argument 1)
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(953) : warning 202: number of arguments does not match definition
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(946) : warning 204: symbol is assigned a value that is never used: "File"
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(964) : error 017: undefined symbol "udb_hash"
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(964) : warning 215: expression has no effect
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(964) : error 001: expected token: ";", but found "]"
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(964) : error 029: invalid expression, assumed zero
C:\Users\Han\Desktop\UKTDM\gamemodes\UKTDM.pwn(964) : fatal error 107: too many error messages on one line
Reply
#7

undefined symbol "FFFFFF"
Where are you getting this from? Show your define line and your ShowPlayerDialog lines.
Reply
#8

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
undefined symbol "FFFFFF"
Where are you getting this from? Show your define line and your ShowPlayerDialog lines.
Nvm i got 1 error left cant seem to find what the Password is for me

Код:
if(udb_hash(inputtext) == PInfo[playerid][Password] == 1) {
Reply
#9

What you are doing there is comparing three different things at the same time.. (at that line)..
If you really want to compare two strings, then use strcmp..

Edit: if you want to compare more than one thing, use &&... Or || ...
Example:
PHP код:
if(PStats[playerid][Admin] > && PStats[playerid][AdminLoggedIn] == 1) return SendClientMessage(playerid, -"You are logged in already!"); 
Reply
#10

Quote:
Originally Posted by Kaaajmak
Посмотреть сообщение
What you are doing there is comparing three different things at the same time.. (at that line)..
If you really want to compare two strings, then use strcmp..
I got now all errors fixed

trying to get an dialog login expect of commands

my dialogues
Код:
        case DIALOG_REGISTER: {
            if (!response) return Kick(playerid);
            if(response) {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register Below","Wrong Password!\nEnter Password To Play!","Register","Quit");
                    new file[64], PlayerName[24], password[23];
					format(file,sizeof file,"Admin/%s.ini",PlayerName);
    				INI_Open(file);
    				INI_WriteString("Password",password);
    				INI_WriteInt("Level",0);
   					INI_WriteInt("Score",0);
    				INI_WriteInt("Money",15000);
    				INI_Save();
    				INI_Close();
    				SendClientMessage(playerid,-1,"You have successfully registered!");
    				GivePlayerMoney(playerid, 15000); //WHEN YOU LOG OUT IT WILL GET SAVED
                	ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","Your Account Is Now In Our Database! Thanks For Registering","Ok","");
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                //if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                if(udb_hash(inputtext) == PInfo[playerid][Password]) {
					new file[64], password2[23];
                    INI_Open(file);//Opening the file with SII include
    				INI_ReadString(password2,"Password");
    				PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
    				PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player
    				PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player
    				INI_Close();//"Closing the file", that means that we're not using it anymore :P
    				SendClientMessage(playerid,-1,"You have been successfully logged in!");
    				PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
                } else {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
my old commands
Код:
CMD:register(playerid,params[])
{
    if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,-4,"You are already logged in!");
    new password[23];
    if(sscanf(params,"s[23]",password)) return SendClientMessage(playerid,-1,"USAGE: /register <password>");
    new file[64],PlayerName[24];
    GetPlayerName(playerid,PlayerName,sizeof PlayerName);
    format(file,sizeof file,"Admin/%s.ini",PlayerName);
    if(fexist(file)) return SendClientMessage(playerid,-4,"Somehow you're already registered!");
    INI_Open(file);
    INI_WriteString("Password",password);
    INI_WriteInt("Level",0);
    INI_WriteInt("Score",0);
    INI_WriteInt("Money",15000);
    INI_Save();
    INI_Close();
    SendClientMessage(playerid,-1,"You have successfully registered!");
    GivePlayerMoney(playerid, 15000); //WHEN YOU LOG OUT IT WILL GET SAVED
    PInfo[playerid][Logged] = 1;
    return 1;
}

CMD:login(playerid,params[])
{
    if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,-4,"You are already logged in!");//Checking if the player is logged in, if he is, it won't allow him to login
    new password[23],password2[23];//Creating a variable to store the password, and another one to store the password from the user's file.
    if(sscanf(params,"s[23]",password)) return SendClientMessage(playerid,-1,"USAGE: /login <password>");//Here we're checking if the player inputs any password, if not, it will return to him a message saying the proper usage.
    new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
    GetPlayerName(playerid,PlayerName,sizeof PlayerName);
    format(file,sizeof file,"Admin/%s.ini",PlayerName);
    if(!fexist(file)) return SendClientMessage(playerid,-4,"Please use /register");//Checking if the player is  not registered, again....
    INI_Open(file);//Opening the file with SII include
    INI_ReadString(password2,"Password");
    if(strcmp(password,password2) != 0) return SendClientMessage(playerid,-4,"Wrong password!"),INI_Close();//Checking if he inputted the correct password, if not, retrieve him a message and closing the file;
    PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
    PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player
    PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player
    INI_Close();//"Closing the file", that means that we're not using it anymore :P
    SetPlayerScore(playerid, PInfo[playerid][Score]);
    GivePlayerMoney(playerid, PInfo[playerid][Money]);
    SendClientMessage(playerid,-1,"You have been successfully logged in!");
    PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)