Insert a name before your name when using a command? -
.Wicked - 22.06.2012
Alright as the topic says "Insert a name before your name using a command?"
Example when you type in /aduty it should insert "Admin" infront of your name with the color red.
I can't really get the "string" stuff straight and I would be very thankful if someone could help me.
Re: Insert a name before your name when using a command? -
[MM]RoXoR[FS] - 22.06.2012
Do you mean 3D text Label?
Re: Insert a name before your name when using a command? -
[KHK]Khalid - 22.06.2012
Use
SetPlayerName to change their names and to set their colors use
SetPlayerColor. But it's better (My opinion) to have it in a 3d text label, use
Create3DTextLabel to create a 3d text label with the text "On Duty!" then attach it to the player by using
Attach3DTextLabelToPlayer and when they go off duty then you can use
Delete3DTextLabel to delete the 3d text label.
Re: Insert a name before your name when using a command? -
.Wicked - 22.06.2012
Alright this is what I have but it doesn't actually change my name.
pawn Код:
COMMAND:aduty(playerid, params[])
{
new adminname[128];
format(adminname, sizeof(adminname), "Administrator %s", GetName(playerid));
SetPlayerName(playerid, adminname);
SetPlayerHealth(playerid, 999999);
SetPlayerArmour(playerid, 999999);
SendClientMessage(playerid, COLOR_WHITE, "You are now on admin duty");
return 1;
}
Re: Insert a name before your name when using a command? -
.Wicked - 22.06.2012
What's too long? The "Administrator"? Anyways I changed it to "Admin" and it still doesn't work.
I want my name to be "Admin Wicked" with help of "%s".
AW: Insert a name before your name when using a command? -
Tigerkiller - 22.06.2012
you cant use spaces in names! Anyways attach a text to the admin . . .
Re: Insert a name before your name when using a command? -
.Wicked - 22.06.2012
Thanks Tigerkiller but how do I make a space between the Admin and %s? I know it's possible.
AW: Insert a name before your name when using a command? -
Tigerkiller - 22.06.2012
it is possible for strings ex: in OnPlayerText but not for names but you can use "_" there is no other way to do this
Re: Insert a name before your name when using a command? -
[ABK]Antonio - 22.06.2012
Quote:
Originally Posted by .Wicked
Thanks Tigerkiller but how do I make a space between the Admin and %s? I know it's possible.
|
you
cant
have
spaces
in
names
Re: Insert a name before your name when using a command? -
iggy1 - 22.06.2012
I
Think
You
Can.
Something like this might work.
pawn Код:
RemoveUnderscoreFromName(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
for(new i=0; i < MAX_PLAYER_NAME; ++i)
{
if(pName[i] == EOS)break;
if(pName[i] == '_') pName[i] = ' ';
}
SetPlayerName(playerid, pName);
}
EDIT: Or if you don't want to change the players name for any reason.
pawn Код:
GetPlayerRpName(playerid)//couldn't think of a better name that is shorter than this.
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
for(new i=0; i < MAX_PLAYER_NAME; ++i)
{
if(pName[i] == EOS)break;
if(pName[i] == '_') pName[i] = ' ';
}
return pName;
}