[FIX] error 025: function heading differs from prototype
#1

*EDIT* This has been updated to fix some errors that have been found by some people. This should be working now! Enjoy! - 1/17/2014

If you are having this error
Код:
error 025: function heading differs from prototype
Download: REMOVED
-This is for those of you lazy people.

For the record, this literally took me 2 minutes to figure out how to fix this, hopefully this download will help you as they are mine, They arnt edited other than from what you see below, They work for me, so they should work for you.

This is what you need to do.

Navigate to:
\pawno\include\YSI\y_als

Open:
impl.inc

Find:
pawn Код:
#define ALS_DO_PlayerTakeDamage<%0> %0<PlayerTakeDamage,iifi>(more:playerid,more:issuerid,Float:amount,end:weaponid)
Change to:
pawn Код:
#define ALS_DO_PlayerTakeDamage<%0> %0<PlayerTakeDamage,iifii>(more:playerid,more:issuerid,Float:amount,more:weaponid,end:bodypart)
Find:
pawn Код:
#define ALS_DO_PlayerGiveDamage<%0> %0<PlayerGiveDamage,iifi>(more:playerid,more:damagedid,Float:amount,end:weaponid)
Change to:
pawn Код:
#define ALS_DO_PlayerGiveDamage<%0> %0<PlayerGiveDamage,iifii>(more:playerid,more:damagedid,Float:amount,more:weaponid,end:bodypart)
Save and Close the file.

Now thats done. You need to edit one more file.

Navigate to:
\pawno\include\YSI\y_hooks

Open:
impl.inc

Find:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
Change to:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
Find:
pawn Код:
P:2("Hooks_OnPlayerTakeDamage called: %d, %d, %f, %d", playerid, issuerid, Float:amount, weaponid);
Change to:
pawn Код:
P:2("Hooks_OnPlayerTakeDamage called: %d, %d, %f, %d, %d", playerid, issuerid, Float:amount, weaponid, bodypart);
Find:
pawn Код:
while (start++ != end)
    {
        #emit PUSH.S weaponid
        #emit PUSH.S amount
        #emit PUSH.S issuerid
        #emit PUSH.S playerid
        #emit PUSH.C     16
        #emit CONST.alt  YSI_g_sCallbackAddresses
        #emit LOAD.S.pri start
        //#emit INC.pri
        //#emit STOR.S.pri start
        #emit LIDX
        #emit MOVE.alt
        #emit LCTRL      6
        #emit ADD.C      24
        #emit PUSH.pri
        #emit MOVE.pri
        #emit SCTRL      6
        #emit MOVE.alt
        #emit CONST.pri  0xFFFFFFFE
        #emit AND
        #emit PUSH.pri
        #emit LOAD.S.pri ret
        #emit AND
        #emit POP.alt
        #emit OR
        #emit STOR.S.pri ret
        if (ret < 0) return ret + 1;
    }
Change to:
pawn Код:
while (start++ != end)
    {
        #emit PUSH.S bodypart
        #emit PUSH.S weaponid
        #emit PUSH.S amount
        #emit PUSH.S issuerid
        #emit PUSH.S playerid
        #emit PUSH.C     16
        #emit CONST.alt  YSI_g_sCallbackAddresses
        #emit LOAD.S.pri start
        //#emit INC.pri
        //#emit STOR.S.pri start
        #emit LIDX
        #emit MOVE.alt
        #emit LCTRL      6
        #emit ADD.C      24
        #emit PUSH.pri
        #emit MOVE.pri
        #emit SCTRL      6
        #emit MOVE.alt
        #emit CONST.pri  0xFFFFFFFE
        #emit AND
        #emit PUSH.pri
        #emit LOAD.S.pri ret
        #emit AND
        #emit POP.alt
        #emit OR
        #emit STOR.S.pri ret
        if (ret < 0) return ret + 1;
    }

Find:
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
Change to:
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
Find:
pawn Код:
P:2("Hooks_OnPlayerGiveDamage called: %d, %d, %f, %d", playerid, damagedid, Float:amount, weaponid);
Change to:
pawn Код:
P:2("Hooks_OnPlayerGiveDamage called: %d, %d, %f, %d, %d", playerid, damagedid, Float:amount, weaponid, bodypart);
Find:
pawn Код:
while (start++ != end)
    {
        #emit PUSH.S weaponid
        #emit PUSH.S amount
        #emit PUSH.S damagedid
        #emit PUSH.S playerid
        #emit PUSH.C     16
        #emit CONST.alt  YSI_g_sCallbackAddresses
        #emit LOAD.S.pri start
        //#emit INC.pri
        //#emit STOR.S.pri start
        #emit LIDX
        #emit MOVE.alt
        #emit LCTRL      6
        #emit ADD.C      24
        #emit PUSH.pri
        #emit MOVE.pri
        #emit SCTRL      6
        #emit MOVE.alt
        #emit CONST.pri  0xFFFFFFFE
        #emit AND
        #emit PUSH.pri
        #emit LOAD.S.pri ret
        #emit AND
        #emit POP.alt
        #emit OR
        #emit STOR.S.pri ret
        if (ret < 0) return ret + 1;
    }
Change to:
pawn Код:
while (start++ != end)
    {
        #emit PUSH.S bodypart
        #emit PUSH.S weaponid
        #emit PUSH.S amount
        #emit PUSH.S damagedid
        #emit PUSH.S playerid
        #emit PUSH.C     16
        #emit CONST.alt  YSI_g_sCallbackAddresses
        #emit LOAD.S.pri start
        //#emit INC.pri
        //#emit STOR.S.pri start
        #emit LIDX
        #emit MOVE.alt
        #emit LCTRL      6
        #emit ADD.C      24
        #emit PUSH.pri
        #emit MOVE.pri
        #emit SCTRL      6
        #emit MOVE.alt
        #emit CONST.pri  0xFFFFFFFE
        #emit AND
        #emit PUSH.pri
        #emit LOAD.S.pri ret
        #emit AND
        #emit POP.alt
        #emit OR
        #emit STOR.S.pri ret
        if (ret < 0) return ret + 1;
    }
Save and Close the file.





Now go compile and have fun!
Reply
#2

thx for your fix but i still get one error on OnPlayerGiveDamage
Reply
#3

Look over the fix again, I updated it because I forgot 2 parts lol. Should work now.

This was updated

pawn Код:
P:2("Hooks_OnPlayerGiveDamage called: %d, %d, %f, %d", playerid, damagedid, Float:amount, weaponid);
Reply
#4

This fixed OnPlayerTakeDamage however OnPlayerGiveDamage it doesn't seem to compile correctly.

error 025: function heading differs from prototype, and I also double checked the lines to make sure there wasn't any errors ectect
Reply
#5

Quote:
Originally Posted by itsCody
Посмотреть сообщение
This fixed OnPlayerTakeDamage however OnPlayerGiveDamage it doesn't seem to compile correctly.

error 025: function heading differs from prototype, and I also double checked the lines to make sure there wasn't any errors ectect
Take everything you did for OnPlayerTakeDamage and do it to OnPlayerGiveDamage.
Both of these from what I have seen are the same, However, The Name (Obviously) are different from each other.


Here, These are mine, This should help.

https://www.mediafire.com/?1mwjdd8gvcfi7d6
Reply
#6

Quote:
Originally Posted by [TC]XxJuggaloxX
Посмотреть сообщение
Take everything you did for OnPlayerTakeDamage and do it to OnPlayerGiveDamage.
Both of these from what I have seen are the same, However, The Name (Obviously) are different from each other.


Here, These are mine, This should help.

https://www.mediafire.com/?1mwjdd8gvcfi7d6
Thanks, they're working!
BTW; your download is blocked due to DMCA Copyright.

Also; found an error in your code!

pawn Код:
#define ALS_DO_PlayerGiveDamage<%0> %0<PlayerGiveDamage,iifi>(more:playerid,more:issuerid,Float:amount,more:weaponid,end:bodypart)
should be

pawn Код:
#define ALS_DO_PlayerGiveDamage<%0> %0<PlayerGiveDamage,iifi>(more:playerid,more:damagedid,Float:amount,more:weaponid,end:bodypart)
Under \pawno\include\YSI\y_als

PlayerGiveDamage was calling issuerid instead of damagedid!
Reply
#7

Also you forgot to see the specifier, it is 'iifi' it should be 'iifii'

pawn Код:
#define ALS_DO_PlayerGiveDamage<%0> %0<PlayerGiveDamage,iifii>(more:playerid,more:damagedid,Float:amount,more:weaponid,end:bodypart)
Reply
#8

pawn Код:
P:2("Hooks_OnPlayerGiveDamage called: %d, %d, %f, %d", playerid, damagedid, Float:amount, weaponid, bodypart);
Shouldn't there be one more placeholder for "bodypart"?
Reply
#9

Fixed all the missing parts, and specifiers. Download below.

http://sendupload.cba.pl/getfile.php?id=225
Reply
#10

Yes indeed, I also had this error due wups's headshot include. I didn't notice since it did not point out an error at the include but the gamemode. Anyway, I solved it but still It's useful for a topic like this to be here so the ones who are also in the same position can fix it aswell.
Reply
#11

Quote:
Originally Posted by Y_Less
View Post
Thanks for fixing this, the part fixing the "P2" lines isn't required as they are just debug messages, but thanks anyway.
Ah okay, I wasnt 100% sure, But I figured I would add it anyways just as a precaution.


*Edit* Fixed all the issues stated by people.
(I was tired when I did it in the first place..)

Everything stated in my original post is as it should be.

As Y_Less stated, the P2 lines aren't needed, however, you can add it if you wish.
Reply
#12

I'm still getting the error for my OnPlayerTakeDamage.. Any Idea??
Reply
#13

larp.pwn(870 : warning 235: public function lacks forward declaration (symbol "S@@_OnPlayerTakeDamage")

With the last link of YSI sent:
http://sendupload.cba.pl/getfile.php?id=225
Reply
#14

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
Fixed all the missing parts, and specifiers. Download below.

http://sendupload.cba.pl/getfile.php?id=225
I downloaded that file but i have the same errors.
pawn Код:
include\YSI\y_hooks/impl.inc(2336) : error 025: function heading differs from prototype
include\YSI\y_hooks/impl.inc(2383) : error 025: function heading differs from prototype
I really don't know how can fix it. If i comment the lines of the error the GM compiling, (public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) and public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)..) the problems dissappears but i think it isn't the solution.
Somebody can help me?
Thanks and sorry if i had a error in my english, i'm learning it.
Reply
#15

Thanks, now it works well.
Reply
#16

I get the same god damn errors!
Reply
#17

Quote:
Originally Posted by [rG]Cold
View Post
I get the same god damn errors!
Same here. I implemented the new YSI, still I'm getting that error.
Reply
#18

I'm still getting that error, even though I replaced it.

PHP Code:
forward OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart);
public 
OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart//Error
{
    
//Code

So far, I have only included <YSI\y_ini>.
Reply
#19

It's from my gamemode.
Reply
#20

Yes, in order to make that sure, I downloaded the 0.3z Windows Server Package and pasted my gamemode from my previous 0.3x folder in there + YSI, that I got from your topic, nothing more.

EDIT: I figured it out, it was my fault.

I didn't hook the function in one of my includes properly. I missed out the bodypart.

Thank you for your help, I appreciate it!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)