Player3DLabels. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player3DLabels. (
/showthread.php?tid=353635)
Player3DLabels. -
iGetty - 23.06.2012
I've got a problem with my displaying of 3D Text Labels not showing when I ask them to be.
Here is what I have:
pawn Код:
command(mask, playerid, params[])
{
if(Player[playerid][Level] >= 5)
{
if(Player[playerid][Mask] == 1)
{
if(MaskOn[playerid] == 0)
{
new string[256];
MaskOn[playerid] = 1;
new rand = 1000 + random(8999);
MaskNumber[playerid] = rand;
format(string, sizeof(string), "* %s takes out a mask and places it over their head. *", MaskOnOff(playerid));
CloseMessage(playerid, ACTION, string);
format(string, sizeof(string), "Stranger_%d", MaskNumber[playerid]);
Update3DTextLabelText(masklabel[playerid], GREY, string);
Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
}
else return SendClientMessage(playerid, WHITE, "You already have your mask on.");
}
else return SendClientMessage(playerid, WHITE, "You don't have a Mask.");
}
else return SendClientMessage(playerid, WHITE, "You must be level 5 and above to use a mask.");
return 1;
}
Above is the command to get them to be attatched to the player.
Here is OnPlayerConnect:
pawn Код:
public OnPlayerConnect(playerid)
{
masklabel[playerid] = Create3DTextLabel(" ", GREY, -1.0, -1.0, -1.0, -1.0, 0);
Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
return 1;
}
Here is OnPlayerUpdate:
pawn Код:
public OnPlayerUpdate(playerid)
{
if(MaskOn[playerid] == 1)
{
new string[256];
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, false);
}
format(string, sizeof(string), "Stranger_%d", MaskNumber[playerid]);
Update3DTextLabelText(masklabel[playerid], GREY, string);
Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
}
return 1;
}
Here is the /unmask command:
pawn Код:
command(unmask, playerid, params[])
{
if(Player[playerid][Mask] == 1)
{
if(MaskOn[playerid] == 1)
{
new string[256];
MaskOn[playerid] = 0;
format(string, sizeof(string), "* %s takes off their mask. *", MaskOnOff(playerid));
CloseMessage(playerid, ACTION, string);
MaskNumber[playerid] = -1;
Update3DTextLabelText(masklabel[playerid], GREY, string);
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
}
else return SendClientMessage(playerid, WHITE, "You don't have your mask on.");
}
else return SendClientMessage(playerid, WHITE, "You don't have a Mask.");
return 1;
}
The problem is, once again; That the players 3d label doesn't appear on the player's head.
Thanks!
Re: Player3DLabels. -
iGetty - 26.06.2012
Bump.
Re: Player3DLabels. -
MadeMan - 26.06.2012
Only others can see the labels attached to you. So you can't see the label attached on another player?
Re: Player3DLabels. -
iGetty - 26.06.2012
I can't see it, nope.
Re: Player3DLabels. -
Grand_Micha - 26.06.2012
How did you create them?
masklabel[playerid] = Text3D:Create3DTextLabel(....) is how you do it.
Re: Player3DLabels. -
iGetty - 26.06.2012
Yes.
Re: Player3DLabels. -
iGetty - 28.06.2012
Bumpeeeeeeeeeeeeeeeedy bump. :3