ShowNameTags Question - 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: ShowNameTags Question (
/showthread.php?tid=431148)
ShowNameTags Question -
jakejohnsonusa - 16.04.2013
Can I use the function ShowNameTags in an admin command to show/hide everyones name tag's? Or will it not work as a command?
This is what I mean (will this work fine?):
pawn Код:
if(strcmp(cmd, "/hidealltags", true) == 0)
{
ShowNameTags(0);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
PlayerInfo[i][pMaskuse] = 1;
KillTimer(MaskOnTimer[i]);
SendClientMessage(i, COLOR_WHITE, "Your mask has been turned off by an admin. If you own a mask you may turn it back off.");
}
&
pawn Код:
if(strcmp(cmd, "/showalltags", true) == 0)
{
ShowNameTags(1);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
KillTimer(MaskOnTimer[i]);
PlayerInfo[i][pMaskuse] = 0;
SendClientMessage(i, COLOR_WHITE, "Your name has been unhidden by an admin. If you own a mask you may turn it back on now.");
}
}
Re: ShowNameTags Question -
HurtLocker - 16.04.2013
You do not need repeating timers to enable/disable nametag. Nor masks, nor any callbacks. This is a simple way to do this:
pawn Код:
new tags[MAX_PLAYERS];
if(strcmp(cmd, "/hidealltags", true) == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (tags[i]==1)
{
ShowPlayerNameTagForPlayer(playerid, i, 0);
SendClientMessage(i, COLOR_WHITE, "Your mask has been turned off by an admin. If you own a mask you may turn it back off.");
tags[i]=0;
}
else SendClientMessage(playerid, COLOR_WHITE, "Name tags are already off.");
}
}
return 1;
}
if(strcmp(cmd, "/showalltags", true) == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (tags[i]==0)
{
ShowPlayerNameTagForPlayer(playerid, i, 1);
SendClientMessage(i, COLOR_WHITE, "Your name has been unhidden by an admin. If you own a mask you may turn it back on now.");
tags[i]=1;
}
else SendClientMessage(playerid, COLOR_WHITE, "Name tags are already on.");
}
}
return 1;
}
tags can be just tags too. without max_players.