29.12.2011, 08:26
You need to global the players label.
; )
pawn Code:
new Text3D:pTextID[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
new nameformat[30];
SetPlayerColor(playerid,COLOR_WHITE);
new plname2[MAX_PLAYER_NAME];
new Float:X, Float:Y, Float:Z;
GetPlayerName(playerid, plname2, sizeof(plname2));
GetPlayerPos(playerid,X,Y,Z);
format(nameformat,sizeof(nameformat),"%s (%d, %dh)",plname2,playerid,PlayerInfo[playerid][pH]);
pTextID[playerid] = Create3DTextLabel(nameformat,COLOR_WHITE,X,Y,Z+0.13,15,0,0);
Update3DTextLabelText(pTextID[playerid],COLOR_WHITE,nameformat);
Attach3DTextLabelToPlayer(pTextID[playerid], playerid, 0.0, 0.0, 0.13);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
new
nameformat[30],
pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
format(nameformat,sizeof(nameformat),"%s (%d, %dh) | AFK",pName,playerid,PlayerInfo[playerid][pH]);
Update3DTextLabelToText(pText[playerid],COLOR_WHITE,nameformat);
return 1;
}
return 0;
}