SA-MP Forums Archive
I don't know what this warning means... - 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: I don't know what this warning means... (/showthread.php?tid=311192)



I don't know what this warning means... - Scenario - 15.01.2012

Okay, so I was going through the Useful Functions topic when I came across this post from ******. I used this script (mentioned in ******'s post) to generate the following code:

pawn Код:
stock bool:IsAMotorcycle(val) // line 300
{
    static
        s_iValArray[] =
        {
               9494529, 1610612738,       3584,       1056
        };
    if (val > 586)
    {
        return true;
    }
    val -= 448;
    if (val < 0)
    {
        return true;
    }
    return !(s_iValArray[val >> 5] & (1 << (val & 0x1F)));
}
I thought it was fine, but I receive the following warning. I have commented line 300 in the code above (you'll need to know this).

Код:
(300) : warning 208: function with tag result used before definition, forcing reparse
Does anyone know what could be causing this warning?

EDIT: I found the answer a few more pages in so never mind!

Quote:
Originally Posted by ******
Посмотреть сообщение
Also, to fix the tag problem either forward the function or put the function above where it's used in the code.



Re: I don't know what this warning means... - Kyosaur - 15.01.2012

Aw damn, i was gonna type out a long explanation telling you to forward it or remove the tag! Glad you fixed it though.


Re: I don't know what this warning means... - Kyosaur - 15.01.2012

I found this old post that ****** made that explains WHY this happens, its worth a read.

https://sampforum.blast.hk/showthread.php?pid=810731#pid810731


Re: I don't know what this warning means... - Scenario - 15.01.2012

Oh interesting, thanks for posting. Perhaps you can help me solve these new errors with another function?

pawn Код:
forward bool:IsLEOVeh(val);
stock bool:IsLEOVeh(val) // line 301
{
    static s_iValArray[] =
        {
            1, -, 33, 24064
        };
    if (val > 601) // line 307
    {
        return true; // line 309
    }
    val -= 427;
    if (val < 0)
    {
        return true;
    }
    return !(s_iValArray[val >> 5] & (1 << (val & 0x1F)));
}
Here are the errors:

Код:
(301) : error 010: invalid function or declaration
(301 -- 307) : error 010: invalid function or declaration
(301 -- 309) : error 010: invalid function or declaration
(301 -- 309) : fatal error 107: too many error messages on one line



Re: I don't know what this warning means... - Kyosaur - 15.01.2012

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Oh interesting, thanks for posting. Perhaps you can help me solve these new errors with another function?

pawn Код:
forward bool:IsLEOVeh(val);
stock bool:IsLEOVeh(val) // line 301
{
    static s_iValArray[] =
        {
            1, -, 33, 24064
        };
    if (val > 601) // line 307
    {
        return true; // line 309
    }
    val -= 427;
    if (val < 0)
    {
        return true;
    }
    return !(s_iValArray[val >> 5] & (1 << (val & 0x1F)));
}
Here are the errors:

Код:
(301) : error 010: invalid function or declaration
(301 -- 307) : error 010: invalid function or declaration
(301 -- 309) : error 010: invalid function or declaration
(301 -- 309) : fatal error 107: too many error messages on one line
There's a negative sign without a number in your array initialization.


Edit: Also make sure the forward is atop your script before any callbacks/functions that use the "IsLEOVeh" function. Its not a good idea to put it right about the function (defeats the purpose of a function prototype lol).


Re: I don't know what this warning means... - Scenario - 15.01.2012

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
There's a negative sign without a number in your array initialization
That's what ******'s script returned... is there a number I could place there so it'll quit whining?


Re: I don't know what this warning means... - Kyosaur - 15.01.2012

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
That's what ******'s script returned... is there a number I could place there so it'll quit whining?
Well yes, you could put almost any number in the world there, but that might produce undesired results. Im not sure what the function is suppose to do honestly, so i cant tell you what number to put there . For this you should probably talk to ****** himself.


Re: I don't know what this warning means... - Scenario - 15.01.2012

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
Edit: Also make sure the forward is atop your script before any callbacks/functions that use the "IsLEOVeh" function. Its not a good idea to put it right about the function (defeats the purpose of a function prototype lol).
I'm glad you said that because I do that all the time...

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
Well yes, you could put almost any number in the world there, but that might produce undesired results. Im not sure what the function is suppose to do honestly, so i cant tell you what number to put there . For this you should probably talk to ****** himself.
Okay, will do. Thanks!


Re: I don't know what this warning means... - Scenario - 15.01.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
I think that is what PAWN prints (possibly due to a bug) when you have "cellmin" (0x80000000).
Is there a way to resolve the problem? Or should I just do a similar code, but with a switch statement?


Re: I don't know what this warning means... - Scenario - 15.01.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
Just write the number in the code yourself, it's only the "print" in the generator that's the problem.
I'm not exactly sure what you mean. Perhaps I'm not thinking straight right now. What number am I supposed to write?