Attach3DTextLabelToPlayer -
rhds - 29.03.2013
I'm trying to show player's ID above their head, but something is terribly wrong. Nothing is appearing so I guess the problem is within those coordinates?
pawn Код:
public OnPlayerConnect(playerid)
{
new
string[32],
name[MAX_PLAYER_NAME],
Text3D:label = Create3DTextLabel(string, White, 30.0, 40.0, 50.0, 40.0, 0);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "ID: %i", GetPlayerID(name));
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
return 1;
}
pawn Код:
stock GetPlayerID(const name[])
{
new pName[MAX_PLAYER_NAME];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerName(i, pName, MAX_PLAYER_NAME);
if(!strcmp(pName, name))
return i;
}
return INVALID_PLAYER_ID;
}
Re: Attach3DTextLabelToPlayer -
Pottus - 29.03.2013
Don't try and do this, attaching 3d labels is very buggy.
Re: Attach3DTextLabelToPlayer -
SuperViper - 29.03.2013
You have the player's ID already, why would you get their name from their ID and then do vice versa?
pawn Код:
public OnPlayerConnect(playerid)
{
new string[32];
format(string, sizeof(string), "ID: %i", playerid);
Attach3DTextLabelToPlayer(Create3DTextLabel(string, White, 30.0, 40.0, 50.0, 40.0, 0), playerid, 0.0, 0.0, 0.7);
return 1;
}
Re: Attach3DTextLabelToPlayer -
rhds - 30.03.2013
Lol you're right. Thanks.
Quote:
Originally Posted by [uL]Pottus
Don't try and do this, attaching 3d labels is very buggy.
|
I read that chat bubbles are even worse because they need timers?
Re: Attach3DTextLabelToPlayer -
Pottus - 30.03.2013
Chat bubbles are built directly into SAMP.
https://sampwiki.blast.hk/wiki/SetPlayerChatBubble
Re: Attach3DTextLabelToPlayer -
rhds - 30.03.2013
Quote:
Originally Posted by [uL]Pottus
|
Chat bubbles have expire time, I need a permanent one.
Re: Attach3DTextLabelToPlayer -
rhds - 30.03.2013
pawn Код:
public OnPlayerSpawn(playerid)
{
new
string[32],
Text3D:label = CreateDynamic3DTextLabel(string, White, 0, 0, 0.1, 10, playerid, INVALID_VEHICLE_ID, -1, -1 ,-1, -1);
format(string, sizeof(string), "Player's ID: %i", playerid);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.1);
return 1;
}
Still not appearing. Appears trough a command, but that's not the point.
Re: Attach3DTextLabelToPlayer -
Apenmeeuw - 30.03.2013
Use this at onplayerupdate.
https://sampwiki.blast.hk/wiki/CreatePlayer3DTextLabel
pawn Код:
new PlayerText3D:label;
// check here if the player is near the player that has the label, if not it wont show for him, else it will.
// if the player is near him:
label = CreatePlayer3DTextLabel(playerid, ....);
// else destroy it.
Re: Attach3DTextLabelToPlayer -
rhds - 30.03.2013
I'm using a streamer. I tried placing the code under OnPlayerUpdate and it still won't show up.