09.06.2014, 18:12
Hello everyone, I've tried scripting something, but seems like it doesn't work as expected.
I was wondering why, as it compiles fine?
So, this is the code:
But it keeps taking the players health down, and eventually kills him after 3 bullets?
Why does it happen, and how do I fix that? Thanks in advance!
I was wondering why, as it compiles fine?
So, this is the code:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(deagledm[playerid] == 1)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 9)
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_FIREBRICK, "** A bullet came straight into your head, you was killed by a headshot. **");
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 3)
{
SetPlayerHealth(playerid, 149);
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 4)
{
SetPlayerHealth(playerid, 149);
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 5)
{
SetPlayerHealth(playerid, 149);
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 6)
{
SetPlayerHealth(playerid, 149);
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 7)
{
SetPlayerHealth(playerid, 149);
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 8)
{
SetPlayerHealth(playerid, 149);
}
}
else return 0;
return 1;
}
Why does it happen, and how do I fix that? Thanks in advance!
![Smiley](images/smilies/smile.png)