problem with CreatePlayer3DTextlabel
#1

I tried making a 3dtext label for a player but I am having a problem it is not appearing in the game here is the command



Код:
//somewhere on the top
new PlayerText3D:label;
new teststate;

//command

CMD:test(playerid,params[])
{
	if(IsPlayerAdmin(playerid))
	{
	    if( teststate== 0)
		{
		    teststate=1;
			new Float:x,Float:y,Float:z;
			GetPlayerPos(playerid,x,y,z);
			label = CreatePlayer3DTextLabel(playerid,"Test",PURPLE,x,y,z,40.0,0,0);
			SendClientMessage(playerid,YELLOW,"LabelCreated");
		}
		else if(teststate == 1)
		{
		    teststate=0;
		    DeletePlayer3DTextLabel(playerid,label);
		    SendClientMessage(playerid,YELLOW,"Labeldeleted");
		}
	}
	else
	{
	    SendClientMessage(playerid, RED, "ERROR");
	}
	return 1;
}
any body know what I am doing wrong
Solved

Pawnie Was Right I did not use the right syntax but he gave me the Syntax for Create3DTextLabel & not CreatePlayer3DTextLabel

I forgot to add this to my Code

[CODE]//INVALID_PLAYER_ID,INVALID_VEHICLE_ID[/CODE]

So the Proper code is this

Код:
label = CreatePlayer3DTextLabel(playerid,"Test",PURPLE,x,y,z,40.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0);

//or if you want the attach it to a player

CreatePlayer3DTextLabel(playerid,"Test",PURPLE,x,y,z,40.0,playerid,INVALID_VEHICLE_ID,0)

//or a car

CreatePlayer3DTextLabel(playerid,"Test",PURPLE,x,y,z,40.0,INVALID_PLAYER_ID,vehicleid,0)
Thanks for Helping me and if My solution helped you understand then press that rep button and also for pawnie for helping relize the Syntax was wrong
Reply
#2

label = CreatePlayer3DTextLabel(playerid,"Test",PURPLE,x,y ,z,0,0);

You need
Код:
DrawDistance	The distance from where you are able to see the 3D Text Label
VirtualWorld	The virtual world in which you are able to see the 3D Text
testLOS	0/1 Test the line-of-sight so this text can't be seen through objects
Example:
Код:
Create3DTextLabel("Test", 0x008080FF, x, y, z, 40.0, 0, 0);
also why arent you using
Код:
if(teststate == 0)
Reply
#3

Quote:
Originally Posted by Pawnie
Посмотреть сообщение
label = CreatePlayer3DTextLabel(playerid,"Test",PURPLE,x,y ,z,0,0);

You need
Код:
DrawDistance	The distance from where you are able to see the 3D Text Label
VirtualWorld	The virtual world in which you are able to see the 3D Text
testLOS	0/1 Test the line-of-sight so this text can't be seen through objects
Example:
Код:
Create3DTextLabel("Test", 0x008080FF, x, y, z, 40.0, 0, 0);
also why arent you using
Код:
if(teststate == 0)
Thanks I add a distance but the code seems to still not work
Код:
label = CreatePlayer3DTextLabel(playerid,"Test",PURPLE,x,y,z,40.0,0,0);
Reply
#4

Maybe because you are setting the player right into the state
Код:
if((teststate)==0)
		{
		    teststate=1;
You are setting him into the teststate 1, and there you have callback if his state is 1 it will delete his 3d text.
Reply
#5

no I don't think so because there is and else if statment
Reply
#6

Quote:
Originally Posted by Pawnie
Посмотреть сообщение
Maybe because you are setting the player right into the state
Код:
if((teststate)==0)
		{
		    teststate=1;
You are setting him into the teststate 1, and there you have callback if his state is 1 it will delete his 3d text.
no because of else
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)