SA-MP Forums Archive
How to fix this error? - 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: How to fix this error? (/showthread.php?tid=524589)



How to fix this error? - gychem - 07.07.2014

How to fix this error? Thanks in advance !

Код:
error 025: function heading differs from prototype
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
  if(issuerid != INVALID_PLAYER_ID) // If not self-inflicted
    {
	if(PlayerInfo[playerid][pIsDeath] == 1)
	{
 	 new Float:HP;
    GetPlayerHealth(playerid, HP);
    if(weaponid == 24) SetPlayerHealth(playerid, HP-46);//DesertEagle
    if(weaponid == 22) SetPlayerHealth(playerid, HP-13);//Colt45
    if(weaponid == 32) SetPlayerHealth(playerid, HP-7);//Tec9
    if(weaponid == 28) SetPlayerHealth(playerid, HP-7);//Uzi
    if(weaponid == 23) SetPlayerHealth(playerid, HP-13);//SilencedColt
    if(weaponid == 31) SetPlayerHealth(playerid, HP-10);//M4
    if(weaponid == 30) SetPlayerHealth(playerid, HP-10);//AK
    if(weaponid == 29) SetPlayerHealth(playerid, HP-8);//MP5
    if(weaponid == 34) SetPlayerHealth(playerid, HP-41);//SniperRifle
    if(weaponid == 33) SetPlayerHealth(playerid, HP-25);//CuntGun
    if(weaponid == 25) SetPlayerHealth(playerid, HP-30);//PumpShotgun
    if(weaponid == 27) SetPlayerHealth(playerid, HP-40);//Spaz12
	}
}
    return 1;
}



Re: How to fix this error? - AMouldyLemon - 07.07.2014

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
  if(issuerid != INVALID_PLAYER_ID) // If not self-inflicted
    {
    if(PlayerInfo[playerid][pIsDeath] == 1)
        {
        new Float:HP;
        GetPlayerHealth(playerid, HP);
        if(weaponid == 24) SetPlayerHealth(playerid, HP-46);//DesertEagle
        if(weaponid == 22) SetPlayerHealth(playerid, HP-13);//Colt45
        if(weaponid == 32) SetPlayerHealth(playerid, HP-7);//Tec9
        if(weaponid == 28) SetPlayerHealth(playerid, HP-7);//Uzi
        if(weaponid == 23) SetPlayerHealth(playerid, HP-13);//SilencedColt
        if(weaponid == 31) SetPlayerHealth(playerid, HP-10);//M4
        if(weaponid == 30) SetPlayerHealth(playerid, HP-10);//AK
        if(weaponid == 29) SetPlayerHealth(playerid, HP-8);//MP5
        if(weaponid == 34) SetPlayerHealth(playerid, HP-41);//SniperRifle
        if(weaponid == 33) SetPlayerHealth(playerid, HP-25);//CuntGun
        if(weaponid == 25) SetPlayerHealth(playerid, HP-30);//PumpShotgun
        if(weaponid == 27) SetPlayerHealth(playerid, HP-40);//Spaz12
        }
    }
    return 1;
}
Looks neater to me..


Re: How to fix this error? - gychem - 07.07.2014

How can I fix it?


Re: How to fix this error? - Psyhophatic - 07.07.2014

Which line it's the error ?

Edit:

You should check the forward for that function.


Re: How to fix this error? - AMouldyLemon - 07.07.2014

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID) // If not self-inflicted
    {
        if(PlayerInfo[playerid][pIsDeath] == 1)
        {
        new Float:HP;
        GetPlayerHealth(playerid, HP);
        if(weaponid == 24) SetPlayerHealth(playerid, HP-46);//DesertEagle
        if(weaponid == 22) SetPlayerHealth(playerid, HP-13);//Colt45
        if(weaponid == 32) SetPlayerHealth(playerid, HP-7);//Tec9
        if(weaponid == 28) SetPlayerHealth(playerid, HP-7);//Uzi
        if(weaponid == 23) SetPlayerHealth(playerid, HP-13);//SilencedColt
        if(weaponid == 31) SetPlayerHealth(playerid, HP-10);//M4
        if(weaponid == 30) SetPlayerHealth(playerid, HP-10);//AK
        if(weaponid == 29) SetPlayerHealth(playerid, HP-8);//MP5
        if(weaponid == 34) SetPlayerHealth(playerid, HP-41);//SniperRifle
        if(weaponid == 33) SetPlayerHealth(playerid, HP-25);//CuntGun
        if(weaponid == 25) SetPlayerHealth(playerid, HP-30);//PumpShotgun
        if(weaponid == 27) SetPlayerHealth(playerid, HP-40);//Spaz12
        }
    }
    return 1;
}
Try that, it's all i can think of.

Did you forward the function? If so, please show it.


Re: How to fix this error? - Konstantinos - 07.07.2014

"bodypart" parameter has been added in 0.3z so the a_samp.inc file you try to compile the script with is for older versions. Update the server package (executables and includes) and re-compile.


Re: How to fix this error? - gychem - 07.07.2014

Fixed it by removing the bodypart, thanks for helping out