07.02.2018, 10:13
I try using OnPlayerTakeDamage, but the player health is restored now when a another player cames to him and try to beat him (with punch).
So a player has for example 50 hp. And another player cames to him and give him a punch, his health need to decrease , for example -5 hp, so the player should have 45 hp, but Player HP will restored to last HP (50). I don't know why, how can I fix this?
So a player has for example 50 hp. And another player cames to him and give him a punch, his health need to decrease , for example -5 hp, so the player should have 45 hp, but Player HP will restored to last HP (50). I don't know why, how can I fix this?
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(issuerid == INVALID_PLAYER_ID) { new Float: HP; GetPlayerHealthEx(playerid,HP); new Float: remainHP = HP - amount; SetPlayerHealthEx ( playerid, remainHP ); if ( remainHP <= 1 ) { OnPlayerDeath( playerid, INVALID_PLAYER_ID, weaponid ); SetPlayerHealthEx ( playerid, 0.0 ); playerdeath[playerid] = 1; } } return 1; }