Creating and attaching the labels?
#1

Hey everyone,

I was reading and searching but couldn't find my specific problem, I'm just wondering if anyone could give me an example of creating a 3d textlabel of a written LEVEL "ABOVE" the player's head, and above the level his statu ex: [Player] or [VIP]. (btw the level is: playerdb[playerid][Level], and vip is: [VIP] instead of level..)
If the player dies the label wouldn't be laying around or i need command for it to stay on his head?

Ty if anyone will help me..( OR AT LEAST understood what i wrote above there )
Reply
#2

Create3DTextLabel and Attach3DTextLabelToPlayer.
pawn Код:
//on top
new uLabel[MAX_PLAYERS];

//somewhere in your script
if(playerdb[playerid][VIP]) uLabel[playerid] = Create3DTextLabel("[VIP]", COLOR, 0.0, 0.0, 0.0, 40.0, 0, 0);
else uLabel[playerid] = Create3DTextLabel("[Player]", COLOR, 0.0, 0.0, 0.0, 40.0, 0, 0);
Attach3DTextLabelToPlayer(uLabel[playerid], playerid, 0.0, 0.0, 0.3);
I dont know what happens to text label on player death.. You might haveto Delete3DTextLabel and create new one on player spawn.
Reply
#3

Ty, going to test it soon, but could u give me an level one? like making instead of [VIP] or [Player] : [Lygis: %d]? How could i make it?

EDIT: Btw i get tag mismatches at the code u gave me.. whats wrong?
Reply
#4

pawn Код:
new str[24];
format(str, sizeof(str), "[Level: %d]", playerdb[playerid][Level]);
uLabel[playerid] = Create3DTextLabel(str, COLOR, 0.0, 0.0, 0.0, 40.0, 0, 0);
Have fun!
Reply
#5

Quote:
Originally Posted by 0ne
Btw i get tag mismatches at the code u gave me.. whats wrong?
Код:
new Text3D:uLabel[MAX_PLAYERS];
Reply
#6

Thank you very much
Reply
#7

Tried to test it right now and it doesn't show up above my head or anywhere else.. whats the problem? (Sry for duoble post)
Reply
#8

Quote:
Originally Posted by 0ne
Tried to test it right now and it doesn't show up above my head or anywhere else.. whats the problem? (Sry for duoble post)
Are you sure that you used "Mастерминд"'s code in OnPlayerSpawn and destroyed it when he's dead?
Reply
#9

Its because you cant see textlabel that is attached to you, other players can.
Reply
#10

Really? Cuz when i tried making it with:
Код:
for (new i=0; i<MAX_PLAYERS;i++)
it red my other code which is onplayerspawn in about 3seconds, i spawned in a default spot where i went to the ground and i managed to see the LABEL which was on my head and it was left there, then as i fell through the ground my onplayerspawn started functioning and everything was fine except for label. deleting that for(new i=0..... spawns me normally without any delays and no textlabels, but i guess it's fine right?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)