[FilterScript] Toggle nametags - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Toggle nametags (
/showthread.php?tid=270433)
Toggle nametags ON/OFF -
Lenny the Cup - 20.07.2011
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:
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
Re: Toggle nametags -
Famalamalam - 20.07.2011
Very easy to make, but it will save some people a lot of time. Good job.
Re: Toggle nametags -
Mariooo - 20.07.2011
Good job. 8/10
Re: Toggle nametags -
Virtual1ty - 20.07.2011
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).
Re: Toggle nametags -
Lenny the Cup - 20.07.2011
Quote:
Originally Posted by Virtual1ty
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
Re: Toggle nametags -
Famalamalam - 20.07.2011
Quote:
Originally Posted by Virtual1ty
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
Re: Toggle nametags -
System64 - 20.07.2011
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;
}
Re: Toggle nametags -
SpiderWalk - 21.07.2011
Aha Good job
Re: Toggle nametags -
Lorenc_ - 21.07.2011
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