SA-MP Forums Archive
Text3D don't remove :( - 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: Text3D don't remove :( (/showthread.php?tid=567496)



Text3D don't remove :( - haloweenll - 14.03.2015

i create text3d for guild name in head player

Код:
new Text3D:Gang3d3[MAX_PLAYERS];

public onplayerupdate(playerid)
{
	if(PlayerInfo[playerid][pMember] == 1 ||PlayerInfo[playerid][pLeader] == 1)
		{
		    
		    format(sStr, sizeof(sStr),"Dell");
	            Update3DTextLabelText(Gang3d3[playerid], 0xFFFFFF, "");
    		    Gang3d3[playerid] = Create3DTextLabel( sStr,COLOR_WHITE, 30.0,40.0,50.0,50.0,0);
	            Attach3DTextLabelToPlayer( Gang3d3[playerid],playerid, 0.0, 0.0, 0.3);

                   }
          if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
		 {
		    
                     format(sStr, sizeof(sStr),"Acer");
		     Update3DTextLabelText(Gang3d3[playerid], 0x0000F9FF, "");
    		     Gang3d3[playerid] = Create3DTextLabel( sStr, 0x0000F9FF, 30.0,40.0,50.0,50.0,0);
		     Attach3DTextLabelToPlayer(Gang3d3[playerid],playerid, 0.0, 0.0, 0.3);
		}       
}
public OnPlayerConnect(playerid)
{
	Delete3DTextLabel(Gang3d3[playerid]);
}
public OnPlayerDisconnect(playerid,reason)
{
        Delete3DTextLabel(Gang3d3[playerid]);
}

/// and on my exist guild 
        Delete3DTextLabel(Gang3d3[playerid]);
but when my exist guild and join new guild
old Text3D don't delete , and new Text3D does add


Can fix this problem ? thankyou





Re: Text3D don't remove :( - CalvinC - 14.03.2015

You're creating millions of text labels, you should create it in OnPlayerConnect, not in OnPlayerUpdate.
If the player has 60 FPS, OnPlayerUpdate will be called 60 times a second, which means it'll create 60 3DTextLabels and attach it to the same player 60 times a second.


Re: Text3D don't remove :( - haloweenll - 14.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
You're creating millions of text labels, you should create it in OnPlayerConnect, not in OnPlayerUpdate.
If the player has 60 FPS, OnPlayerUpdate will be called 60 times a second, which means it'll create 60 3DTextLabels and attach it to the same player 60 times a second.
thank you , i will test it


Re: Text3D don't remove :( - haloweenll - 14.03.2015

It don't work

not have 3dtext on head player TT


Re: Text3D don't remove :( - CalvinC - 14.03.2015

Show your new attempt.


Re: Text3D don't remove :( - haloweenll - 14.03.2015

Quote:

new Text3D:Gang3d3[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
new Float:X, Float:Y, Float:Z;
new sStr[100];
GetPlayerPos(playerid,X,Y,Z);

if(PlayerInfo[playerid][pMember] == 1 ||PlayerInfo[playerid][pLeader] == 1)//µУГЗЁ
{

format(sStr, sizeof(sStr),"Acer");
Gang3d3[playerid] = Create3DTextLabel( sStr, 0x0000F9FF, 30.0,40.0,50.0,50.0,0);
Attach3DTextLabelToPlayer(Gang3d3[playerid],playerid, 0.0, 0.0, 0.3);

}
if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
{

format(sStr, sizeof(sStr),"Dell");
Gang3d3[playerid] = Create3DTextLabel( sStr, 10079487, 30.0,40.0,50.0,50.0,0);
Attach3DTextLabelToPlayer(Gang3d3[playerid], playerid,0.0, 0.0, 0.3);

}
}
public OnPlayerDisconnect(playerid,reason)
{
Delete3DTextLabel(Gang3d3[playerid]);
}
This new code


Re: Text3D don't remove :( - Vince - 14.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
If the player has 60 FPS, OnPlayerUpdate will be called 60 times a second
That isn't entirely accurate. The amount of updates depends on what the player is doing and has little to do with FPS. Standing still and doing nothing obviously requires much less updates than racing through San Andreas at high speeds.


Re: Text3D don't remove :( - haloweenll - 14.03.2015

who can fix it , help me please


Re: Text3D don't remove :( - haloweenll - 15.03.2015

++

TT


Re: Text3D don't remove :( - haloweenll - 16.03.2015

up up ;(