ShowPlayerNameTagForPlayer - A little help would be nice..
#1

So I have this issue "ShowPlayerNameTagForPlayer" I'm trying to turn off the nametag for the player that used the command, and so far it does indeed turn them off, but my problem is when another player teleports to me (admin) or uses a teleport, I'm not sure.. but I think when they join too my nametag is shown or shows back up, I know I'm missing something here..but I have no idea what, any help would be appreciative.

and before you send me to the SA-MP Wiki.. I've already been there and done that and finally gave up, and came here for help.

and there's nothing else to "ShowPlayerNameTagForPlayer" except these two commands.

Here is my code:

Код:
CMD:hidetag(playerid, params[])
{
	LoginCheck(playerid);
	LevelCheck(playerid, 4);

	for(new i=0; i<MAX_PLAYERS; i++)
	ShowPlayerNameTagForPlayer(i, playerid, false);
    SendClientMessage( playerid, COLOR_CHAT, "You have {AFAFAF}disabled{FF0060} your {AFAFAF}nametag{FF0060}, to re-enable it you must use {AFAFAF}/showtag{FF0060}." );
	return 1;

	}
	
CMD:showtag(playerid, params[])
{
	LoginCheck(playerid);
	LevelCheck(playerid, 4);

	for(new i=0; i<MAX_PLAYERS; i++)
	ShowPlayerNameTagForPlayer(i, playerid, true);
    SendClientMessage( playerid, COLOR_CHAT, "You have {AFAFAF}enabled{FF0060} your {AFAFAF}nametag{FF0060}." );
	return 1;

	}
Reply
#2

PHP код:
new bool:Masked[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
Masked[playerid]=false;
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
Masked[i]==true)
            {
                
ShowPlayerNameTagForPlayer(playeridifalse);
            }
        }
    }
}
public 
OnPlayerStreamIn(playeridforplayerid)
{
    if(
Masked[playerid]==true)
        
ShowPlayerNameTagForPlayer(forplayeridplayeridfalse);
    return 
1;
}
CMD:toggletag(playeridparams[])
{
    
LoginCheck(playerid);
    
LevelCheck(playerid4);
    if(
Masked[playerid]==false)//False = No Mask = Others can see.. 
    
{
        
Masked[playerid]=true;//True -> Mask -> Others cant see no more.. hurray!
        
for(new i=0i<MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
                
ShowPlayerNameTagForPlayer(iplayeridfalse);
        }
        
SendClientMessageplayeridCOLOR_CHAT"You have {AFAFAF}disabled{FF0060} your {AFAFAF}nametag{FF0060}, to re-enable it you must use {AFAFAF}/showtag{FF0060}." );
    }
    else
    {
        
Masked[playerid]=false;
        for(new 
i=0i<MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
                
ShowPlayerNameTagForPlayer(iplayeridtrue);
        }
        
SendClientMessageplayeridCOLOR_CHAT"You have {AFAFAF}enabled{FF0060} your {AFAFAF}nametag{FF0060}." );
    }
    return 
1;

Reply
#3

That surely solved it, thanks ALOT!
Reply
#4

Well; the reason why it wasn't working is that these things get reset when players stream in. So, to fix this you have to re-apply the name tag function when a masked player streams in for another player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)