SA-MP Forums Archive
3DTextLabel set string ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 3DTextLabel set string ? (/showthread.php?tid=221113)



3DTextLabel set string ? - BlackWolf120 - 04.02.2011

hi,
i ve been trying this for so long and i just dont get it!

Ive created text labels over the head of every player depending on their team.
Well it works but i want that there is also their rank displayed after the team name.
Ive tried it with UpdatePlayer3DTextLabelText but i just dont know how, i always get a missmatch error or warning!


pawn Код:
ranklabelCTU[playerid] = Create3DTextLabel("{1464F4}CTU",0xF97804FF,30.0,40.0,50.0,40.0,0);
    ranklabelSNAKES[playerid] = Create3DTextLabel("{CC3232}Coral Snake",0xF97804FF,30.0,40.0,50.0,40.0,0);


    {
    switch (gTeam[playerid])
    {
    case 1: //police
    {
    Attach3DTextLabelToPlayer(ranklabelCTU[playerid], playerid, 0.0, 0.0, 0.5);
    }

    case 2: //terrorists
    {
    Attach3DTextLabelToPlayer(ranklabelSNAKES[playerid], playerid, 0.0, 0.0, 0.5);
    }
    }

    }

// i had to do sth. like this but i get a missmatch warning or sth....

//this is how my ranks are saved:
RankName[pRank[playerid]]

UpdatePlayer3DTextLabelText(playerid, ranklabelCTU[playerid], color, "CTU %d",RankName[pRank[playerid]])
hope i get some help

regards...


Re: 3DTextLabel set string ? - Fj0rtizFredde - 04.02.2011

You should format it
pawn Код:
new blah[80];
format(blah, sizeof(blah), "CTU %d", RankName[pRank[playerid]]);
UpdatePlayer3DTextLabelText(playerid, ranklabelCTU[playerid], color, blah);



Re: 3DTextLabel set string ? - BlackWolf120 - 04.02.2011

thank you fredde,

but it gives me a warning:

pawn Код:
warning 213: tag mismatch

    Attach3DTextLabelToPlayer(ranklabelCTU[playerid], playerid, 0.0, 0.0, 0.5);
    new labelstring[50];
    format(labelstring, sizeof(labelstring), "{1464F4}CTU {20B2AA}%d", RankName[pRank[playerid]]);
    UpdatePlayer3DTextLabelText(playerid, ranklabelCTU[playerid], 0xF97804FF, labelstring); //here



Re: 3DTextLabel set string ? - Fj0rtizFredde - 04.02.2011

Well.. You create a normal 3DTextLabel but you update a player text label.. So idk how you want it but I think you should change it to:
pawn Код:
Update3DTextLabelText(ranklabelCTU[playerid], 0xF97804FF, labelstring);



Re: 3DTextLabel set string ? - BlackWolf120 - 05.02.2011

thx.

im gonna try it out tomorrow.
im too lazy right now

regards...