22.12.2013, 12:40
Handle textlabels like this:
This is an simple example, ofc you have to adjust this to your needs (change "label[playerid]" to your labelID ect).
This is a very simpel method and will work for sure!
I also had issues regarding this in the past but this method fixed it.
Hope this helps
pawn Код:
new Text3D:label[MAX_PLAYERS],
Admin[MAX_PLAYERS];
public OnGameModeInit()//just create it here, we update it later
{
foreach(Player,i)
{
label[i] = Create3DTextLabel("", -1, 0, 0, 0, 10.0, 0, 0);
}
return 1;
}
public OnPlayerSpawn(playerid)//we update it on spawn and attach it to the player
{
if(Admin[playerid]>0)//if player is admin, update the admin label
{
s[24];
format(s, sizeof(s), "%s", Admin[playerid]);
Update3DTextLabelText(label[playerid],-1,s);
}
else Update3DTextLabelText(label[playerid],-1," ");//else delete/emtpy it
Attach3DTextLabelToPlayer(label[playerid], playerid, 0, 0, 0.3);
return 1;
}
//In case you want to "delete" the label, just empty it using:
Update3DTextLabelText(label[playerid], -1, " ");
This is a very simpel method and will work for sure!
I also had issues regarding this in the past but this method fixed it.
Hope this helps