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



Name off - xdarren - 22.10.2013

Код:
#define NAME_DRAWDISTANCE (5) // The distance of the 3d text nametags to appear.
new Text3D:NameTag[MAX_PLAYERS];
new playerName[MAX_PLAYER_NAME];

public OnGameModeInit()
{
    SetNameTagDrawDistance(0.0);
    ShowNameTags(false);
	return 1;
}

public OnPlayerConnect(playerid)
{
	playerName = p_name( playerid );
	NameTag[playerid] = Create3DTextLabel( playerName, 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1 );
    Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0.0, 0.0, 0.2);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    Delete3DTextLabel( NameTag[playerid] );
	return 1;
}

stock p_name( playerid )
{
	new p_namev[MAX_PLAYER_NAME];
	GetPlayerName(playerid, p_namev, MAX_PLAYER_NAME);
	return p_namev;
}
I have this code and it works perfectly it hides the hleath and the armor bar and shows the name only. Now I tried making the code that will hide the name and it won't work ... For some reason its not hiding the name.

Commands: /name off - it would hide the name
/name on - it would show name back up with ONLY name.


Re: Name off - xdarren - 22.10.2013

This is the cody I was working on. But its not working.

PHP код:
COMMAND:name(playeridparams[])
{
    if(
PlayerInfo[playerid][premium] || PlayerInfo[playerid][playerteam]==FBI || PlayerInfo[playerid][playerlvl]>= 8)
    {
        new 
tmp[5];
        if(
sscanf(params"s"tmp)) return SCP(playerid"[on/off]");
        if(
strcmp(tmp,"on",true)==0)
        {
            
PlayerTemp[playerid][hname]=0;
            
SendClientMessage(playeridCOLOR_GREY"Name on.");
            
//GameTextForPlayer(playerid,"~g~ShowName ON",1000,1);
            //PlayerLoop(i) ShowPlayerNameTagForPlayer(i,playerid,1);
            //PlayerLoop(i) NameTag(i,playerid,true);
            
playerName pnameplayerid );
            
NameTag[playerid] = Create3DTextLabelplayerName0xFFFFFFFF000NAME_DRAWDISTANCE0);
            
Attach3DTextLabelToPlayer(NameTag[playerid], playerid0.00.00.2);
        }
        else if(
strcmp(tmp,"off",true)==0)
        {
            
PlayerTemp[playerid][hname]=1;
            
SendClientMessage(playeridCOLOR_GREY"Name off.");
            
//GameTextForPlayer(playerid,"~r~ShowName OFF",1000,1);
            //PlayerLoop(i) NameTag(i,playerid,false);
            
playerName pnameplayerid );
            
NameTag[playerid] = Create3DTextLabelplayerName0xFFFFFFFF000NAME_DRAWDISTANCE0);
            
Attach3DTextLabelToPlayer(NameTag[playerid], playerid0.00.09);
            
//PlayerLoop(i) if(PlayerInfo[i][power] != 31337 && PlayerInfo[i][power] != 20) ShowPlayerNameTagForPlayer(i,playerid,0);
        
}
        else return 
SCP(playerid"[on/off]");
    }
    else return 
SendClientError(playeridCANT_USE_CMD);
    return 
1;




Re: Name off - xdarren - 22.10.2013

Anyone ?


Re: Name off - xdarren - 22.10.2013

Bump Aynone ?