SA-MP Forums Archive
Hide "_" in player names - 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: Hide "_" in player names (/showthread.php?tid=362524)



Hide "_" in player names - ChristofferHoffmann - 24.07.2012

Hey, I have a small roleplay server running. Sadly, it shows the "_" between the firstname and lastname, how can I remove this so it doesn't get shown in the chatbox?


Re: Hide "_" in player names - ViniBorn - 24.07.2012

It can help you

http://forum.sa-mp.com/showpost.php?...24&postcount=8


Re: Hide "_" in player names - RedJohn - 24.07.2012

Quote:

Search for the sign "_" in the string, then replace it with " ".
I found a code for you.

pawn Код:
GiveNameSpace(str[])
{
    new strl;
    strl=strlen(str);
    while(strl--) {
    if(str[strl]=='_')  str[strl]=' ';
    }
    return 0;
}

Usage:
pawn Код:
new string[4];
string = "R_L";
GiveNameSpace(string);
return string; // will return "R L"
For the name:
pawn Код:
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
GiveNameSpace(playername);
return playername; // If your name was "Haha_Lol", it will return "Haha Lol".
p/s What? We have to wait 2 minutes, again, to post?

Code by Biesmen


Re: Hide "_" in player names - ChristofferHoffmann - 24.07.2012

Thanks man


Re: Hide "_" in player names - iggy1 - 24.07.2012

pawn Код:
RemoveUnderscore(playerid)
{
    new szPlayerName[ MAX_PLAYER_NAME ];
       
    GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
   
    for(new i=0; i < MAX_PLAYER_NAME; ++i)
    {
        if(szPlayerName[i] == EOS)break;
       
        if(szPlayerName[i] == '_')
            szPlayerName[i] = ' ';
    }
    SetPlayerName(playerid, szPlayerName);
}