13.11.2017, 14:40
I'm having some issues with my OnPlayerTakeDamage when being shot it only takes away the health and it completely ignores the Armour. Thanks for the help in advance.
Its from this script btw: https://sampforum.blast.hk/showthread.php?tid=641235
Its from this script btw: https://sampforum.blast.hk/showthread.php?tid=641235
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID)
{
new
Float:health
;
PlayerInfo[playerid][pLastDamagetime] = gettime();
GetPlayerHealth(playerid, health);
if(GetPlayerTeam(playerid) != PLAYER_STATE_ALIVE && PlayerInfo[playerid][pDeathFix])
SetPlayerHealth(playerid, health);
if(GetPlayerTeam(playerid) == PLAYER_STATE_ALIVE)
{
SetPlayerHealth(playerid, health - amount);
CallbackDamages(playerid, issuerid, bodypart, weaponid, amount);
}
if(health - amount <= 4)
{
if(GetPlayerTeam(playerid) == PLAYER_STATE_ALIVE)
{
if(IsPlayerInAnyVehicle(playerid))
ClearAnimations(playerid);
CallLocalFunction("OnPlayerWounded", "iii", playerid, issuerid, weaponid);
return 0;
}
return 0;
}
if(GetPlayerTeam(playerid) == PLAYER_STATE_WOUNDED)
{
if(!PlayerInfo[playerid][pDeathFix])
{
CallLocalFunction("OnPlayerDead", "iiii", playerid, issuerid, weaponid, 1);
return 0;
}
return 0;
}
if(GetPlayerTeam(playerid) != PLAYER_STATE_ALIVE)
{
SetPlayerHealth(playerid, health);
return 0;
}
}
return 1;
}