New name tags -
HondaCBR - 28.12.2011
I want to use 3d text for name tags and disable the default ones. Would this work?
Also the name needs to be visible for everyone (15) dis next to you, but not visible to yourself.
pawn Код:
public OnPlayerConnect(playerid)
{
new plname2[MAX_PLAYER_NAME];
new nameformat[30];
new PlayerText3D:playertextid;
new Float:X, Float:Y, Float:Z;
GetPlayerName(playerid, plname2, sizeof(plname2));
GetPlayerPos(playerid,X,Y,Z);
format(nameformat,sizeof(nameformat),"%s",plname2);
playertextid = CreatePlayer3DTextLabel(playerid,nameformat,COLOR_WHITE,X,Y,Z,15.0);
Attach3DTextLabelToPlayer(Text3D:playertextid, playerid, 0.0, 0.0, 0.7);
Will this work?
Re: New name tags -
Steven82 - 28.12.2011
Try it. But on your Z coordinate, you need to add more than GetPlayerPos value. If you add to the Z cord, it will raise above your head, and if you lower it, it will of course lower.
Re: New name tags -
HondaCBR - 28.12.2011
I posted it because I cant try it right now, no one will come online to come on server at this time :P ill try it tomorrow, just check through if you can If i didnt make any mistakes.
Re: New name tags -
MP2 - 28.12.2011
It's best to use chat bubbles, as they move up as players get further away - 3D text labels do not.
https://sampwiki.blast.hk/wiki/SetPlayerChatBubble
Re: New name tags -
HondaCBR - 28.12.2011
Ok this code works fine:
The name comes up, but it doesnt move with the player, it stays at spawn.
pawn Код:
public OnPlayerSpawn(playerid)
{
new plname2[MAX_PLAYER_NAME];
new nameformat[30];
new PlayerText3D:playertextid;
new Float:X, Float:Y, Float:Z;
GetPlayerName(playerid, plname2, sizeof(plname2));
GetPlayerPos(playerid,X,Y,Z);
format(nameformat,sizeof(nameformat),"%s",plname2);
for(new i = 0; i < MAX_PLAYERS; i++)
{
playertextid = CreatePlayer3DTextLabel(i,nameformat,COLOR_WHITE,X,Y,Z,15.0);
}
Attach3DTextLabelToPlayer(Text3D:playertextid, playerid, 0.0, 0.0, 2.7);
}
Re: New name tags -
HondaCBR - 28.12.2011
Ok I fixed it.
This works now, so if anyone wants to use it I recommend it. Its better because you could do:
format(nameformat,sizeof(nameformat),"%s\nSeat Belts",plname2); //for example
So when you get in a car and type /sb, a thing comes underneath your name with that information, and there are many more uses like Strength: %d, if you have a gym workout script.
So it works finr, I recommend it, thx for everyone who helped.
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerColor(playerid,COLOR_WHITE);
new plname2[MAX_PLAYER_NAME];
new nameformat[30];
new Text3D:playertextid;
new Float:X, Float:Y, Float:Z;
GetPlayerName(playerid, plname2, sizeof(plname2));
GetPlayerPos(playerid,X,Y,Z);
format(nameformat,sizeof(nameformat),"%s",plname2);
playertextid = Create3DTextLabel(nameformat,COLOR_WHITE,X,Y,Z+1.1,15,0,0);
Attach3DTextLabelToPlayer(playertextid, playerid, 0.0, 0.0, 1.1);
}