SA-MP Forums Archive
problem with CreatePlayer3DTextlabel - 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: problem with CreatePlayer3DTextlabel (/showthread.php?tid=426369)



problem with CreatePlayer3DTextlabel[Solved] - horsemeat - 28.03.2013

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


Re: problem with CreatePlayer3DTextlabel - Pawnie - 28.03.2013

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)



Re: problem with CreatePlayer3DTextlabel - horsemeat - 28.03.2013

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);



Re: problem with CreatePlayer3DTextlabel - Pawnie - 28.03.2013

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.


Re: problem with CreatePlayer3DTextlabel - horsemeat - 28.03.2013

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


Re: problem with CreatePlayer3DTextlabel - horsemeat - 28.03.2013

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