SA-MP Forums Archive
Attach3DTextLabelToPlayer - 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: Attach3DTextLabelToPlayer (/showthread.php?tid=596538)



Attach3DTextLabelToPlayer - GeneralAref - 19.12.2015

i have this command but icant see admin on duty! and given me 1 warning.
Код:
CMD:aduty(playerid) 
{
	if(PlayerInfo[playerid][pAdmin] >=2 || IsPlayerAdmin(playerid))
	{
		if (aDuty[playerid] == 0)
		{
            oldcolor[ playerid ] = GetPlayerColor( playerid );
  			oldskin[ playerid ] = GetPlayerSkin( playerid );
  			label = Create3DTextLabel("Admin on duty!", COLOR_PINK, 30.0, 40.0, 50.0, 40.0, 0);
    		Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
			SetPlayerHealth(playerid,9999999);
			ResetPlayerWeapons(playerid);
			SetPlayerColor(playerid,COLOR_PINK);
			SetPlayerSkin(playerid,217);
			GivePlayerWeapon(playerid, 38, 9999999);
			SendClientMessage(playerid,COLOR_PINK,"You are now on duty!");
			aDuty[playerid] = 1; 
			asay[playerid] = 1;
		}
		else if (aDuty[playerid] == 1) 
		{
		    DeletePlayer3DTextLabel(playerid, label);
  			ResetPlayerWeapons(playerid);
     		SetPlayerHealth(playerid,100);
	 		SpawnPlayer(playerid);
			SendClientMessage(playerid, COLOR_PINK,"You are now off duty!");
			SetPlayerSkin(playerid,oldskin[playerid]);
		 	SetPlayerColor(playerid,oldcolor[playerid]); 
			aDuty[playerid] = 0; 
			asay[playerid] = 0;
		}
 	}
	else
	SendClientMessage(playerid,COLOR_RED,"You do not have permission to use this command!");
	return 1;
}



Re: Attach3DTextLabelToPlayer - Vince - 19.12.2015

You cannot see labels attached to yourself. Also I cannot guess what that "1 warning" is.


Re: Attach3DTextLabelToPlayer - GeneralAref - 19.12.2015

Код:
C:\Users\Aref\Desktop\Aref\sampserver\pawno\CODv2.pwn(919) : warning 213: tag mismatch
919 = DeletePlayer3DTextLabel(playerid, label);



Re: Attach3DTextLabelToPlayer - Sawalha - 19.12.2015

make sure that you assigned Text3D: tag to the variable 'label' when you defined it
and you don't have to define a variable for deleting a 3d text


Re: Attach3DTextLabelToPlayer - GeneralAref - 19.12.2015

Код:
new Text3D:label;



Re: Attach3DTextLabelToPlayer - Sawalha - 19.12.2015

oh, i thought 919 was a variable (forgot that variables can't be named as numbers), anyway you gotta use PlayerText3D: tag since it's a player 3d text not a public one
and you are using DeletePlayer3DTextLabel


Re: Attach3DTextLabelToPlayer - GeneralAref - 19.12.2015

Can you give me full Code?


Re: Attach3DTextLabelToPlayer - Sawalha - 19.12.2015

it's pretty obvious, you got 2 choices whether to make it a player3d text or a public one.
as i see you defined label as a public 3d text and created it as public, but you have deleted it as a player 3d text.
all you need to do is just replace DeletePlayer3DTextLabel with Delete3DTextLabel; so it will be:
Код:
Delete3DTextLabel(label);