SA-MP Forums Archive
Changing display name - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Changing display name (/showthread.php?tid=445035)



Changing display name - CloW - 19.06.2013

How to change display name above player's head?


Re: Changing display name - Champ - 19.06.2013

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.


AW: Re: Changing display name - HurtLocker - 19.06.2013

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


Re: Changing display name - CloW - 19.06.2013

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


Re: Changing display name - Red_Dragon. - 19.06.2013

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


Re: Changing display name - CloW - 19.06.2013

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


Re: Changing display name - Juanxz - 19.06.2013

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.


Re: Changing display name - CloW - 19.06.2013

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


Re: Changing display name - RedFusion - 19.06.2013

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


Re: Changing display name - CROSS_Hunter - 19.06.2013

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