Author Topic: A new warning?  (Read 2842 times)

0 Members and 2 Guests are viewing this topic.

Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
A new warning?
« on: August 12, 2011, 05:25:25 pm »
[pawn]warning 235: public function lacks forward declaration (symbol "OnPlayerConnect")[/pawn]
So, this is my first time getting this kind of warning. What do I do?
I'm beginning to feel like a Lag God, Lag God

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: A new warning?
« Reply #1 on: August 12, 2011, 06:16:53 pm »
Well, if you had a public function like this:
[pawn]
public myFunction(parameter)
{
    return true;
}
[/pawn]

You would forward it like this:
[pawn]
forward myFunction(parameter);
[/pawn]

So forward the OnPlayerConnect function somewhere at the top of the script.
Do not PM me for support.




Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
Re: A new warning?
« Reply #2 on: August 16, 2011, 07:37:23 pm »
I forward the OnPlayerConnect with this:[pawn]forward OnPlayerConnect(playerid);[/pawn]Not sure if its correct. Then this is my script:[pawn]public OnPlayerConnect(playerid);
{//The error was referring to here.
   SetWaterLevel(6.0);
   SetGamespeed(100);
   SetGravity(100);
   GetPlayerName(playerid,gPlayers[playerid],MAX_PLAYER_NAME);
   SendClientMessage(playerid,GREEN, "Welcome to Vice City Life");
}[/pawn] And this is the error I received:[pawn]error 055: start of function body without function header[/pawn] The error was referring to {
I'm beginning to feel like a Lag God, Lag God

yazeen

  • Guest
Re: A new warning?
« Reply #3 on: September 01, 2011, 06:28:06 pm »
[pawn]OnPlayerConnect(playerid);[/pawn]
why ; on a function header ?
It should be  [pawn]OnPlayerConnect(playerid)[/pawn]

Offline Aldo

  • Wiseguy
  • **
  • Posts: 52
    • View Profile
Re: A new warning?
« Reply #4 on: September 02, 2011, 05:10:27 pm »
[pawn]
public OnPlayerConnect(playerid)
{//The error was referring to here.
   SetWaterLevel(6.0);
   SetGamespeed(100);
   SetGravity(100);
   GetPlayerName(playerid,gPlayers[playerid],MAX_PLAYER_NAME);
   SendClientMessage(playerid,GREEN, "Welcome to Vice City Life");
}
[/pawn]

Remove the ";"