Nametag questions
#1

Hey guys i've got some nametag questions

1 Can we change nametags? something like /changename [ID] [NEWNAME]
If we can, change we change it to just a space? So that it looks like he haven't got a name?
2 Can we set all standard nametag colors to white and make rcon logged in people red?

Thx!
Reply
#2

1. Yes
2. Yes

np!

Ach, grapje maar..
heres the code for changename:
pawn Код:
dcmd_changename(playerid,params[])
{
new player,newname[MAX_PLAYER_NAME],string[128],playername[MAX_PLAYER_NAME];
if(!IsPlayerAdmin(playerid))  return 0;//SendClientMessage(playerid, COLOR_RED, "[System] You must be an admin!");
if(sscanf(params, "us", player,newname)) return SendClientMessage(playerid, COLOR_RED, "[System] Usage: /changename [id/part of name] [name] ");
if(!IsPlayerConnected(player)) return SendClientMessage(playerid,COLOR_RED,"[System] Invalid player or player is not connected.");
if(strlen(newname) > 16) return SendClientMessage(playerid,COLOR_RED,"[System] Not allowed to have more than 16 characters in the name.");
GetPlayerName(player,playername,sizeof(playername));
SetPlayerName(player,newname);
format(string,128,"You have changed %s's name into %s",playername,newname);
SendClientMessage(playerid,COLOR_YELLOW,string);
return 1;
}
pawn Код:
dcmd(changename,10,cmdtext);
Adjust it to ZCMD if u don't use dcmd.

pawn Код:
for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
                ShowPlayerNameTagForPlayer(playerid, i, 0);
                ShowPlayerNameTagForPlayer(i,playerid, 0);
        }
    }
this code should be placed under OnPlayerspawn, afaik.
This will hide the nametags of a player.

using
pawn Код:
SetPlayerColor(playerid,-1);
will set everyone's text & nametag color to white
now at
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
use an if check to see whether it was a success, if so set the player's color to red.
do notice that theres no playerid parameter on that callback, so you will have to find every player's ID on OnPlayerConnect, compare that to the one that logged in succesfully and set the color that way
or use a timer with a delay of 1 or more seconds that checks if 'IsPlayerAdmin(playerid)' is true, then set his color.

Vele wegen leiden naar Rome.


Merry Christmas!
Reply
#3

Код:
CMD:changename(playerid, params[], help)
{
	new name[24], igr, string[128];
	if(sscanf(params, "us[24]",igr, Ime)) return SCM(playerid, -1, "/changename [ID] [name]");
	format(string,sizeof(string),"Users/%s.ini",GetName(playerid));
	fremove(string);
	SetPlayerName(igr, Ime);
    return 1;
}
something like this
Reply
#4

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
1. Yes
2. Yes

np!

Ach, grapje maar..
heres the code for changename:
pawn Код:
dcmd_changename(playerid,params[])
{
new player,newname[MAX_PLAYER_NAME],string[128],playername[MAX_PLAYER_NAME];
if(!IsPlayerAdmin(playerid))  return 0;//SendClientMessage(playerid, COLOR_RED, "[System] You must be an admin!");
if(sscanf(params, "us", player,newname)) return SendClientMessage(playerid, COLOR_RED, "[System] Usage: /changename [id/part of name] [name] ");
if(!IsPlayerConnected(player)) return SendClientMessage(playerid,COLOR_RED,"[System] Invalid player or player is not connected.");
if(strlen(newname) > 16) return SendClientMessage(playerid,COLOR_RED,"[System] Not allowed to have more than 16 characters in the name.");
GetPlayerName(player,playername,sizeof(playername));
SetPlayerName(player,newname);
format(string,128,"You have changed %s's name into %s",playername,newname);
SendClientMessage(playerid,COLOR_YELLOW,string);
return 1;
}
pawn Код:
dcmd(changename,10,cmdtext);
Adjust it to ZCMD if u don't use dcmd.

pawn Код:
for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
                ShowPlayerNameTagForPlayer(playerid, i, 0);
                ShowPlayerNameTagForPlayer(i,playerid, 0);
        }
    }
this code should be placed under OnPlayerspawn, afaik.
This will hide the nametags of a player.

using
pawn Код:
SetPlayerColor(playerid,-1);
will set everyone's text & nametag color to white
now at
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
use an if check to see whether it was a success, if so set the player's color to red.
do notice that theres no playerid parameter on that callback, so you will have to find every player's ID on OnPlayerConnect, compare that to the one that logged in succesfully and set the color that way
or use a timer with a delay of 1 or more seconds that checks if 'IsPlayerAdmin(playerid)' is true, then set his color.

Vele wegen leiden naar Rome.


Merry Christmas!
Bedankt && MERRY CHRISTMAS!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)