CMD:nameon(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, true);
GameTextForPlayer(playerid, "~W~Nametags ~g~On", 5000, 5);
return 1;
}
CMD:nameoff(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, false);
GameTextForPlayer(playerid, "~W~Nametags ~R~OFF", 5000, 5);
return 1;
}
new bool: pNames[MAX_PLAYERS];
CMD:name(playerid, params[])
{
if(pNames[playerid] == false)
{
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, false);
GameTextForPlayer(playerid, "~W~Nametag ~g~On", 5000, 5);
pNames[playerid] = true; // which means the player can see names now
}
else
{
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, false);
GameTextForPlayer(playerid, "~W~Nametags ~R~OFF", 5000, 5);
pNames[playerid] = false; // Which means the player can't see name tags now.
}
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
|
You need a variable, to see if the player has nametags on or off:
pawn Код:
|
new bool:NameTag[MAX_PLAYERS];
CMD:name(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
if(NameTag[playerid] == false)
{
ShowPlayerNameTagForPlayer(playerid, i, true);
GameTextForPlayer(playerid, "~W~Nametags ~g~On", 5000, 5);
NameTag[playerid] = true;
}else{
ShowPlayerNameTagForPlayer(playerid,i,false);
GameTextForPlayer(playerid, "~W~Nametags ~r~off", 5000, 5);
NameTag[playerid] = false;
}
return 1;
}
|
Could also be done using this:
Код:
new bool:NameTag[MAX_PLAYERS];
CMD:name(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
if(NameTag[i] == false)
{
ShowPlayerNameTagForPlayer(playerid, i, true);
GameTextForPlayer(playerid, "~W~Nametags ~g~On", 5000, 5);
NameTag[i] = true;
}else{
ShowPlayerNameTagForPlayer(playerid,i,false);
GameTextForPlayer(playerid, "~W~Nametags ~r~off", 5000, 5);
NameTag[i] = false;
}
return 1;
}
|