SA-MP Forums Archive
Public function lacks forward 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Public function lacks forward declaration (/showthread.php?tid=90017)



Public function lacks forward declaration - AcId n RaPiD - 05.08.2009

This is my second attempt. I'm using Fallouts, "Player Damage on Car Damage Code" which I found using the, "SEARCH" button. But, it was in a help topic and the topic was old so I decided not to post anything there and post here instead. This is the error I get.

Код:
C:\Users\User\Desktop\SAMP Script #2\pawno\seatbelt.pwn(162) : warning 235: public function lacks forward declaration (symbol "OnPlayerUpdate")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
But, I have no idea... Yeah, I know... And here's the code.

pawn Код:
public OnPlayerUpdate(playerid) // LINE 162
{
    if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 0)
    {
        new Float:TempCarHealth;
        GetVehicleHealth(GetPlayerVehicleID(playerid), TempCarHealth);
        new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
        if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,100.0) == 1))
        {
          Difference = floatdiv(Difference, 10.0);
          new Float:OldHealth;
          GetPlayerHealth(playerid, OldHealth);
          SetPlayerHealth(playerid, floatsub(OldHealth, Difference));
        }
        CarHealth[playerid] = TempCarHealth;
    }
    else
    {
        CarHealth[playerid] = 0.0;
    }
  return 1;
}



Re: Public function lacks forward declaration - Sergei - 05.08.2009

Just add
pawn Код:
forward OnPlayerUpdate(playerid);
Maybe you are using old a_samp.inc where OnPlayerUpdate isn't forwarded by default (since it hadn't existed yet).


Re: Public function lacks forward declaration - dafel2 - 05.08.2009

update you samp server package


Re: Public function lacks forward declaration - AcId n RaPiD - 05.08.2009

Quote:
Originally Posted by Sergiy
Just add
pawn Код:
forward OnPlayerUpdate(playerid);
Maybe you are using old a_samp.inc where OnPlayerUpdate isn't forwarded by default (since it hadn't existed yet).
Nah, I have the new a_samp.. I just forgot to put
Код:
forward OnPlayerUpdate(playerid);
, hehe... I'm kinda' dumb but thanks for the help both of you though. Thanks alot.