06.02.2018, 09:48
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
https://sampwiki.blast.hk/wiki/Attach3DTextLabelToPlayer
Untested, let me know if problem persists.
EDIT: I saw that this will not delete the 3Dlabel once created so what you can do is; add timer to delete it.
https://sampwiki.blast.hk/wiki/Attach3DTextLabelToPlayer
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID) // If not self-inflicted
{
new
infoString[128],
victimName[MAX_PLAYER_NAME],
attackerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, victimName, sizeof (victimName));
GetPlayerName(issuerid, attackerName, sizeof (attackerName));
new str[30];
new Float:health;
format(str, sizeof(str), "-%.0f HP\n%d HP Left", amount, GetPlayerHealth(issuerid, health));
new Text3D:HealthLabel = Create3DTextLabel(infoString, 0x00AE00FF, 0,0, 0, 20.0, 0, 1);
Attach3DTextLabelToPlayer(HealthLabel, issuerid, 0.0, 0.0, 2.0);
}
return 1;
}
EDIT: I saw that this will not delete the 3Dlabel once created so what you can do is; add timer to delete it.