SA-MP Forums Archive
An error headshot system - 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: An error headshot system (/showthread.php?tid=554113)



An error headshot system - Rabea - 02.01.2015

Hello, i'm tring to do headshot system only for sniper, but it won't work with me, and giving me one Error.



Code
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) // this line is 7981
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
        SetPlayerHealth(playerid, 0);
        SetPlayerArmour(playerid, 0);
    }
    return 1;
}
Error
pawn Код:
(7981) : error 025: function heading differs from prototype



Re: An error headshot system - ATGOggy - 02.01.2015

Maybe, this can help you:
https://sampforum.blast.hk/showthread.php?tid=488198


Re: An error headshot system - FunnyBear - 02.01.2015

I'm not sure what is wrong, there seems to be nothing wrong with it and it looks fine. Because, the error is on the top of the callback (OnPlayerTakeDamage), it could mean there is something wrong with the script a few lines above it.

I have the same script in my GameMode, and it seems to be running perfectly fine with no errors. This is what I've got:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}
And, I don't think you really need the armour set to 0 because when someone's health is set to 0 their armour automatically is set to 0 aswell. That's what I think

EDIT: I have tested your script out in my GameMode, and it comes up with no errors. As I've mentioned before, there could be a problem with the script a few lines above this callback. Would you mind posting what's above it?


Re: An error headshot system - Sawalha - 02.01.2015

that means that you have two callbacks of OnPlayerTakeDamage, search for the other one and remove it


Re: An error headshot system - FunnyBear - 02.01.2015

Quote:
Originally Posted by Sawalha
Посмотреть сообщение
that means that you have two callbacks of OnPlayerTakeDamage, search for the other one and remove it
If he had two, wouldn't the error message be something like,

Код:
error 021: symbol already defined: "S@@_OnPlayerTakeDamage



Re: An error headshot system - Rabea - 02.01.2015

ah wait, i have OnPlayerShootPlayer and OnPlayerTakeDamage and onplayershootplayer dosen't have bodypart, and i'm using it, what should i do?


Re: An error headshot system - FunnyBear - 02.01.2015

Ok, I had managed to find a fix for this. Go into your server directory then find your,

Код:
pawno/include
folder and find the YSI folder and the YSI include and replace it with this download below. Just extract and move it into your pawno/include folder and it should fix your problem

http://www.mediafire.com/download/yx...pl/include.zip