Help Please Health change
#1

hi a little Help please thanks i want to make so when health drops it will do somthing i can only figure how to make it do somthing on change as i want it to do somthing when it drop's not when it goes back up this is my bit of code any help please thanks alot.

pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:Life;
new Float:Oldhealth,Float:newhealth;
GetPlayerHealth(playerid, Life);
if (PlayerLife[playerid] != Life)
{
HealthChange(playerid, Oldhealth, newhealth);
PlayerLife[playerid] = Life;
}
return 1;
}

forward HealthChange(playerid, Float:Oldhealth, Float:newhealth);
public HealthChange(playerid, Float:Oldhealth, Float:newhealth)
{
// ill add my bit of code here! :D
return 1;
}

thanks for your help
Reply
#2

pff apparently not?
Reply
#3

Quote:
Originally Posted by [SU
BP13 ]
Here's a snippet from Seif.

pawn Код:
new Float:PlayerHP[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    PlayerHP = 100.0;
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new Float:hp;
    GetPlayerHealth(playerid, hp);
    if (PlayerHP[playerid] != hp)
    {
        OnPlayerHealthChange(playerid, oldhealth, newhealth);
        PlayerHP[playerid] = hp;
    }
    return 1;
}

public OnPlayerHealthChange(playerid, Float:oldhealth, Float:newhealth)
{
    // And with this, you can detect if a player's health has changed.
    return 1;
}
so you cant help
Reply
#4

BUMP
Reply
#5

You have the code right there
Reply
#6

but when my health goes up it still does it i want it to only do it when health drops.
Reply
#7

BUMP!
Reply
#8

pawn Код:
new Float:PlayerHP[MAX_PLAYERS];
forward OnPlayerHealthReduced(playerid, Float:hp);

public OnPlayerConnect(playerid)
{
    PlayerHP = 100.0;
    return 1;
}

public OnPlayerUpdate(playerid)
{
     new Float:hp;
    GetPlayerHealth(playerid, hp);
    if (PlayerHP[playerid] > hp)
    {
        OnPlayerHealthChange(playerid, oldhealth, newhealth);
    }
    PlayerHP[playerid] = hp;
    return 1;
}

public OnPlayerHealthReduced(playerid, Float:hp)
{
    // And with this, you can detect if a player's health has changed.
    return 1;
}
Now shut the hell up.
Reply
#9

****** has a OnPlayerHealthChange & OnPlayerArmourChange in YUP.
I suggest you to use it.
Reply
#10

Quote:
Originally Posted by Tree of Fat
pawn Код:
new Float:PlayerHP[MAX_PLAYERS];
forward OnPlayerHealthReduced(playerid, Float:hp);

public OnPlayerConnect(playerid)
{
    PlayerHP = 100.0;
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new Float:hp;
    GetPlayerHealth(playerid, hp);
    if (PlayerHP[playerid] > hp)
    {
        OnPlayerHealthChange(playerid, oldhealth, newhealth);
    }
    PlayerHP[playerid] = hp;
    return 1;
}

public OnPlayerHealthReduced(playerid, Float:hp)
{
    // And with this, you can detect if a player's health has changed.
    return 1;
}
Now shut the hell up.
correction: PlayerHP[playerid] = 100.0;

"Now shut the hell up." mlol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)