SA-MP Forums Archive
Whats wrong? - 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: Whats wrong? (/showthread.php?tid=65849)



Whats wrong? - Shellegg - 16.02.2009

Can some1 explain me how to fiz this compiler error?

Quote:

error 025: function heading differs from prototype

ty vm


Re: Whats wrong? - Backwardsman97 - 16.02.2009

That happens when you give a public function the wrong parameters. Like this.

pawn Код:
forward Blah(playerid,gun);

public Blah()
{
  //
}



Re: Whats wrong? - Shellegg - 16.02.2009

the green //?
So i must delete that?


Re: Whats wrong? - Joe Staff - 16.02.2009

no, he means that you have to make Blah() the same as what you did "forward" to.


Re: Whats wrong? - yom - 16.02.2009

Quote:
Originally Posted by Pawn documentation, the thing you should read before posting:
025 function heading differs from prototype

The number of arguments given at a previous declaration of the function does not match the number of arguments given at the current declaration.



Re: Whats wrong? - Shellegg - 17.02.2009

ok the prototype is:

Quote:

forward OnVehicleMod(vehicleid, componentid);

and what is wrong is: (at least it tells that difers from prototype)

Quote:

public OnVehicleMod(vehicleid, componentid)
{
if(vehicleid >= nstaticcars)
{
vehicleid = vehicleid - nstaticcars;
SaveComponent(vehicleid,componentid);
}

Quote:

public OnVehiclePaintjob(vehicleid, paintjobid)
{
if(vehicleid >= nstaticcars)
{
if(IsaCarforsell(vehicleid) == 0)
{
new carnfoid;
carnfoid = vehicleid - nstaticcars;
CarsInfo[carnfoid][cpaintjob] = paintjobid;
}
}

}

and

Quote:

public OnVehicleRespray(vehicleid, color1, color2)
{
if(vehicleid >= nstaticcars)
{
if(IsaCarforsell(vehicleid) == 0)
{
new carnfoid;
carnfoid = vehicleid - nstaticcars;
CarsInfo[carnfoid][ccolor1] = color1;
CarsInfo[carnfoid][ccolor2] = color2;
}
}

}




Re: Whats wrong? - Joe Staff - 17.02.2009

no, in 0.2.x it was changed to OnVehicleMod(playerid,vehid,componentid);


Re: Whats wrong? - MenaceX^ - 17.02.2009

Quote:
Originally Posted by Shellegg
the green //?
So i must delete that?
Wow..
That's all what I have to say.
public name changed.


Re: Whats wrong? - Shellegg - 17.02.2009

chaged to what?
already added "vehid," and it stills gives me the same error

Quote:

(111)error 025: function heading differs from prototype

line 111
Quote:

forward OnVehicleMod(vehicleid, vehid, componentid);




Re: Whats wrong? - Daren_Jacobson - 18.02.2009

get rid of the forward and change the function to be
pawn Код:
public OnVehicleMod(playerid,vehicleid,componentid)