SA-MP Forums Archive
How to remove the _ in Firstname_Lastname - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to remove the _ in Firstname_Lastname (/showthread.php?tid=161316)



How to remove the _ in Firstname_Lastname - Jochemd - 19.07.2010

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


Re: How to remove the _ in Firstname_Lastname - kLx - 19.07.2010

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.


Re: How to remove the _ in Firstname_Lastname - ikey07 - 19.07.2010

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


Re: How to remove the _ in Firstname_Lastname - Jochemd - 19.07.2010

@ikey07

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


Re: How to remove the _ in Firstname_Lastname - ikey07 - 19.07.2010

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