SA-MP Forums Archive
Hook giving "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: Hook giving "function heading differs from prototype" (/showthread.php?tid=640849)



Hook giving "function heading differs from prototype" - Juniiro3 - 08.09.2017

I just downloaded and included Nex Anticheater. But it triggered two errors that i couldn't figure:

Код:
C:\PawnCC\include\nex-ac.inc(3061) : warning 202: number of arguments does not match definition
C:\PawnCC\include\nex-ac.inc(3075) : error 025: function heading differs from prototype
C:\PawnCC\include\nex-ac.inc(5678) : warning 202: number of arguments does not match definition
C:\PawnCC\include\nex-ac.inc(5692) : error 025: function heading differs from prototype
This error is usually caused by a missing parameter, but this is the code:

PHP код:
#if defined _inc_y_hooks || defined _INC_y_hooks
    
hook OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart)
#else
    
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart)
#endif
{
    if(
ACInfo[playerid][acKicked]) return 1;
    
ACInfo[playerid][acDeathRes] = true;
    
#if !defined _inc_y_hooks && !defined _INC_y_hooks && defined ac_OnPlayerTakeDamage
        
L3061 --> return ac_OnPlayerTakeDamage(playeridissueridamountweaponidbodypart);
    
#else
        
return 0;
    
#endif
}
//The Hook itself
#if !defined _inc_y_hooks && !defined _INC_y_hooks
    #if defined _ALS_OnPlayerTakeDamage
        #undef OnPlayerTakeDamage
    #else
        #define _ALS_OnPlayerTakeDamage
    #endif
    #define OnPlayerTakeDamage ac_OnPlayerTakeDamage
    #if defined ac_OnPlayerTakeDamage
        
L3075 --> forward ac_OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart);
    
#endif
#endif 
The other snippet is very similar.

Does anyone has any ideia of what is going on?


Re: Hook giving "function heading differs from prototype" - 1fret - 08.09.2017

change line 3061 to

PHP код:
ac_OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart); 
I dont see the other line with errors could you like make them bold or something cause your coding is a bit untidy and confusing


Re: Hook giving "function heading differs from prototype" - Juniiro3 - 08.09.2017

I edited the topic, hope it's better now

I changed to your solution, but it didn't work!

PS: When I compile only the include, it doesn't give any errors.