Formatting
#1

Im using 3d text name tags:
pawn Code:
public OnPlayerSpawn(playerid)
{
new nameformat[30];
new Text3D:playertextid;

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]);
playertextid = Create3DTextLabel(nameformat,COLOR_WHITE,X,Y,Z+0.13,15,0,0);
Update3DTextLabelText(playertextid,COLOR_WHITE,nameformat);
Attach3DTextLabelToPlayer(playertextid, playerid, 0.0, 0.0, 0.13);
}
How can I reformat the name text when you type a command, for example /afk
pawn Code:
if(strcmp(cmd, "/afk", true) == 0)
    {

    }
I want that command to change that original text from
format(razem,sizeof(razem),"%s (%d, %dh)",plname2,playerid,PlayerInfo[playerid][pH]);

to:
format(razem,sizeof(razem),"%s (%d, %dh)\n(AFK)",plname2,playerid,PlayerInfo[playerid][pH]);
Reply
#2

I really need this done, does any one know how to do this?
Reply
#3

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;
}
; )
Reply
#4

pawn Code:
Update3DTextLabelToText(pText[playerid],COLOR_WHITE,nameformat);
Code:
D:\map.pwn(480) : error 017: undefined symbol "Update3DTextLabelToText"
D:\map.pwn(480) : warning 215: expression has no effect
D:\map.pwn(480) : error 001: expected token: ";", but found "]"
D:\map.pwn(480) : error 029: invalid expression, assumed zero
D:\map.pwn(480) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

Can't you just correct yourself, seriously?
pawn Code:
Update3DTextLabelText(pText[playerid],COLOR_WHITE,nameformat);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)