[FilterScript] [FS] Name Tags ON/OFF system
#1

[FS]Name Tags ON/OFF
[color=black][b]
v1.1
With this FS you can make the nametags disappear above the player head's .This FS basicly can be used on max 30 slot server, but can be expanded.Mainly, i made this GM for movie-making, but it can be useful in other ways.

Commands: /tagshelp || /tagson || /tagsoff
Pictures: will come
Download links:(v1.1)
http://www.mediafire.com/download.php?ttae5o2ugt3
http://rapidshare.com/files/14126919...sv1.1.rar.html
Credits:Feel free to do anything with it, but if you respect that little job you leave it
Credits also goes for commentators on forum.sa-mp.com, Thanks guys.

Enjoy!!!
Reply
#2

You could of done this:

Put these at the bottom of your [FS].

Код:
stock Namesoff(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
  ShowPlayerNameTagForPlayer(playerid, i, false);
  }
}
Код:
stock Nameson(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
  ShowPlayerNameTagForPlayer(playerid, i, true);
  }
}
Then:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/namesoff", cmdtext, true, 10) == 0)
{
Namesoff(playerid); // This turns the nametags off for those who type /namesoff only.
SendClientMessage(playerid, COLOR_YELLOW, "[SUCCESS] You have turned nametags off.");
return 1;
}

if (strcmp("/nameson", cmdtext, true, 10) == 0) // Change if needed to what you please.
{
Nameson(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "[SUCCESS] You have turned nametags on.");
return 1;
}
return 0;
}
Just trying to help .

( Taken from my Nametags [FS] )
Reply
#3

I'm not trying to nitpick, but both your scripts don't support name tag's being turned off for a player when a new player connects. For example:
Код:
Player A joins.
Player A turns off their name tag.
Player B joins.
Player B can still see Player A's nametag, because Player B was not connected when Player A turned off their name tag.

To fix this, you can do something like the following:
pastebin.com

A simple solution, and a lot better

~Cueball~
Reply
#4

Quote:
Originally Posted by ^Lj
You could of done this:

Put these at the bottom of your [FS].

Код:
stock Namesoff(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
  ShowPlayerNameTagForPlayer(playerid, i, false);
  }
}
Код:
stock Nameson(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
  ShowPlayerNameTagForPlayer(playerid, i, true);
  }
}
Bad!

Use:
Код:
for(new i = 0; i < GetMaxPlayers(); i++)
Reply
#5

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
is much better

than

Код:
for(new i = 0; i < GetMaxPlayers(); i++)
Reply
#6

Quote:
Originally Posted by TheMaTrIx4057
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
is much better

than

Код:
for(new i = 0; i < GetMaxPlayers(); i++)
No!
becouse your for are 200 turn
My for are (how much slots) turn
Reply
#7

Quote:
Originally Posted by Maniek
Bad!

Use:
Код:
for(new i = 0; i < GetMaxPlayers(); i++)
Bad!

Use:
pawn Код:
for(new i, x = GetMaxPlayers(); i < x; i++)
// Code.
The result returned by GetMaxPlayers() will not change inbetween such a tiny loop like that (unless you change it manually), so there is no point in calling it on every iteration of the loop. Assign it to a variable, and compare it to that, instead of calling the function repeatedly for every iteration of the loop.

Quote:
Originally Posted by TheMaTrIx4057
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
is much better

than

Код:
for(new i = 0; i < GetMaxPlayers(); i++)
Not neccessarily. GetMaxPlayers() (if used correctly) will save process time because it will generally be a smaller value than MAX_PLAYERS. Most people do not update their a_samp.inc to their correct max players value that their server runs on, so therefore they are running more loops or creating more array cells than they will ever use. So - update your a_samp.inc to your correct player count, and this will solve your problems.

~Cueball~
Reply
#8

There was a bug fix to my script on the UnOfficial Sa-Mp Forums but I can't find it anymore.
Which would get the player when he connects and then turn the nametags on/off depending on the player's choice with a varible.
Reply
#9

Quote:
Originally Posted by ^Lj
There was a bug fix to my script on the UnOfficial Sa-Mp Forums but I can't find it anymore.
Which would get the player when he connects and then turn the nametags on/off depending on the player's choice with a varible.
Just like the gentleman has done nicely for you


http://pastebin.com/f34e78d34
Reply
#10

Thank you for helping me and giving suggestions, i've updated it. Still enjoy!
Reply
#11

good job
Reply
#12

I no long time since last post but thankyou anyway XD
Reply
#13

Nice script, But add something to OnPlayerConnect so if a player has a hidden name tag it hides it for the new player to
Reply
#14

For a 1 off loop (i.e. each time you type the command) the difference between MaxPlayers and the GetMaxPlayers(); shouldn't be much of an issue. If however it was a loop on a timer it would be a different story...
Reply
#15

Quote:
Originally Posted by Cuecumber
Use:
pawn Код:
for(new i, x = GetMaxPlayers(); i < x; i++)
// Code.
The result returned by GetMaxPlayers() will not change inbetween such a tiny loop like that (unless you change it manually), so there is no point in calling it on every iteration of the loop. Assign it to a variable, and compare it to that, instead of calling the function repeatedly for every iteration of the loop.
I never thought about this, but I see that it's much better thanks for the code ^^
Reply
#16

Quote:
Originally Posted by Weirdosport
For a 1 off loop (i.e. each time you type the command) the difference between MaxPlayers and the GetMaxPlayers(); shouldn't be much of an issue. If however it was a loop on a timer it would be a different story...
No, the story is exactly the same in both cases. If there is a better way to do something, you should always use that way unless it does not apply to the current circumstances. Why do something wrong one time if you wouldn't do it wrong several times? There is no advantage to this, so do it right every time and you'll grow up to be big and strong.

The moral of the story, kids, is that Damian has SUPER-AIDS.

~Cueball~
Reply
#17

Nice ive been looking for one of these thanks
Reply
#18

Quote:
Originally Posted by Cueball
Посмотреть сообщение
Bad!

Use:
pawn Код:
for(new i, x = GetMaxPlayers(); i < x; i++)
// Code.
The result returned by GetMaxPlayers() will not change inbetween such a tiny loop like that (unless you change it manually), so there is no point in calling it on every iteration of the loop. Assign it to a variable, and compare it to that, instead of calling the function repeatedly for every iteration of the loop.



Not neccessarily. GetMaxPlayers() (if used correctly) will save process time because it will generally be a smaller value than MAX_PLAYERS. Most people do not update their a_samp.inc to their correct max players value that their server runs on, so therefore they are running more loops or creating more array cells than they will ever use. So - update your a_samp.inc to your correct player count, and this will solve your problems.

~Cueball~
Actually, MAX_PLAYERS is faster than GetMaxPlayers()
Because it gets called repeatedly, so it's slow.
BEST way:
pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS (yourslots)
Sorry for da bump.
Reply
#19

bump indeed a 2 year old topic. not neccesairy right?
Reply
#20

No-way! That was a nice bumb!

Still a good FS xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)