Hiding nametag for all players
#1

So i had an idea to make a script that could deactivate a player's nametag once said player types a command.
As it turned out, i'm not the only one who's had this idea and plenty of people have been making this script, so i pasted some bits of it over to my own.

The problem is: it doesn't work. The command attaches a mask to the player's head, but it won't hide his nametag to other players.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/mask", true))
	{
		SetPlayerAttachedObject(playerid, 0, 19036, 2, 0.1, 0.05, 0, 90, 90, 0);
  		for(new i = 0; i < MAX_PLAYERS; i++)
	   			{
	   				ShowPlayerNameTagForPlayer(i, playerid, false);
				}
		return 1;
	}
	if(!strcmp(cmdtext, "/maskoff", true))
	{
		RemovePlayerAttachedObject(playerid, 0);
		for(new i = 0; i < MAX_PLAYERS; i++)
				{	   
					ShowPlayerNameTagForPlayer(i, playerid, true);
				}
		return 1;
	}
Can someone help? Thanks.
Reply
#2

Take a look here:

https://sampwiki.blast.hk/wiki/ShowPlayerNameTagForPlayer

Example (False):


ShowPlayerNameTagForPlayer(i, playerid, true);



Example(True):


ShowPlayerNameTagForPlayer(playerid, i, true);

it should be look like this!
Reply
#3

Quote:
Originally Posted by Alex Magaсa
Посмотреть сообщение
Take a look here:

https://sampwiki.blast.hk/wiki/ShowPlayerNameTagForPlayer

Example (False):


ShowPlayerNameTagForPlayer(i, playerid, true);



Example(True):


ShowPlayerNameTagForPlayer(playerid, i, true);

it should be look like this!
Can you explain why it should look like that?
Reply
#4

i dunno.. this should work.

PHP код:
new boolgMasked[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
gMasked[playerid] = false;
    for (new 
0MAX_PLAYERSi++) {
        
ShowPlayerNameTagForPlayer(iplayeridtrue);
    }
    return 
1;
}
CMD:mask(playeridparams[])
{
    if (!
IsPlayerConneted(playerid))
        return 
0;
        
    switch (
gMasked[playerid])
    {
        case 
false:
        {
            
gMasked[playerid] = true;
            for (new 
0MAX_PLAYERSi++) {
                
ShowPlayerNameTagForPlayer(iplayeridfalse);
            }
        }
        case 
true:
        {
            
gMasked[playerid] = false;
            for (new 
0MAX_PLAYERSi++) {
                
ShowPlayerNameTagForPlayer(iplayeridtrue);
            }
        }
    }
    return 
1;
}
public 
OnPlayerSteamIn(playeridforplayerid)
{
    if (
gMasked[playerid]) {
        
ShowPlayerNameTagForPlayer(forplayeridplayeridfalse);
    } else {
        
ShowPlayerNameTagForPlayer(forplayeridplayeridtrue);
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by smartasspothead
Посмотреть сообщение
i dunno.. this should work.

PHP код:
new boolgMasked[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
gMasked[playerid] = false;
    for (new 
0MAX_PLAYERSi++) {
        
ShowPlayerNameTagForPlayer(iplayeridtrue);
    }
    return 
1;
}
CMD:mask(playeridparams[])
{
    if (!
IsPlayerConneted(playerid))
        return 
0;
        
    switch (
gMasked[playerid])
    {
        case 
false:
        {
            
gMasked[playerid] = true;
            for (new 
0MAX_PLAYERSi++) {
                
ShowPlayerNameTagForPlayer(iplayeridfalse);
            }
        }
        case 
true:
        {
            
gMasked[playerid] = false;
            for (new 
0MAX_PLAYERSi++) {
                
ShowPlayerNameTagForPlayer(iplayeridtrue);
            }
        }
    }
    return 
1;
}
public 
OnPlayerSteamIn(playeridforplayerid)
{
    if (
gMasked[playerid]) {
        
ShowPlayerNameTagForPlayer(forplayeridplayeridfalse);
    } else {
        
ShowPlayerNameTagForPlayer(forplayeridplayeridtrue);
    }
    return 
1;

Actually, i solved my problem, but i appreciate the effort.
Thanks for trying to help out!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)