Attach3DTextLabelToPlayer
#1

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;
}
Reply
#2

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

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

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

Код:
new Text3D:label;
Reply
#6

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

Can you give me full Code?
Reply
#8

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


Forum Jump:


Users browsing this thread: 3 Guest(s)