/aduty Help
#1

Could anyone help me ? how to make if i type /aduty and it will hide my Last Name (RP Server)
Reply
#2

You have to create the aname command.
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=351068

But this tutorial is a little bit wrong.
Reply
#4

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
https://sampforum.blast.hk/showthread.php?tid=351068

But this tutorial is a little bit wrong.
I just needed to hide player's Lastname
Reply
#5

https://sampwiki.blast.hk/wiki/ShowPlayerNameTagForPlayer

or try

https://sampwiki.blast.hk/wiki/ShowNameTags
Reply
#6

pawn Код:
stock firstNameOnly(playerid)
{
    new Name[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    for (new i = 0; i < (strlen(pName)); i++)
    {
        if (pName[i] != '_') Name[i] = pName[i];
        else break;
    }
    return Name;
}
This should work
pawn Код:
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(str, 128, "Full name: %s || First name only: %s", pName, firstNameOnly(playerid));
SendClientMessage(playerid, 0xFFFFFFAA, str);
This is one of many ways to do this

p.s.
Kevin_Warde would be Kevin
KevinWard_e would be KevinWard
K_evinWarde would be K
_KevinWarde would be
KevinWarde_ would be KevinWarde

I think that is what you wanted?
Reply
#7

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
pawn Код:
stock firstNameOnly(playerid)
{
    new Name[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    for (new i = 0; i < (strlen(pName)); i++)
    {
        if (pName[i] != '_') Name[i] = pName[i];
        else break;
    }
    return Name;
}
This should work
pawn Код:
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(str, 128, "Full name: %s || First name only: %s", pName, firstNameOnly(playerid));
SendClientMessage(playerid, 0xFFFFFFAA, str);
This is one of many ways to do this

p.s.
Kevin_Warde would be Kevin
KevinWard_e would be KevinWard
K_evinWarde would be K
_KevinWarde would be
KevinWarde_ would be KevinWarde

I think that is what you wanted?
Where to put it ? Sorry i'm new on scripting~
Reply
#8

The stock can you put anywhere in your script.
Reply
#9

Okay, then how do i make it back to full name ?
Reply
#10

This function doesn't change the player name, just remove the '_{lastname}' part in strings.
If you want to show the full name again, just don't use the function 'firstNameOnly'. For example:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new str[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    if(PlayerInfo[playerid][pAdmDuty]) //If the player is on admin duty. Change this to your own string!
        format(str, 128, "%s(%d): %s", firstNameOnly(playerid), playerid, text);
    else format(str, 128, "%s(%d): %s", pName, playerid, text);

    SendClientMessageToAll(0xFFFFFFAA, str);
    return 1;
}
If you would be on admin duty, everyone would see (assuming that your ID is 0 and your name Kevin_Warde with the text Hello!):
Kevin(0): Hello!
When you wouldn't be on duty, it would send:
Kevin_Warde(0): Hello!

The name in the server and in the TAB list would be Kevin_Warde at all time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)