Creating and attaching the labels? -
0ne - 11.04.2010
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

)
Re: Creating and attaching the labels? -
M4S7ERMIND - 11.04.2010
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.
Re: Creating and attaching the labels? -
0ne - 11.04.2010
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?
Re: Creating and attaching the labels? -
M4S7ERMIND - 11.04.2010
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!
Re: Creating and attaching the labels? -
M4S7ERMIND - 11.04.2010
Quote:
|
Originally Posted by 0ne
Btw i get tag mismatches at the code u gave me.. whats wrong?
|
Код:
new Text3D:uLabel[MAX_PLAYERS];
Re: Creating and attaching the labels? -
0ne - 11.04.2010
Thank you very much
Re: Creating and attaching the labels? -
0ne - 11.04.2010
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)
Re: Creating and attaching the labels? -
Amit_B - 11.04.2010
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?
Re: Creating and attaching the labels? -
M4S7ERMIND - 11.04.2010
Its because you cant see textlabel that is attached to you, other players can.
Re: Creating and attaching the labels? -
0ne - 12.04.2010
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?