PDA

View Full Version : Problem with OnPlayerTakeDamage


Syncro
03/05/2014, 01:44 PM
forward OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(weaponid == 0 && GetPVarInt(issuerid, "Tazer") == 1)
{
SetPlayerHealth(playerid, GetPlayerHealth(playerid) - 10);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 1, 0, 0, 1, 30000, 1);
return 1;
)
}


I have a error with that code: "function differs from prototype".
I tryed:
- Download SA-MP Includes for 0.3z (not solved)
- Download YSI for 0.3z RC5 (not solved)
- Download YSI for 0.3z RC4 (not solved)
- Manually replace all the codes for fix in YSI files (not solved).

I need help please guys :(

iZN
03/05/2014, 02:08 PM
Are you sure other includes are updated too? Open them and see if they've the older version of that callback.

Syncro
03/05/2014, 02:33 PM
Yes, all includes are updated, i've readed online that is for YSI, but I've updated YSI! :(

Basssiiie
03/05/2014, 03:46 PM
Why are you forwarding a native callback? You don't have to do that. ;)

Syncro
03/05/2014, 08:38 PM
Ok :) but the function with or without the forward not function, please help me!

brent94
03/05/2014, 08:59 PM
Mind taking a screenshot of the compiler window, with the error, and uploading it for us?

Syncro
04/05/2014, 01:41 PM
Ok, look :)

With OnPlayerTakeDamage and Script:
http://imgur.com/03ZKm7p.png

With OnPlayerTakeDamage but without the internal script!
http://imgur.com/D8iTQQF.png

It running! The warning is mine, i can remove it! Why with the internal script it release many errors? :(

[WSF]ThA_Devil
04/05/2014, 01:57 PM
You have ) instead of } for bracket...
after first return 1; in OnPlayerTakeDamage

Galletziz
04/05/2014, 02:59 PM
delete bodypart and it works.. but you can't use this parameter in this callback in future while you don't fix it.

Syncro
04/05/2014, 03:18 PM
ThA_Devil;3021725']You have ) instead of } for bracket...
after first return 1; in OnPlayerTakeDamage

What? Can you write the correct script for me? I'm italian and I can't speak you! Re-write the script please :D

Syncro
04/05/2014, 05:53 PM
Please help me :D

brent94
05/05/2014, 05:01 AM
As Devil had said:

ThA_Devil;3021725']You have ) instead of } for bracket...
after first return 1; in OnPlayerTakeDamage

Replace your OnPlayerTakeDamage code with this:

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if(weaponid == 0 && GetPVarInt(issuerid, "Tazer") == 1)
{
SetPlayerHealth(playerid, GetPlayerHealth(playerid) - 10);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 1, 0, 0, 1, 30000, 1);
return 1;
}
return 1;
}

Just be careful not to mix up { } and ( ) :)