SetPlayerHealth doesn't work
#1

I have a script that decreases player health when 'Fire Power Lvl 1 Boost' is turned on but instead of boosting it resets the player health to 100 every time I shoot an enemy, it's like I have an error in my script and they cannot run it so they just set the guy's health to 100 but Pawno doesn't throw an error.

This is the extracted code from my gamemode script that is related to the Fire Power Boost
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
	if(GetPVarInt(issuerid, "In Use Fire Power Boost LVL 1") == 1 && GetPlayerTeam(playerid) != 0 && GetPlayerTeam(issuerid) == 0)
	{
	    new Float:PlayerHealth;
	    GetPlayerHealth(playerid, PlayerHealth);
	    PlayerHealth = PlayerHealth-(10/100*amount);
	    SetPlayerHealth(playerid, PlayerHealth);
	}
}
I also have a defense boost thingy that uses the same way to increase/decrease player health, I have not tested it but I believe it has the same problem too since it's using the same structure but instead of subtracting, it plus-es

Apart from that I used to have a regeneration script that has the same error, I couldn't solve the problem so I commented all the codes that are related to the regeneration script
Код:
/*new BossHealTimer;
new BossHealInitiate;
new HealTimer;
new HealInitiate;*/



forward BossHeal(playerid);
forward Heal(playerid);



/*public BossHeal(playerid)
{
    BossHealInitiate = 1;
	new Float:BossZMHP;
    GetPlayerHealth(playerid, BossZMHP);
    if(BossZMHP == 0)
    {
    BossHealInitiate = 0;
    KillTimer(BossHealTimer);
    }

    if(BossZMHP < 200 && GetPlayerSkin(playerid) == 264 && GetPlayerTeam(playerid) == 1 && BossHealInitiate == 1)
    {
    BossHealInitiate = 1;
    SetPlayerHealth(playerid, BossZMHP+10);
    }

    if(BossZMHP >= 200 && GetPlayerSkin(playerid) == 264 && GetPlayerTeam(playerid) == 1)
    {
    SetPlayerHealth(playerid, 200);
    BossHealInitiate = 0;
    KillTimer(BossHealTimer);
    }
}*/

/*public Heal(playerid)
{
    HealInitiate = 1;
	new Float:HP;
    GetPlayerHealth(playerid,HP);
    if(HP == 0)
    {
    HealInitiate = 0;
    KillTimer(HealTimer);
    }
    
    new MaxHP = GetPVarInt(playerid, "MaxHP");
    if(HP < MaxHP && GetPlayerTeam(playerid) == 1 && HealInitiate == 1)
    {
    HealInitiate = 1;
    SetPlayerHealth(playerid,HP+5);
    }

    if(HP > MaxHP && GetPlayerTeam(playerid) == 1)
    {
    SetPlayerHealth(playerid, MaxHP);
    HealInitiate = 0;
    KillTimer(HealTimer);
    }
}*/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)