SA-MP Forums Archive
Public function lacks forward declaration, Help!!! [REP +] - 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: Public function lacks forward declaration, Help!!! [REP +] (/showthread.php?tid=423418)



Public function lacks forward declaration, Help!!! [REP +] - CTAntonio - 17.03.2013

Hi, I have made my new class for PPC Gamemode, but when I try to compile it I got error
Код:
(1) : error 010: invalid function or declaration
Line one is
Код:
forward IsAtFishPlace(playerid);
after compile, I got warning for it too
Код:
warning 235: public function lacks forward declaration (symbol "IsAtFishPlace")
and this is public function
Код:
public IsAtFishPlace(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    if(IsPlayerInRangeOfPoint(playerid,1.0,403.8266,-2088.7598,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,398.7553,-2088.7490,7.8359))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid,1.0,396.2197,-2088.6692,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,391.1094,-2088.7976,7.8359))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid,1.0,383.4157,-2088.7849,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,374.9598,-2088.7979,7.8359))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid,1.0,369.8107,-2088.7927,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,367.3637,-2088.7925,7.8359))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid,1.0,362.2244,-2088.7981,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,354.5382,-2088.7979,7.8359))
		{
		    return 1;
		}
		else if(IsPlayerInWater(playerid))
		{
			return 1;
		}
	}
	return 0;
}



Re: Public function lacks forward declaration, Help!!! [REP +] - kamzaf - 17.03.2013

forward IsAtFishPlace(playerid);

make sure this line is directly above the public.

Or another simpler way:

pawn Код:
#define PUB:%1(%2) forward %1(%2); public %1(%2)
Then replace the "public" with "PUB:"


Re: Public function lacks forward declaration, Help!!! [REP +] - Jstylezzz - 17.03.2013

Place the forward under your includes.


Re: Public function lacks forward declaration, Help!!! [REP +] - Luis- - 17.03.2013

Quote:
Originally Posted by kamzaf
Посмотреть сообщение
forward IsAtFishPlace(playerid);

make sure this line is directly above the public
You don't have to do that.


Re: Public function lacks forward declaration, Help!!! [REP +] - CTAntonio - 17.03.2013

Quote:
Originally Posted by kamzaf
Посмотреть сообщение
forward IsAtFishPlace(playerid);

make sure this line is directly above the public.

Or another simpler way:

pawn Код:
#define PUB:%1(%2) forward %1(%2); public %1(%2)
Then replace the "public" with "PUB:"
Didn't work, error 010: invalid function or declaration
&
Warning: public function lacks forward declaration (symbol "PUB")

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
Place the forward under your includes.
They are...

This is include for PPC(gamemode) new class


Re: Public function lacks forward declaration, Help!!! [REP +] - kamzaf - 17.03.2013

No use: PUB:IsAtFishPlace(playerid)

not PUB isatfishplayer


Re: Public function lacks forward declaration, Help!!! [REP +] - CTAntonio - 17.03.2013

Quote:
Originally Posted by kamzaf
Посмотреть сообщение
No use: PUB:IsAtFishPlace(playerid)

not PUB isatfishplayer
This?
Код:
#define PUB:IsAtFishPlace(playerid) forward IsAtFishPlace(playerid); public IsAtFishPlace(playerid)



Re: Public function lacks forward declaration, Help!!! [REP +] - kamzaf - 17.03.2013

At top of your script after includes:
pawn Код:
#define PUB:%1(%2) forward %1(%2); public %1(%2)
then somewhere:
pawn Код:
PUB:IsAtFishPlace(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,1.0,403.8266,-2088.7598,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,398.7553,-2088.7490,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid,1.0,396.2197,-2088.6692,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,391.1094,-2088.7976,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid,1.0,383.4157,-2088.7849,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,374.9598,-2088.7979,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid,1.0,369.8107,-2088.7927,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,367.3637,-2088.7925,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid,1.0,362.2244,-2088.7981,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,354.5382,-2088.7979,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInWater(playerid))
        {
            return 1;
        }
    }
    return 0;
}



Re: Public function lacks forward declaration, Help!!! [REP +] - stabker - 17.03.2013

Just rename function


Re: Public function lacks forward declaration, Help!!! [REP +] - CTAntonio - 17.03.2013

Quote:
Originally Posted by kamzaf
Посмотреть сообщение
At top of your script after includes:
pawn Код:
#define PUB:%1(%2) forward %1(%2); public %1(%2)
then somewhere:
pawn Код:
PUB:IsAtFishPlace(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,1.0,403.8266,-2088.7598,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,398.7553,-2088.7490,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid,1.0,396.2197,-2088.6692,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,391.1094,-2088.7976,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid,1.0,383.4157,-2088.7849,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,374.9598,-2088.7979,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid,1.0,369.8107,-2088.7927,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,367.3637,-2088.7925,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid,1.0,362.2244,-2088.7981,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,354.5382,-2088.7979,7.8359))
        {
            return 1;
        }
        else if(IsPlayerInWater(playerid))
        {
            return 1;
        }
    }
    return 0;
}
I did, but same error
PPC_MissionsFish.inc(1) : error 010: invalid function or declaration

Quote:
Originally Posted by stabker
Посмотреть сообщение
Just rename function
allready tryed...