OnPlayerTakeDamage
#1

In Wiki samp it shows that it has all of these parameters
(playerid, issuerid, Float:amount, weaponid, bodypart)
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage

but it always gave me this error: : error 025: function heading differs from prototype


So after fucking around I removed bodypart from the parameters and it worked.


My request is, is there a way to do a headshot script with OnPlayerTakeDamage like it showed in it's examples in wiki-samp ?


This is their example:

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
        // One shot to the head to kill with sniper rifle
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}
Reply
#2

Try removing the space between Float: and amount in the prototype.

Btw, are you sure that you have the 0.3z a_samp include file ?
Reply
#3

Update the server package (executables and includes) so OnPlayerTakeDamage and OnPlayerGiveDamage callbacks will be forwarded with the correct parameters inside a_samp.inc file.

You can then do it if the bodypart is 9 (BODY_PART_HEAD).
Reply
#4

Yes I am sure, even used a bare.pwn script for a quick check.

Still the same:

Код:
C:\Users\msi\Desktop\SAMP_DS\samp03z_svr_R1_win32\samp03z_svr_R1_win32\gamemodes\bare.pwn(119) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#5

SetPlayerHealth(playerid, 0);
It's the same but test.
Reply
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Update the server package (executables and includes) so OnPlayerTakeDamage and OnPlayerGiveDamage callbacks will be forwarded with the correct parameters inside a_samp.inc file.

You can then do it if the bodypart is 9 (BODY_PART_HEAD).
Heck, that worked, problem is now I have to udpate a whole server with this XD. Thanks anyway!







Wow that was fast XD
Reply
#7

Quote:
Originally Posted by ThatThoseTheThy
Посмотреть сообщение
Yes I am sure, even used a bare.pwn script for a quick check.

Still the same:

Код:
C:\Users\msi\Desktop\SAMP_DS\samp03z_svr_R1_win32\samp03z_svr_R1_win32\gamemodes\bare.pwn(119) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
The 'bodypart' parameter exists in 0.3z R1. Go to samp03z_svr_R1_win32\pawno\include and open a_samp.inc
Do Ctrl + F and type "takedamage" (without "").

Is the line it finds like this?
pawn Код:
forward OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
If yes, the a_samp.inc is not for 0.3z
It should be:
pawn Код:
forward OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
EDIT: I was writing and didn't refresh.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)