Annoying Tag Mismatch
#1

Hi, i'm having trouble with Floats and tag mismatch. I have an INI account system which works like this for example:

For an integer:
Store: Takes integer, converts it to string, and saves it as a string in INI file
Load: Takes string in INI file, converts it back to an integer using strval, and returns.

For a float I tried the same process:
Store: Takes float, converts it to string, and saves it as a string in INI file
Load: Takes string in INI file, converts it back to a float using floatstr, and returns.

However I am getting a tag mismatches for returning the float. I've tried nearly everything I can think of and nothing seems to remove this warning. My only guess is that floatstr is broken?

Код:
C:\Users\Mike\Desktop\SAMP\LG\pawno\include\ACC.inc(176) : warning 213: tag mismatch
C:\Users\Mike\Desktop\SAMP\LG\pawno\include\ACC.inc(320) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Code: http://pastebin.com/wfeJx8nz
The lines that have warnings on them (176,320) are highlighted on the paste bin.

Below is the code I am trying to perform.


pawn Код:
SetPlayerPos(playerid, AccountGetFloat(PlayerName, "posx"), AccountGetFloat(PlayerName, "posy"), AccountGetFloat(PlayerName, "posz"));

Thanks,
-Mike
Reply
#2

pawn Код:
stock Float:AccountGetFloat(nickname[], key[])
{
        if(!AccountExists(nickname)) return 0.00;
        new loc[50];
        format(loc, sizeof(loc), "\\users\\%s.ini", nickname);
        if(INI_Open(loc))
        {
                new Float:ReturnFloat;
                ReturnFloat = INI_ReadFloat(key);
                INI_Close();
                return ReturnFloat;    //  This is line 320: ACC.inc(320) : warning 213: tag mismatch
        } else return 0.00;
}
 
stock Float:INI_ReadFloat(const key[])
{
        new dest[11];
        INI_ReadString(dest, key);
    new Float:flt;
    flt = floatstr(dest);
    return flt;    //  This is line 176: ACC.inc(176) : warning 213: tag mismatch
}
Adding the 'Float:' tag to your functions may fix the problem. And make sure you give credits to the SII developer for making this include, especially since you are only using parts.
Reply
#3

pawn Код:
stock Float:AccountGetFloat(nickname[], key[])
{
        if(!AccountExists(nickname)) return 0.00;
        new loc[50];
        format(loc, sizeof(loc), "\\users\\%s.ini", nickname);
        if(INI_Open(loc))
        {
                new Float:ReturnFloat;
                ReturnFloat = INI_ReadFloat(key);
                INI_Close();
                return float ReturnFloat;
        } else return 0.00;
}
 
stock Float:INI_ReadFloat(const key[])
{
        new dest[11];
        INI_ReadString(dest, key);
    new Float:flt;
    flt = floatstr(dest);
    return float flt;
}
You have to add float instead of Float:
Reply
#4

@The Moddler: That will just return another tag mismatch error.
Reply
#5

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Adding the 'Float:' tag to your functions may fix the problem. And make sure you give credits to the SII developer for making this include, especially since you are only using parts.
Unfortunately that didn't seem to work however it spawned two new errors here:

pawn Код:
stock INI_ReadString(dest[], const key[], maxlength = sizeof(dest))
{
    if ((!gFile[E_OPEN]) || (!key[0])) return false;
    new ln = -1;
    while (((ln + 1) < INI_MAX_LINES) && (gCache[ln + 1][E_VALUE][0]))
    {
        ln ++;
        if (gCache[ln][E_VALUE][0] == ';') continue;
        if (!strcmp(gCache[ln][E_KEY], key, false))
        {
            INI_strcpy(dest, gCache[ln][E_VALUE], INI_MAX_VALUE, maxlength);
            return true;
        } // 156
    } // 157
    return false;
}

Код:
C:\Users\Mike\Desktop\SAMP\Renegade\pawno\include\ACC.inc(156) : error 079: inconsistent return types (array & non-array)
C:\Users\Mike\Desktop\SAMP\Renegade\pawno\include\ACC.inc(157) : error 079: inconsistent return types (array & non-array)
C:\Users\Mike\Desktop\SAMP\Renegade\pawno\include\ACC.inc(164) : warning 213: tag mismatch
C:\Users\Mike\Desktop\SAMP\Renegade\pawno\include\ACC.inc(165) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.

And of course I always leave credits at the top of the scripts, I just only posted the parts having to do with the Float problem.

pawn Код:
//======================================================
// Slick's INI Include 2.0.6
//
// © Copyright 2008-2009, [DRuG]Slick
// This file is provided as is (no warranties).
//======================================================
Reply
#6

Quote:
Originally Posted by Grim_
Посмотреть сообщение
@The Moddler: That will just return another tag mismatch error.
Wow, this is really wierd, 1 week ago I helped a guy with the same problem, here is what I doned:

pawn Код:
stock GetPlayerZPos(playerid)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    return float z;
}
And it compiled correctly, but now it doesn't, that's why I said to use only float

EDIT:

Gotted, this works:

pawn Код:
stock GetFloat()
{
    new Float: FLOAT;
    FLOAT = 12154.454545;
    return float:FLOAT;
}
You just have to add an : lol.

pawn Код:
stock Float:AccountGetFloat(nickname[], key[])
{
        if(!AccountExists(nickname)) return 0.00;
        new loc[50];
        format(loc, sizeof(loc), "\\users\\%s.ini", nickname);
        if(INI_Open(loc))
        {
                new Float:ReturnFloat;
                ReturnFloat = INI_ReadFloat(key);
                INI_Close();
                return float:ReturnFloat;
        } else return 0.00;
}
 
stock Float:INI_ReadFloat(const key[])
{
        new dest[11];
        INI_ReadString(dest, key);
    new Float:flt;
    flt = floatstr(dest);
    return float:flt;
}
That will work.
Reply
#7

Now i've got this heh:

Код:
C:\Users\Mike\Desktop\SAMP\Renegade\pawno\include\ACC.inc(156) : error 079: inconsistent return types (array & non-array)
C:\Users\Mike\Desktop\SAMP\Renegade\pawno\include\ACC.inc(157) : error 079: inconsistent return types (array & non-array)
C:\Users\Mike\Desktop\SAMP\Renegade\pawno\include\ACC.inc(164) : warning 213: tag mismatch
C:\Users\Mike\Desktop\SAMP\Renegade\pawno\include\ACC.inc(165) : warning 213: tag mismatch
C:\Users\Mike\Desktop\SAMP\LG\gamemodes\adv.pwn(672) : warning 203: symbol is never used: "djson_GameModeExit"
C:\Users\Mike\Desktop\SAMP\LG\gamemodes\adv.pwn(672) : warning 203: symbol is never used: "djson_GameModeInit"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
So for the inconsistent return types I have no idea what that means or how to fix it but it shows up here:

pawn Код:
stock INI_ReadString(dest[], const key[], maxlength = sizeof(dest))
{
    if ((!gFile[E_OPEN]) || (!key[0])) return false;
    new ln = -1;
    while (((ln + 1) < INI_MAX_LINES) && (gCache[ln + 1][E_VALUE][0]))
    {
        ln ++;
        if (gCache[ln][E_VALUE][0] == ';') continue;
        if (!strcmp(gCache[ln][E_KEY], key, false))
        {
            INI_strcpy(dest, gCache[ln][E_VALUE], INI_MAX_VALUE, maxlength);
            return true;
        } // Line 156
    } // Line 157
    return false;
}


Next for Tag mismatch apparently the float: thing fixed the other. Now it seems there's a problem with the integer one or something?

pawn Код:
stock INI_ReadInt(const key[])
{
    new dest[11]; // Line 164
    if (INI_ReadString(dest, key)) return strval(dest); // Line 165
    return false;
}


As for the djson one that is for DracoBlues dJSON json editor which I am baffled as to how it showed up on the compiler. Considering the fact I haven't even included the djson include anywhere. Actually I even went into includes and deleted it. But i'll worry about that one later as it's not important..
Reply
#8

Maybe you had those errors, but the compiler saw first the other ones, and they got fixed later, that's why they weren't showing up and now they do.

Did you modify the INI read inc?
Reply
#9

Quote:
Originally Posted by The_Moddler
Посмотреть сообщение
Wow, this is really wierd, 1 week ago I helped a guy with the same problem, here is what I doned:

pawn Код:
stock GetPlayerZPos(playerid)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    return float z;
}
And it compiled correctly, but now it doesn't, that's why I said to use only float
That was not you, that was Finn. And his way to fix it was:
pawn Код:
stock Float:GetPlayerZPos(playerid)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    return z;
}
Your's doesnt work
Reply
#10

Quote:
Originally Posted by Bessensap
Посмотреть сообщение
That was not you, that was Finn. And his way to fix it was:
pawn Код:
stock Float:GetPlayerZPos(playerid)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    return z;
}
Your's doesnt work
Mines was with the float thing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)