[FilterScript] Toggle nametags
#1

OutlawAK posted a FilterScript to toggle nametags but the download link expired and he doesn't seem to be around anymore, so I wrote a new script.

It includes a command that allows (RCON) admins to toggle nametags visibility while the game is running.

The command is:
  • /nametags (1/0)
If the admin only types "/nametags", it will automatically toggle them on or off.

Please note that this requires zcmd and sscanf plugins to work correctly. If you don't want them, you'll have to change the script yourselves.

Pastebin link here.

Download .pwn and .amx files here
Reply
#2

Very easy to make, but it will save some people a lot of time. Good job.
Reply
#3

Good job. 8/10
Reply
#4

Good job, I might make a use of this.
However you might consider optimising your code as sscanf ain't really required, and the way you are checking if the string is empty isn't really that efficient (have a look at isnull).
Reply
#5

Quote:
Originally Posted by Virtual1ty
View Post
Good job, I might make a use of this.
However you might consider optimising your code as sscanf ain't really required, and the way you are checking if the string is empty isn't really that efficient (have a look at isnull).
Good point, I had forgotten about that, thanks!

I'm not going to update the script though since it doesn't really make any noticeable difference to the performance or functionality
Reply
#6

Quote:
Originally Posted by Virtual1ty
View Post
Good job, I might make a use of this.
However you might consider optimising your code as sscanf ain't really required, and the way you are checking if the string is empty isn't really that efficient (have a look at isnull).
isnull is built into sscanf
Reply
#7

I think this is easyer

pawn Code:
YCMD:name(playerid, params[], help)
{
    #pragma unused help
    new nametags;
    if(IsPlayerAdmin(playerid)
    {
        if(sscanf(params, "i", nametags)) return SendClientMessage(playerid, 1, "Usage: /name [0/1]");
        switch(nametags)
        {
            case 0:
            {
                foreach(Player, i)
                ShowNameTagsForPlayer(playerid, i, false);
                SendClientMessage(playerid, -1, "Name tags are off!");
            }
            case 1:
            {
                foreach(Player, i)
                ShowNameTagsForPlayer(playerid, i, true);
                SendClientMessage(playerid, -1, "Name tags are on!");
            }
        }
    }
    return 1;
}
Reply
#8

Aha Good job
Reply
#9

Whats the point of using sscanf for such simple thing?

pawn Code:
new bool:tagset = false;
CMD:togglenametags(playerid, params[])
{
    new ID = strval(params);
    if(!IsPlayerAdmin(playerid)) return 0;
    if(isnull(params)) return 0;
    if(tagset == true) tagset = false, ToggleNameTags(0), SendClientMessage(playerid, -1, "Unset");
    if(!IsNumeric(params)) return 0; // You may need this func
    if(ID > 1 || < 0) return 0;
    ToggleNameTags(ID);
    tagset = true;
    SendClientMessage(playerid, -1, "set");
    return 1;
}
Untested, though should work I suppose
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)