This is all I've got for you so far...
pawn Код:
new Text3D:RankLabel[MAX_PLAYERS];
new RankLabelActive[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
RankLabelActive[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
SetRank3DText(playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(RankLabelActive[playerid] != 0)
{
Delete3DTextLabel(RankLabel[playerid]);
RankLabelActive[playerid] = 0;
}
return 1;
}
stock SetRank3DText(playerid)
{
new text[128], Float: XYZ[3];
GetPlayerPos(playerid, XYZ[0], XYZ[1], XYZ[2]);
if(RankLabelActive[playerid] == 0)
{
RankLabel[playerid] = Create3DTextLabel(text, 0x15FF00AA, XYZ[0], XYZ[1], XYZ[2] + 0.5, 100.0, 0, 0);
RankLabelActive[playerid] = 1;
}
if(aDuty[playerid] == 1)
{
if(AFK[playerid] == 1)
{
format(text, sizeof(text), "Administrator on duty and AFK\nDo not damage!");
Update3DTextLabelText(RankLabel[playerid], 0x15FF00AA, text);
}
else
{
format(text, sizeof(text), "Administrator on duty\nDo not damage!");
Update3DTextLabelText(RankLabel[playerid], 0x15FF00AA, text);
}
}
else
{
if(AFK[playerid] == 1)
{
format(text, sizeof(text), "AFK");
Update3DTextLabelText(RankLabel[playerid], 0x2143DBFF, text);
}
else
{
format(text, sizeof(text), "%s\n%s", RankName(playerid), ClassName(playerid));
Update3DTextLabelText(RankLabel[playerid], TeamColor(playerid), text);
}
}
Attach3DTextLabelToPlayer(RankLabel[playerid], playerid, 0.0, 0.0, 0.5);
return 1;
}
Obviously, don't replace the callbacks entirely, just add these bits in to the appropriate callbacks...
EDIT: Obviously, you can add this to a timer, because OnPlayerSpawn updates the text, and I'm sure it gets updated more than once when a player spawns, so a timer would be a better option... in that case:
pawn Код:
public OnPlayerConnect(playerid)
{
SetTimerEx("UpdateText", 5000, true, "i", playerid);
return 1;
}
forward UpdateText(playerid);
public UpdateText(playerid)
{
SetRank3DText(playerid);
return 1;
}