(107) : warning 213: tag mismatch
#1

hello i wanna create new admin system, but i got that warning

code

pawn Код:
new string[500] , pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string,sizeof(string),"Your Name: %s \nYour Cash: %d",pName,Money);//line 107
ShowPlayerDialog(playerid,dregister+3,DIALOG_STYLE_INPUT,"Status",string,"OKAY");
Reply
#2

Can you show me the creation of the money variable?
Reply
#3

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dregister) //If dialog id is a register dialog
    {//then
        if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
        if(response) //if they clicked the first button "Register"
        {//then
            if(!strlen(inputtext)) //If they didn't enter any password
            {// then we will tell to them to enter the password to register
                ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                return 1;
            }
            //If they have entered a correct password for his/her account...
            new hashpass[129]; //Now we will create a new variable to hash his/her password
            WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to hash their inputted text
            new INI:file = INI_Open(Path(playerid)); // we will open a new file for them to save their account inside of Scriptfiles/Users folder
            INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
            INI_WriteString(file,"Password",hashpass);//This will write a hashed password into user's account
            INI_WriteInt(file,"AdminLevel",0); //Write an integer inside of user's account called "AdminLevel". We will set his level to 0 after he registered.
            INI_WriteInt(file,"VIPLevel",0);//As explained above
            INI_WriteInt(file,"Money",0);//Write an integer inside of user's account called "Money". We will set their money to 0 after he registered
            INI_WriteInt(file,"Scores",0);//Write an integer inside of user's account called "Scores". We will set their score to 0 after he registered
            INI_WriteInt(file,"Kills",0);//As explained above
            INI_WriteInt(file,"Deaths",0);//As explained above
            INI_Close(file);//Now after we've done saving their data, we now need to close the file
            SendClientMessage(playerid,-1,"You have been successfully registered");//Tell to them that they have successfully registered a new account
            return 1;
        }
    }
    if(dialogid == dlogin) //If dialog id is a login dialog
    {//then
        if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
        if(response) //if they clicked the first button "Register"
        {//then
            new hashpass[129]; //Will create a new variable to hash his/her password
            WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
            if(!strcmp(hashpass,pInfo[playerid][Pass])) //If they have insert their correct password
            {//then
                INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account's data from user's path
                SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user's account and we will set it here
                GivePlayerMoney(playerid,pInfo[playerid][Money]);//As explained above
                new string[500] , pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, pName, sizeof(pName));
                format(string,sizeof(string),"Your Name: %s \nYour Cash: %d",pName,Money);
                ShowPlayerDialog(playerid,dregister+3,DIALOG_STYLE_INPUT,"Status",string,"OKAY","LOL");
            }
            else //If they've entered an incorrect password
            {//then
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
                return 1;
            }
        }
    }
    return 1;
}
Reply
#4

change
pawn Код:
format(string,sizeof(string),"Your Name: %s \nYour Cash: %d",pName,Money);//line 107
to
pawn Код:
format(string,sizeof(string),"Your Name: %s Your Cash: %d",pName,Money);//line 107
Reply
#5

nothing. i got same warning
Reply
#6

That won't change anything Ice..

Cause the \n is used for the dialog under it.

Also:

This line :

pawn Код:
ShowPlayerDialog(playerid,dregister+3,DIALOG_STYLE_INPUT,"Status",string,"OKAY");
Should give you a warning..

Right one :

pawn Код:
ShowPlayerDialog(playerid,dregister+3,DIALOG_STYLE_INPUT,"Status",string,"OKAY", "");
Reply
#7

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
change
pawn Код:
format(string,sizeof(string),"Your Name: %s \nYour Cash: %d",pName,Money);//line 107
to
pawn Код:
format(string,sizeof(string),"Your Name: %s Your Cash: %d",pName,Money);//line 107
That is incorrect. That's not what shows the error.

The issue is that Money and pName are not "global mono-dimensional" variables (if that makes any sense?) but they are part of a multi-dimensional enum assigned to each player. In order to call them, you have to use pInfo[playerid][pName] and pInfo[playerid][Money] instead of pName and Money.

This should be correct:
pawn Код:
format(string,sizeof(string),"Your Name: %s \nYour Cash: %d", pInfo[playerid][pName], pInfo[playerid][Money]);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)