Sync Player Health and Armour
#5

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?

Код:
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;
}
Reply


Messages In This Thread
Sync Player Health and Armour - by RedGun2015 - 05.02.2018, 13:33
Re: Sync Player Health and Armour - by Sew_Sumi - 05.02.2018, 14:20
Re: Sync Player Health and Armour - by RedGun2015 - 05.02.2018, 14:24
Re: Sync Player Health and Armour - by Sew_Sumi - 05.02.2018, 14:55
Re: Sync Player Health and Armour - by RedGun2015 - 07.02.2018, 10:13
Re: Sync Player Health and Armour - by Sew_Sumi - 07.02.2018, 16:05
Re: Sync Player Health and Armour - by RedGun2015 - 07.02.2018, 18:57
Re: Sync Player Health and Armour - by Sew_Sumi - 07.02.2018, 21:21
Re: Sync Player Health and Armour - by Mugala - 08.02.2018, 10:27
Re: Sync Player Health and Armour - by Sew_Sumi - 08.02.2018, 10:29

Forum Jump:


Users browsing this thread: 1 Guest(s)