SA-MP Forums Archive
[Help]How to fix error 025 function heading differs from prototype - 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: [Help]How to fix error 025 function heading differs from prototype (/showthread.php?tid=625034)



[Help]How to fix error 025 function heading differs from prototype - superbboy78 - 27.12.2016

D:\gta edit\gamemode\SanJoseRolePlay.pwn(705 : warning 213: tag mismatch
D:\gta edit\gamemode\SanJoseRolePlay.pwn(7101) : warning 213: tag mismatch
D:\gta edit\gamemode\SanJoseRolePlay.pwn(8080) : warning 213: tag mismatch
D:\gta edit\gamemode\SanJoseRolePlay.pwn(8120) : warning 213: tag mismatch
D:\gta edit\gamemode\SanJoseRolePlay.pwn(8159) : warning 213: tag mismatch
D:\gta edit\gamemode\SanJoseRolePlay.pwn(1120 : warning 204: symbol is assigned a value that is never used: "stattext"
D:\gta edit\gamemode\SanJoseRolePlay.pwn(12954) : error 025: function heading differs from prototype
D:\gta edit\gamemode\SanJoseRolePlay.pwn(19874) : warning 213: tag mismatch
D:\gta edit\gamemode\SanJoseRolePlay.pwn(19882) : warning 213: tag mismatch
D:\gta edit\gamemode\SanJoseRolePlay.pwn(19890) : warning 213: tag mismatch
D:\gta edit\gamemode\SanJoseRolePlay.pwn(25537) : warning 203: symbol is never used: "Name"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)



Re: [Help]How to fix error 025 function heading differs from prototype - Konstantinos - 27.12.2016

Update your includes because OnPlayerTakeDamage is forwarded without the "bodypart" parameter which was added in 0.3z version.

About the tag mismatch warnings, in case you cannot fix them then post the code from those lines.


Re: [Help]How to fix error 025 function heading differs from prototype - superbboy78 - 28.12.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Update your includes because OnPlayerTakeDamage is forwarded without the "bodypart" parameter which was added in 0.3z version.

About the tag mismatch warnings, in case you cannot fix them then post the code from those lines.
How To Fix
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    new Float:HP;
    GetPlayerHealth(playerid, HP);
    if(weaponid == 4) SetPlayerHealth(playerid, HP-30);
    if(weaponid == 22) SetPlayerHealth(playerid, HP-25);
    if(weaponid == 32) SetPlayerHealth(playerid, HP-25);
    if(weaponid == 28) SetPlayerHealth(playerid, HP-25);
    if(weaponid == 30) SetPlayerHealth(playerid, HP-30);
    if(weaponid == 31) SetPlayerHealth(playerid, HP-21);
    if(weaponid == 34) SetPlayerHealth(playerid, HP-70);
    if(weaponid == 29) SetPlayerHealth(playerid, HP-25);

    if(weaponid == 25) SetPlayerHealth(playerid, HP-40);
    if(issuerid != INVALID_PLAYER_ID)
   	{
   	    if(weaponid == 0 || weaponid == 1 || weaponid == 2 || weaponid == 3 || weaponid == 4 || weaponid == 5 ||
		    weaponid == 6 || weaponid == 7 || weaponid == 8 || weaponid == 15)
   	    {
   			sInfo[playerid][Misc] += 1;
		}
   	}
  	if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
   	{
		SetPlayerHealth(playerid, 0.0);
   	}
  	if(issuerid != INVALID_PLAYER_ID && bodypart == 3)
   	{
   		if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
		    weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
   	    {
   			sInfo[playerid][Chest] += 1;
		}
   	}
  	if(issuerid != INVALID_PLAYER_ID && bodypart == 4)
   	{
   		if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
		    weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
   	    {
   			sInfo[playerid][Crotch] += 1;
		}
   	}
  	if(issuerid != INVALID_PLAYER_ID && bodypart == 5)
   	{
   		if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
		    weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
   	    {
   			sInfo[playerid][LArm] += 1;
		}
   	}
  	if(issuerid != INVALID_PLAYER_ID && bodypart == 6)
   	{
   		if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
		    weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
   	    {
   			sInfo[playerid][RArm] += 1;
		}
   	}
  	if(issuerid != INVALID_PLAYER_ID && bodypart == 7)
   	{
   		if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
		    weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
   	    {
   			sInfo[playerid][LLeg] += 1;
		}
   	}
  	if(issuerid != INVALID_PLAYER_ID && bodypart == 8)
   	{
   		if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
		    weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
   	    {
   			sInfo[playerid][RLeg] += 1;
		}
   	}
  	if(issuerid != INVALID_PLAYER_ID && bodypart == 9)
   	{
   		if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
		    weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
   	    {
   	    	SetPlayerHealth(playerid, HP-70);
   			sInfo[playerid][Head] += 1;
		}
   	}
    return 1;
}



Re: [Help]How to fix error 025 function heading differs from prototype - superbboy78 - 29.12.2016

Help Me please


Re: [Help]How to fix error 025 function heading differs from prototype - BiosMarcel - 29.12.2016

Do everyone (including yourself) a favor and learn how to not code terrily, read some tutorials (you had tons of redundant code, used if only instead of if-else / switch and you had no proper indentation, math mistakes (integer + float, works but is slower))

PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    new 
Float:HP;
    
GetPlayerHealth(playerid, HP);
    switch(
weaponid)
    {
        case 
4: SetPlayerHealth(playerid, HP-30.0);
        case 
22: SetPlayerHealth(playerid, HP-25.0);
        case 
32: SetPlayerHealth(playerid, HP-25.0);
        case 
28: SetPlayerHealth(playerid, HP-25.0);
        case 
30: SetPlayerHealth(playerid, HP-30.0);
        case 
31: SetPlayerHealth(playerid, HP-21.0);
        case 
34: SetPlayerHealth(playerid, HP-70.0);
        case 
29: SetPlayerHealth(playerid, HP-25.0);
        case 
25: SetPlayerHealth(playerid, HP-40.0);    
    }
    if(
isseruid != INVALID_PLAYER_ID)
    {
        if(
isValidWeaponForSpecialHit(weaponid))
        {
            switch(
bodypart)
            {
                case 
3: sInfo[playerid][Chest] += 1;
                case 
4: sInfo[playerid][Crotch] += 1;
                case 
5: sInfo[playerid][LArm] += 1;
                case 
6: sInfo[playerid][RArm] += 1;
                case 
7: sInfo[playerid][LLeg] += 1;
                case 
8: sInfo[playerid][RLeg] += 1;
                case 
9:
                {
                    
SetPlayerHealth(playerid, HP-70.0);
                    
sInfo[playerid][Head] += 1;
                }
            }
        }
    }
}
isValidWeaponForSpecialHit(weaponid)
{
    return (
weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 || weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34);
} 
Also, update your a_samp.inc which you can find in the package at http://www.sa-mp.com/download.php