Код:
if(PlayerInfo[playerid][pHealth] < 10)
{
ShowNameTags(false);
new playername2[24];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(playername2, sizeof(playername2), "%s", name);
new Text3D:attachplayername = Create3DTextLabel(playername2, COLOR_RED, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(attachplayername, playerid, 0.0,0.0,0.2);
}
else
{
ShowNameTags(false);
new playername2[24];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(playername2, sizeof(playername2), "%s", name);
new Text3D:attachplayername = Create3DTextLabel(playername2, COLOR_WHITE, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(attachplayername, playerid, 0.0,0.0,0.2);
}
pawn Код:
ShowNameTags(false);
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof(name));
new Text3D:attachplayername = Create3DTextLabel(name, (PlayerInfo[playerid][pHealth] < 10 ? COLOR_RED : COLOR_WHITE), 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(attachplayername, playerid, 0.0,0.0,0.2);
In what scope are you working? (some callback? command?) I suggest using Update3DTextLabelText instead of recreating the 3d label every time.