Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Fuzzy168 on August 12, 2011, 05:25:25 pm

Title: A new warning?
Post by: Fuzzy168 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?
Title: Re: A new warning?
Post by: stormeus 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.
Title: Re: A new warning?
Post by: Fuzzy168 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 {
Title: Re: A new warning?
Post by: yazeen on September 01, 2011, 06:28:06 pm
[pawn]OnPlayerConnect(playerid);[/pawn]
why ; on a function header ?
It should be  [pawn]OnPlayerConnect(playerid)[/pawn]
Title: Re: A new warning?
Post by: Aldo 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 ";"