Text3D don't remove :(
#1

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


Reply
#2

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.
Reply
#3

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
Reply
#4

It don't work

not have 3dtext on head player TT
Reply
#5

Show your new attempt.
Reply
#6

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
Reply
#7

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.
Reply
#8

who can fix it , help me please
Reply
#9

++

TT
Reply
#10

up up ;(
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)