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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Name off (/showthread.php?tid=71158)



Name off - killerx100 - 30.03.2009

Hello there!
I'm using this command for name off but tags dissapeard only for one second:
pawn Код:
if (strcmp(cmd, "/nameoff", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {

            if(PlayerInfo[playerid][pLevel] < 5)
        {
            SendClientMessage(playerid, COLOR_GRAD1, " You are not able to use it.");
            return 1;
        }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
            if(IsPlayerConnected(i))
            {
                nameofftimer = ShowPlayerNameTagForPlayer(i, playerid, 0);
               
                }
            }
            PlayerInfo[playerid][pTags] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "[TAGS] Your tags has been disabled");

        }
        return 1;
    }

    if(strcmp(cmd, "/nameon", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {

        if(PlayerInfo[playerid][pLevel] < 5)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not able to use it.");
            return 1;
        }
        for(new i = 0; i < MAX_PLAYERS; i++)
            {
            if(IsPlayerConnected(i))
            {
                    ShowPlayerNameTagForPlayer(i, playerid, 1);
                }
            }
            PlayerInfo[playerid][pTags] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "[TAGS] Your tags has been enabled.");

        }
        return 1;
    }
Whats the problem?
Thanks


Re: Name off - killerx100 - 30.03.2009

Quote:
Originally Posted by killerx100
Hello there!
I'm using this command for name off but tags dissapeard only for one second:
Код:
if (strcmp(cmd, "/nameoff", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {

	 		if(PlayerInfo[playerid][pLevel] < 15)
	  	{
	   		SendClientMessage(playerid, COLOR_GRAD1, "You cannot use that command yet.");
	    	return 1;
	  	}
			for(new i = 0; i < MAX_PLAYERS; i++)
 			{
 		  	if(IsPlayerConnected(i))
 		  	{
		 		nameofftimer = ShowPlayerNameTagForPlayer(i, playerid, 0);
		 		
				}
			}
			PlayerInfo[playerid][pTags] = 1;
			SendClientMessage(playerid, COLOR_WHITE, "[TAGS] Your tags has been disabled");

		}
		return 1;
	}

	if(strcmp(cmd, "/nameon", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {

	  	if(PlayerInfo[playerid][pLevel] < 5)
	  	{
	    	SendClientMessage(playerid, COLOR_GRAD1, "You cannot use that command yet."");
	    	return 1;
	  	}
	  	for(new i = 0; i < MAX_PLAYERS; i++)
 			{
 		  	if(IsPlayerConnected(i))
 		  	{
		 			ShowPlayerNameTagForPlayer(i, playerid, 1);
				}
			}
			PlayerInfo[playerid][pTags] = 0;
			SendClientMessage(playerid, COLOR_WHITE, "[TAGS] Your tags has been enabled.");

		}
		return 1;
	}
Whats the problem?
Thanks



Re: Name off - LarzI - 30.03.2009

try changing this
pawn Код:
nameofftimer = ShowPlayerNameTagForPlayer(i, playerid, 0);
to this
pawn Код:
ShowPlayerNameTagForPlayer(i, playerid, 0);



Re: Name off - killerx100 - 30.03.2009

Quote:
Originally Posted by lrZ^ aka LarzI
try changing this
pawn Код:
nameofftimer = ShowPlayerNameTagForPlayer(i, playerid, 0);
to this
pawn Код:
ShowPlayerNameTagForPlayer(i, playerid, 0);
My fault this timer i added to try something its same if i delete it.. Name tags dissapeard for second then come back.


Re: Name off - killerx100 - 30.03.2009

Now I made like that
pawn Код:
public NameOff(playerid)
{
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
            if(IsPlayerConnected(i))
            {
                ShowPlayerNameTagForPlayer(i, playerid, 0);

                }
            }
            return 1;
  }
public NameOn(playerid)
{
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
            if(IsPlayerConnected(i))
            {
                ShowPlayerNameTagForPlayer(i, playerid, 1);

                }
            }
            return 1;
  }
pawn Код:
if (strcmp(cmd, "/nameoff", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {

            if(PlayerInfo[playerid][pLevel] < 5)
        {
                SendClientMessage(playerid, COLOR_GRAD1, " You are not able to use it.");
            return 1;
        }
            NameOff(playerid);
            PlayerInfo[playerid][pTags] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "[TAGS] Your tags has been disabled");

        }
        return 1;
    }

    if(strcmp(cmd, "/nameon", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {

        if(PlayerInfo[playerid][pLevel] < 5)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not able to use it.");
            return 1;
        }
            NameOn(playerid);
            PlayerInfo[playerid][pTags] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "[TAGS] Your tags has been enabled.");

        }
        return 1;
    }
pawn Код:
SetTimer("NameOff",999999, 1);
Still won't dissapeard


Re: Name off - KingLollo - 30.03.2009

I have the same problem, please help me!!!!! Thx


Re: Name off - LarzI - 30.03.2009

SetTimer("NameOff",999999, 1);
=
Set a timer with the name "NameOff" which executes after 999999 milliseconds, then it'll repeat

SetTimer("NameOff",999999, 0);
=
Set a timer with the name "NameOff" which executes after 999999 milliseconds, then it does nothing


Re: Name off - Kinetic - 30.03.2009

Why are you guys using 999999 milliseconds? Shouldnt you use something that updates a little more?

Here is how you do it.


At the top of your script.
pawn Код:
new NameDisplay[MAX_PLAYERS];
new maxplayer;
new timer;
forward Timer();
forward NameOn(playerid);
forward NameOff(playerid);
OnGameModeInit
pawn Код:
timer = SetTimer("Timer", 10000, true);
  maxplayer = GetMaxPlayers();
OnPlayerConnect.
pawn Код:
NameDisplay[playerid] = 1;
  NameAlreadyOn = 0;
  NameAlreadyOff = 0;
Add the callbacks.
pawn Код:
public Timer()
{
  for(new i=0; i<=maxplayer; i++)
  {
    if(NameDisplay[i] == 0 && NameAlreadyOff[i] == 0)
    {
      NameOff(i);
    }
    if(NameDisplay[i] == 1 && NameAlreadyOn[i] == 0;)
    {
      NameOn(i);
  }
  return 1;
}

public NameOff(playerid)
{
  for(new i=0; i<=maxplayer; i++)
  {
    ShowPlayerNameTagForPlayer(i, playerid, 0);
    NameAlreadyOff[playerid] = 1;
    NameAlreadyOn[playerid] = 0;
  }
  return 1;
}

public NameOn(playerid)
{
  for(new i=0; i<=maxplayer; i++)
  {
    ShowPlayerNameTagForPlayer(i, playerid, 1);
    NameAlreadyOff[playerid] = 0;
    NameAlreadyOn[playerid] = 1;
  }
  return 1;
}
In OnPlayerCommandText
pawn Код:
if(strcmp(cmdtext, "/name", true) == 0)
  {
    if(NameDisplay[playerid] == 0)
    {
      NameDisplay[playerid] = 1;
      SendClientMessage(playerid, 0xffffffff, " >> Name Displaying turned on.");
      return 1;
    }
    if(NameDisplay[playerid] == 1)
    {
      NameDisplay[playerid] = 0;
      SendClientMessage(playerid, 0xffffffff, " >> Name Displaying turned off.");
      return 1;
    }
    return 1;
  }




Re: Name off - LarzI - 30.03.2009

He posted with 999999 so I didn't change it, maybe because that's what he wants ?


Re: Name off - killerx100 - 01.04.2009

Kinetic I can't compile your name off ..