Name tag -
STONEGOLD - 06.07.2015
Well, I want to do in my script like: if a player is donating player so i want There should "Donating player" on his head. (upto name tag).
Well, How can i?
Re: Name tag -
b3nz - 06.07.2015
When a player connects and his stats are loaded, check if he's a donator and attach a 3D text to his head (get the player's position and add about 0.5 to the player's Z [height] coordinate). Don't forget to delete the created label when the donator disconnects.
Re: Name tag -
STONEGOLD - 06.07.2015
Yeah i know that but i need some codes to understand with explanation. I would be your thankful if you explain with a little bit of codes.
Re: Name tag -
Sime30 - 06.07.2015
Here is everything you need
https://sampwiki.blast.hk/wiki/Attach3DTextLabelToPlayer
Re: Name tag -
suni - 06.07.2015
Quote:
new Text3D:VIPtag[MAX_PLAYERS]; //somewhere in the script
//under onplayerspawn
if(PlayerAcc[playerid][Vip] >= 1)/// replace this code with your
{
new Text3D:VIPtag = Create3DTextLabel("Donating player", COLOR_ORANGE, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(VIPtag, playerid, 0.0, 0.0, 0.7);
}
|
you mean like this?
Re: Name tag -
STONEGOLD - 06.07.2015
Well, where to put this?
PHP код:
if(pData[playerid][pDonator] == 1)
{
new Text3D:label = Create3DTextLabel("Donating Player", RED, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
return 1;
}
I placed it onplayerconnect but its not showing "donating player" above player's head.
Re: Name tag -
suni - 06.07.2015
put it under onplayerspawn
Re: Name tag -
STONEGOLD - 06.07.2015
VIPtag[playerid]? VIPTAG? should i write pdonator[playerid] ?
Re: Name tag -
suni - 06.07.2015
aw, put this under onplayerdisconnect
Quote:
Delete3DTextLabel(Label[playerid]);
|
Re: Name tag -
b3nz - 06.07.2015
It's not showing because you set the coordinates wrong. You must attach it to player's current coordinates with a little boost of Z coordinate:
pawn Код:
new Float: posX, Float: posY, Float: posZ;
GetPlayerPos (playerid, posX, posY, posZ);
new Text3D:label = Create3DTextLabel("Donating Player", RED, posX, posY, posZ + 0.5, 40.0, 0);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
Anyway, doing it this way, you won't be able to delete the text when a donator disconnects. In order to fix this, you need to create a global array:
pawn Код:
new Text3D:donatorText[MAX_PLAYERS];
<..> when a donator connects
new Float: posX, Float: posY, Float: posZ;
GetPlayerPos (playerid, posX, posY, posZ);
donatorText [playerid] = Create3DTextLabel ("Donating Player", RED, posX, posY, posZ + 0.5, 40.0, 0);
Attach3DTextLabelToPlayer (donatorText [playerid], playerid, 0.0, 0.0, 0.7);
<...> when a donator disconnects
Delete3DTextLabel (donatorText [playerid]);