3DTextLabel bug
#1

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID) // If not self-inflicted
{
new
weaponName[24],
victimName[MAX_PLAYER_NAME],
attackerName[MAX_PLAYER_NAME];

GetPlayerName(playerid, victimName, sizeof (victimName));
GetPlayerName(issuerid, attackerName, sizeof (attackerName));
GetWeaponName(weaponid, weaponName, sizeof (weaponName));
if (IsHurt[playerid] == 0)
{
new string[64];
format(string,sizeof(string),"(( Was hit %d times, Weapon: %s ))", amount, weaponName);
new Text3D:wounded;
wounded = Create3DTextLabel(string, 0xAA3333AA, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(wounded, playerid, 0.0, 0.0, 0.7);
}
}
return 1;
}


Okay so I have this line, it doesn't have any erros and it works. But when I shot him, it makes a double label. How do I stop it. When he is hurt. The label creates. But theres like two or three labels and you can't see what it says. Please help!
Reply
#2

Use variable for all players new Text3D:wounded[MAX_PLAYERS];
Then Use SetTimerEx to delete created label after some time. Delete3DTextLabel(wounded[playerid]).

For example SetTimerEx("Delete3D", 5000, false, "i", playerid); //delete label after 5 seconds

forward Delete3D(playerid);

public Delete3D(playerid)
{
Delete3DTextLabel(wounded[playerid]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)