Changing display name
#1

How to change display name above player's head?
Reply
#2

you can change your name in sa-mp window. on the head of the sa-mp software. you can not change player's name inside the script.
Reply
#3

Quote:
Originally Posted by Champ
Посмотреть сообщение
you can change your name in sa-mp window. on the head of the sa-mp software. you can not change player's name inside the script.
Wrong.

https://sampwiki.blast.hk/wiki/SetPlayerName
Reply
#4

Ok guys.Can i change player name when press TAB(IN TAB LIST)?
Reply
#5

You can use the function OnPlayerClickPlayer https://sampwiki.blast.hk/wiki/OnPlayerClickPlayer
Reply
#6

Not that.I want change display name when another player press tab.
Reply
#7

This might be of help:
https://sampwiki.blast.hk/wiki/GetPlayerKeys

That's the script for when someone presses a key. Use the TAB key.
Reply
#8

Yes,i want to change player name in TAB list.
Reply
#9

You want every player's name to change when someone press TAB?
Reply
#10

You have been already told to use SetPlayerName Function By HurtLocker ... Thats the correct and only way of using it.. Lemme give you an example..
pawn Код:
if(strcmp(cmd, "/setname", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid/PartOfName] [name]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerNPC(giveplayerid)) return 1;
            if(PlayerInfo[playerid][pAdmin] >=4)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp))
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid/PartOfName] [name]");
                            return 1;
                        }
                        format(string, sizeof(string), "%s.ini", tmp);
                        if(fexist(string))
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "   That name is already registered !");
                            return 1;
                        }
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
//                      PlayerInfo[giveplayerid][pDisabled] = 1;
//                      OnPlayerSave(giveplayerid);
                        SetPlayerName(giveplayerid, tmp);
//                      PlayerInfo[giveplayerid][pDisabled] = 0;
                        format(string, sizeof(string), "%s.ini", giveplayer);
                        fremove(string);
                        OnPlayerSave(giveplayerid); // save player (in case server has a restart and fucks up their name)
                        format(string, sizeof(string), "   You have renamed %s to %s !", giveplayer, tmp);
                        SendClientMessage(playerid, COLOR_GREY, string);
                        format(string, sizeof(string), "Your name has been changed from %s to %s.", giveplayer, tmp);
                        SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                        format(string, sizeof(string), "%s has renamed %s to %s.", sendername, giveplayer, tmp);
                        return 1;
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
            }
        }
        return 1;
    }
Psst... Dont copy and paste thats an old function that i used in my script, Just edit it to suit your script needs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)