Health and Armor Textdraw
#3

Try something like:

pawn Код:
new
    timerHealth,
    Text: textdrawid[MAX_PLAYERS];

// OnGameModeInit
timerHealth = SetTimer("UpdateHealth", 1000, true); // A repeating timer each second

//On Player Connect
textdrawid[playerid] = TextDrawCreate(...);

TextDrawShowForPlayer(playerid, textdrawid[playerid]);

//On Player Disconnect
TextDrawHideForPlayer(playerid, textdrawid[playerid]);

forward UpdateHealth();
public UpdateHealth()
{
    new
        stringHealth[50],
        Float: health[2];

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i) || IsPlayerNPC(i)) // We don't update the health of players not connected and NPC's
            continue;

        GetPlayerHealth(i, health[0]);
        GetPlayerArmour(i, health[1]);

        format(stringHealth, sizeof(stringHealth), "Health: %.0f - Armour: %.0f", health[0], health[1]);
        TextDrawSetString(textdrawid[i], stringHealth);
    }
    return 1;
}
Just make your own textraw to fit your needs
Reply


Messages In This Thread
Health and Armor Textdraw - by ToiletDuck - 27.07.2013, 01:22
Re: Health and Armor Textdraw - by NotIntegrated - 27.07.2013, 02:20
Re: Health and Armor Textdraw - by -Prodigy- - 27.07.2013, 06:19

Forum Jump:


Users browsing this thread: 1 Guest(s)