SA-MP Forums Archive
Name without "_" - 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: Name without "_" (/showthread.php?tid=149024)



Name without "_" - InsaneESN - 20.05.2010

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


Re: Name without "_" - [MWR]Blood - 20.05.2010

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


Re: Name without "_" - InsaneESN - 20.05.2010

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


Re: Name without "_" - johnnyc - 20.05.2010

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 "_"


Re: Name without "_" - Calgon - 20.05.2010

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;
}



Re: Name without "_" - InsaneESN - 20.05.2010

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


Re: Name without "_" - RoamPT - 20.05.2010

Just replace your GetPlayerName with GetPlayerNameEx


Re: Name without "_" - InsaneESN - 20.05.2010

Replace everywhere there "GetPlayerName" ?


Re: Name without "_" - InsaneESN - 20.05.2010

Someone help me?


Re: Name without "_" - Jochemd - 20.05.2010

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