Name without "_"
#1

How can I remove the "_" in names? that is, when writing in chat eg Firstname_Lastname not occur, appear FirstName Lastname .. I hope you understand

Thanks
Reply
#2

I think it's not possible, im not fully sure.
Reply
#3

I have a GM with something, but do not know how to look ..
Reply
#4

Quote:
Originally Posted by ikarus❶❸❸❼
I think it's not possible, im not fully sure.
It is possible, i saw on RP server when you do /me it doesnt show the "_"
Reply
#5

It's done by exploding the two values in to two separate strings, or removing the "_" (underscore) from the string. I have created a function, which will do this:

pawn Код:
stock ReturnPlayerName( playerid )
{
    new
        NameString[ MAX_PLAYER_NAME ],
        stringPos;

    GetPlayerName( playerid, NameString, MAX_PLAYER_NAME );

    stringPos = strfind( NameString, "_" );
   
    NameString[ stringPos ] = ' ';
    return NameString;
}
Thanks to Norn for releasing a similar function in Carlitos Roleplay, note if there's only one underscore, this will work - if there's more, it will only remove the first instance.

Norn's code:

pawn Код:
stock GetPlayerNameEx(playerid)
{
   new string[MAX_PLAYER_NAME];
   GetPlayerName(playerid, string, sizeof(string));
   for(new i; i < MAX_PLAYER_NAME; i++) if (string[i] == '_') string[i] = ' ';
   return string;
}
Reply
#6

Does not work: (

In GM that I saw (http://forum.sa-mp.com/index.php?topic=148926.0) but do not know how to look, can you please try .. thanks
Reply
#7

Just replace your GetPlayerName with GetPlayerNameEx
Reply
#8

Replace everywhere there "GetPlayerName" ?
Reply
#9

Someone help me?
Reply
#10

Oh please, just do what he said! Use GetPlayerNameEx in stead of GetPlayerName on placed where you get names, so yes, replace all
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)