How to remove the _ in Firstname_Lastname
#1

Hello,

My question is simple: How to remove the '_' in Firstname_Lastname? This is my code

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i ++)
        {
            if(IsPlayerConnected(i))
            {
                new Float:PosX, Float:PosY, Float:PosZ,string[99],Playername[MAX_PLAYER_NAME];
                GetPlayerPos(playerid,PosX,PosY,PosZ);
                if(IsPlayerInRangeOfPoint(i,10,PosX,PosY,PosZ))
                {
                    GetPlayerName(playerid,Playername,sizeof(Playername));
                    SendClientMessage(i,COLOR_WHITE,string);
                    format(string,sizeof(string),"Says: %s",text);
                    SetPlayerChatBubble(playerid,string,COLOR_WHITE,10,5000);
                }
            }
        }
I also searched, and found this topic. but didn't work.

Regards, Jochem
Reply
#2

pawn Код:
stock GetPlayerRPName( playerid, name[ ], len )
{
        GetPlayerName( playerid, name, len );
        for ( new i = 0; i < len; i++ )
        {
            if ( name[ i ] == '_' )
                name[ i ] = ' ';
        }
}
Use instead of GetPlayerName.
Reply
#3

make new function where you split string with '_' than get value from both sides.

than

fromat(string,256,"%s %s Says: %s",Part1,Part2,text);

well I would use this way
Reply
#4

@ikey07

You think that would work simply? The stock would be simpler, I think..
Reply
#5

While I write a reply, kLk, reply faster and I don't wanted edit my post, of course stock is more simply^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)