SA-MP Forums Archive
Please help - 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: Please help (/showthread.php?tid=434693)



Please help - EmrysXD - 03.05.2013

I get this error when compiling my game mode..
Код:
warning 235: public function lacks forward declaration (symbol "IsAtGasStation")
Someone please tell me how to fix this?
this is the lines.

Код:
public IsAtGasStation(playerid)
{
    if(IsPlayerConnected(playerid))
	{
		if(IsPlayerInRangeOfPoint(playerid, 6, 1004.0070,-939.3102,42.1797) || IsPlayerInRangeOfPoint(playerid, 6, 1944.3260,-1772.9254,13.3906))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, -90.5515,-1169.4578,2.4079) || IsPlayerInRangeOfPoint(playerid, 6, -1609.7958,-2718.2048,48.5391))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, -2029.4968,156.4366,28.9498) || IsPlayerInRangeOfPoint(playerid, 6, -2408.7590,976.0934,45.4175))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, -2243.9629,-2560.6477,31.8841) || IsPlayerInRangeOfPoint(playerid, 8, -1676.6323,414.0262,6.9484))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, 2202.2349,2474.3494,10.5258) || IsPlayerInRangeOfPoint(playerid, 10, 614.9333,1689.7418,6.6968))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, -1328.8250,2677.2173,49.7665) || IsPlayerInRangeOfPoint(playerid, 6, 70.3882,1218.6783,18.5165))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, 2113.7390,920.1079,10.5255) || IsPlayerInRangeOfPoint(playerid, 6, -1327.7218,2678.8723,50.0625))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, 656.4265,-559.8610,16.5015) || IsPlayerInRangeOfPoint(playerid, 6, 656.3797,-570.4138,16.5015))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, -1973.6407,181.3395,27.3473) || IsPlayerInRangeOfPoint(playerid, 6, -1973.8097,177.1987,27.3470))
		{
		    return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6, -1973.4559,190.8642,27.2053) || IsPlayerInRangeOfPoint(playerid, 6, -1973.0908,195.0410,27.0360))
		{
		    return 1;
		}
	}
	return 0;
}



Re: Please help - InfiniTy. - 03.05.2013

pawn Код:
forward IsAtGasStation(playerid);



Re: Please help - EmrysXD - 03.05.2013

Wow.thanks man


Re: Please help - Tom Kingston - 03.05.2013

Or you can simply change the word "public" with stock, works perfectly, if it gives warning/error about that line where return 0; is, remove it.


Re: Please help - Pottus - 03.05.2013

A couple of things here to improve...

1.) No need for if(IsPlayerConnected(playerid)) of course the player is connected if your calling the function.
2.) Use an array to store your gastation locations

pawn Код:
enum XYZ {
    Float:xpos,
    Float:ypos,
    Float:zpos
}

stock const GasStations[][XYZ] = {
    { 1004.0070,-939.3102,42.1797 },
    { 1004.0070,-939.3102,42.1797 }
};

stock IsAtGasStation(playerid)
{
    for(new i = 0; i < sizeof(GasStations); i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 6.0, GasStations[i][xpos], GasStations[i][ypos], GasStations[i][zpos])) return 1;
    }
    return 0;
}
Additionally you could use the streamer plugin and dynamic areas to make this more efficient.