pls help, attach3dtext to player - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: pls help, attach3dtext to player (
/showthread.php?tid=264689)
pls help, attach3dtext to player -
handerson - 27.06.2011
i put this OnPlayerSpawn
Код:
if(GetPlayerSkin(playerid) == 111 || GetPlayerSkin(playerid) == 124 || GetPlayerSkin(playerid) == 70 || GetPlayerSkin(playerid) == 112 ) //assault
{
new Float:X, Float:Y, Float:Z; // GetPlayerPos floats
GetPlayerPos(playerid, X, Y, Z); // Geting player pos
label1[playerid] = Create3DTextLabel("Assault Soldier",COLOR_WHITE,X, Y, Z+2.0,20.0,1);
Attach3DTextLabelToPlayer(label1[playerid],playerid,0,0,0.5);
}
if(GetPlayerSkin(playerid) == 287 || GetPlayerSkin(playerid) == 120 || GetPlayerSkin(playerid) == 68 || GetPlayerSkin(playerid) == 113) //anti-tank
{
new Float:X, Float:Y, Float:Z; // GetPlayerPos floats
GetPlayerPos(playerid, X, Y, Z); // Geting player pos
label2[playerid] = Create3DTextLabel("Anti-Tank",COLOR_GREEN,X, Y, Z+2.0,20.0,1);
Attach3DTextLabelToPlayer(label2[playerid],playerid,0,0,0.5);
}
if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 294 || GetPlayerSkin(playerid) == 59 || GetPlayerSkin(playerid) == 114) //Support Squad
{
new Float:X, Float:Y, Float:Z; // GetPlayerPos floats
GetPlayerPos(playerid, X, Y, Z); // Geting player pos
label3[playerid] = Create3DTextLabel("Support Squad",COLOR_RED,X, Y, Z+2.0,20.0,1);
Attach3DTextLabelToPlayer(label3[playerid],playerid,0,0,0.5);
}
and i put this OnPlayerDeath
Код:
DeletePlayer3DTextLabel(playerid, PlayerText3D:label1[playerid]);
DeletePlayer3DTextLabel(playerid, PlayerText3D:label2[playerid]);
DeletePlayer3DTextLabel(playerid, PlayerText3D:label3[playerid]);
when i spawn with skinid 111, i got assault text, but when i changed skin to anti tank skin, i got double text, assault and anti-tank,,, the problem is i got doble even triple text on my head
pls help
Re: pls help, attach3dtext to player -
[HiC]TheKiller - 27.06.2011
Why not use one variable for all of the labels? Just do this
pawn Код:
new PlayerText3D:label[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
label[playerid] = Create3DTextLabel("Loading...",COLOR_WHITE,X, Y, Z+2.0,20.0,1);
return 1;
}
if(GetPlayerSkin(playerid) == 111 || GetPlayerSkin(playerid) == 124 || GetPlayerSkin(playerid) == 70 || GetPlayerSkin(playerid) == 112 ) //assault
{
new Float:X, Float:Y, Float:Z; // GetPlayerPos floats
GetPlayerPos(playerid, X, Y, Z); // Geting player pos
Update3DTextLabelText(label[playerid], COLOR_WHITE, "Assault Soldier");
Attach3DTextLabelToPlayer(label[playerid],playerid,0,0,0.5);
}
if(GetPlayerSkin(playerid) == 287 || GetPlayerSkin(playerid) == 120 || GetPlayerSkin(playerid) == 68 || GetPlayerSkin(playerid) == 113) //anti-tank
{
new Float:X, Float:Y, Float:Z; // GetPlayerPos floats
GetPlayerPos(playerid, X, Y, Z); // Geting player pos
Update3DTextLabelText(label[playerid], COLOR_GREEN, "Anti-Tank");
Attach3DTextLabelToPlayer(label[playerid],playerid,0,0,0.5);
}
if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 294 || GetPlayerSkin(playerid) == 59 || GetPlayerSkin(playerid) == 114) //Support Squad
{
new Float:X, Float:Y, Float:Z; // GetPlayerPos floats
GetPlayerPos(playerid, X, Y, Z); // Geting player pos
Update3DTextLabelText(label[playerid], COLOR_RED, "Support Squad");
Attach3DTextLabelToPlayer(label[playerid],playerid,0,0,0.5);
}
This means that you will only ever have one variable getting rid of the chance of doubleups.