Invalid function declaration? - 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: Invalid function declaration? (
/showthread.php?tid=517056)
Invalid function declaration? -
Laure - 03.06.2014
I got the Invalid function declaration error and a warning along in its next line, Heres my code, could you review it as to
let me know whats wrong?
pawn Код:
D:\ Gaming\gamemodes\eg-rp.pwn(6403) : error 010: invalid function or declaration
D:\ Gaming\gamemodes\eg-rp.pwn(6404) : warning 235: public function lacks forward declaration (symbol "SetPlayerToFacePos")
Re: Invalid function declaration? -
xFirex - 03.06.2014
you should post the error line code.
Re: Invalid function declaration? -
SAMProductions - 03.06.2014
Show us the Code of Line 6403.
Problem #2 (6404) :-
Код:
forward Potato(playerid);
public Potato(playerid)
{
//Codes
}
Another Example,
Код:
forward countdown();
public countdown()
{
//Codes
}
EDIT :-
Код:
forward Float:SetPlayerToFacePos(playerid, Float:X, Float:Y);
public Float:SetPlayerToFacePos(playerid, Float:X, Float:Y)
{
//Codes
}
Re: Invalid function declaration? -
Laure - 03.06.2014
OMG I am sorry, i forgot that lol.
pawn Код:
forwad Float:SetPlayerToFacePos(playerid, Float:X, Float:Y);
public Float:SetPlayerToFacePos(playerid, Float:X, Float:Y)
{
new
Float:local_pX,
Float:local_pY,
Float:local_pZ,
Float:ang;
GetPlayerPos(playerid, local_pX, local_pY, local_pZ);
if( Y > local_pY ) ang = (-acos((X - local_pX) / floatsqroot((X - local_pX)*(X - local_pX) + (Y - local_pY)*(Y - local_pY))) - 90.0);
else if( Y < local_pY && X < local_pX ) ang = (acos((X - local_pX) / floatsqroot((X - local_pX)*(X - local_pX) + (Y - local_pY)*(Y - local_pY))) - 450.0);
else if( Y < local_pY ) ang = (acos((X - local_pX) / floatsqroot((X - local_pX)*(X - local_pX) + (Y - local_pY)*(Y - local_pY))) - 90.0);
if(X > local_pX) ang = (floatabs(floatabs(ang) + 180.0));
else ang = (floatabs(ang) - 180.0);
ang += 180.0;
SetPlayerFacingAngle(playerid, ang);
return ang;
}
Re: Invalid function declaration? -
SAMProductions - 03.06.2014
Quote:
Originally Posted by Imperor
OMG I am sorry, i forgot that lol.
pawn Код:
forwad Float:SetPlayerToFacePos(playerid, Float:X, Float:Y); public Float:SetPlayerToFacePos(playerid, Float:X, Float:Y) { new Float:local_pX, Float:local_pY, Float:local_pZ, Float:ang;
GetPlayerPos(playerid, local_pX, local_pY, local_pZ);
if( Y > local_pY ) ang = (-acos((X - local_pX) / floatsqroot((X - local_pX)*(X - local_pX) + (Y - local_pY)*(Y - local_pY))) - 90.0); else if( Y < local_pY && X < local_pX ) ang = (acos((X - local_pX) / floatsqroot((X - local_pX)*(X - local_pX) + (Y - local_pY)*(Y - local_pY))) - 450.0); else if( Y < local_pY ) ang = (acos((X - local_pX) / floatsqroot((X - local_pX)*(X - local_pX) + (Y - local_pY)*(Y - local_pY))) - 90.0);
if(X > local_pX) ang = (floatabs(floatabs(ang) + 180.0)); else ang = (floatabs(ang) - 180.0);
ang += 180.0;
SetPlayerFacingAngle(playerid, ang);
return ang; }
|
Seriously '
forwad', change '
forwad' to '
forward'.
Re: Invalid function declaration? -
Laure - 03.06.2014
No wonder i dont see "fowad" anywhere.
Re: Invalid function declaration? -
SAMProductions - 03.06.2014
Quote:
Originally Posted by Imperor
No wonder i dont see "fowad" anywhere.
|
I wonder, i saw "forwad" anywhere.
EDIT :-
Problem #1 (6403) :-
Change,
Код:
forwad Float:SetPlayerToFacePos(playerid, Float:X, Float:Y);
to
Код:
forward Float:SetPlayerToFacePos(playerid, Float:X, Float:Y);
Re: Invalid function declaration? -
Laure - 03.06.2014
Opps lol thanks i am sorry.