29.08.2016, 20:07
You have to save players timer id and kill it if they got a damage before the callback of remove get called
also be sure to do that on player connect
PHP код:
new PDamageTimer[MAX_PLAYERS];
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
new gString[128];
format(gString, sizeof gString, "{ff0000}-%.0f",amount);
if(_:PlayerDamage[playerid] != -1)
{
Delete3DTextLabel(PlayerDamage[playerid]);
PlayerDamage[playerid] = Text3D:-1;
KillTimer(PDamageTimer[playerid]);
}
PlayerDamage[playerid] = Create3DTextLabel(gString, 0xFFFFFFFF, 0.0, 0.0, 0.0, 7.5, -1);
Attach3DTextLabelToPlayer(PlayerDamage[playerid], playerid, 0.0, 0.0, 0.4);
PDamageTimer[playerid] = SetTimerEx("RemoveDamageLabel", 3000, false, "d", playerid);
return 1;
}
forward RemoveDamageLabel(playerid);
public RemoveDamageLabel(playerid)
{
Delete3DTextLabel(PlayerDamage[playerid]);
PlayerDamage[playerid] = Text3D:-1;
return 1;
}
PHP код:
PlayerDamage[playerid] = Text3D:-1;