PDA

View Full Version : Show name with sniper


deathrunner
28/07/2013, 11:23 AM
Hallo,

I want that if a player looks through the visor of a sniper, the names of the other players are displayed. I tried it just as it is not somehow


if(GetPlayerWeapon(playerid) == 34 && !IsPlayerInAnyVehicle(playerid))
{
new PlayerText3D:snipertext[MAX_PLAYERS];
if(PRESSED(KEY_HANDBRAKE))
{
for(new i; i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(i, X, Y, Z);
new string[128];
format(string,sizeof(string),"%s",PName[i]);
snipertext[i] = CreatePlayer3DTextLabel(playerid,string,0x008080FF ,X,Y,Z+1,315.0,i);
}
}
}
else if(RELEASED(KEY_HANDBRAKE))
{
for(new i; i<MAX_PLAYERS;i++)
{
DeletePlayer3DTextLabel(playerid,snipertext[i]);
}
}
}

NotIntegrated
28/07/2013, 11:28 AM
From what you posted, you are just creating the 3DTextDraw, not actually attaching it to the player (http://wiki.sa-mp.com/wiki/Attach3DTextLabelToPlayer).

Edit: My apologies I misread your code, well try creating a normal textdraw and then attaching it to the player, I have certain labels for my gamemode, and this method worked for me (0.3 or 0.2 on the z axis should place it above the players head).

deathrunner
28/07/2013, 11:34 AM
1. i dont see any 3dtext
2. http://wiki.sa-mp.com/wiki/CreatePlayer3DTextLabel i attach it to the player

deathrunner
28/07/2013, 12:16 PM
But, only the sniper should see the names