About 3DTextLables
#1

Hi there!
I'm making a /mask system for my server, i have finished everything, but when i put on the mask in-game, it just disables the nametag, and it doesnt show the 3DTextLabel on the player, can you please help me find out whats wrong? Thank you.

Код:
new MaskNumber[MAX_PLAYERS];
new MaskOn[MAX_PLAYERS];
new Text3D:masklabel[MAX_PLAYERS];
This on public OnPlayerUpdate(playerid)
Код:
	if(MaskOn[playerid] == 1)
	{
	    new string[256];
        for(new i = 0; i < MAX_PLAYERS; i++)
		{
			ShowPlayerNameTagForPlayer(i, playerid, false);
		}
        format(string, sizeof(string), "Stranger_%d", MaskNumber[playerid]);
		Update3DTextLabelText(masklabel[playerid], GREY, string);
		Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
	}
Код:
	if(strcmp(cmd,"/mask",true) == 0)
	{
		if(PlayerInfo[playerid][pLevel] >= 5)
		{
			if(PlayerInfo[playerid][pMask] == 1)
			{
		  	 	 if(MaskOn[playerid] == 0)
		  	 	 {
		    	    new string[256];
		  	        MaskOn[playerid] = 1;
		    	    new rand = 1000 + random(8999);
					MaskNumber[playerid] = rand;
					format(string, sizeof(string), "* %s takes out a mask and places it over their head. *", MaskOnOff(playerid));
					ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
					format(string, sizeof(string), "Stranger_%d", MaskNumber[playerid]);
					Update3DTextLabelText(masklabel[playerid], COLOR_WHITE, string);
					Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
					masklabel[playerid] = Create3DTextLabel("Stranger_%d", COLOR_WHITE, -1.0, -1.0, -1.0, -1.0, 0, MaskNumber[playerid]);
					
					masklabel[playerid] = Create3DTextLabel("Stranger_%d", COLOR_WHITE, -1.0, -1.0, -1.0, -1.0, 0, MaskNumber[playerid]);
					Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
					
					for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
				}
				else return SendClientMessage(playerid, COLOR_WHITE, "You already have your mask on.");
			}
			else return SendClientMessage(playerid, COLOR_WHITE, "You don't have a Mask.");
		}
		else return SendClientMessage(playerid, COLOR_WHITE, "You must be level 5 and above to use a mask.");
		return 1;
	}
Reply
#2

delte those lines from onplayerupdate:
pawn Код:
format(string, sizeof(string), "Stranger_%d", MaskNumber[playerid]);
        Update3DTextLabelText(masklabel[playerid], GREY, string);
        Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
and change your command to this:
pawn Код:
if(strcmp(cmd,"/mask",true) == 0)
    {
        if(PlayerInfo[playerid][pLevel] >= 5)
        {
            if(PlayerInfo[playerid][pMask] == 1)
            {
                 if(MaskOn[playerid] == 0)
                 {
                    new string[256];
                    MaskOn[playerid] = 1;
                    new rand = 1000 + random(8999);
                    MaskNumber[playerid] = rand;
                    format(string, sizeof(string), "* %s takes out a mask and places it over their head. *", MaskOnOff(playerid));
                    ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                    format(string, sizeof(string), "Stranger_%d", MaskNumber[playerid]);
masklabel[playerid] = Create3DTextLabel(string, COLOR_WHITE, 0.0, 0.0, 0.0, 40.0, -1, 0)
                    Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
                   
                    for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
                }
                else return SendClientMessage(playerid, COLOR_WHITE, "You already have your mask on.");
            }
            else return SendClientMessage(playerid, COLOR_WHITE, "You don't have a Mask.");
        }
        else return SendClientMessage(playerid, COLOR_WHITE, "You must be level 5 and above to use a mask.");
        return 1;
    }
Reply
#3

Thanks, i willl see if it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)