27.07.2013, 06:19
Try something like:
Just make your own textraw to fit your needs
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;
}