How to remove "_" from RP Names
#1

well... can anyone show / teach me how to remove the _ from ANY Name which enter the server.. i just want that if anyone enter the server with the _ it get removed , Ex : if he join with Tommy_White , if he make /ad...type anything it appear as Tommy White only , can anyone help ?
Reply
#2

Look at OnPlayerConnect callback i'm sure there is some name checker?
Reply
#3

pawn Код:
stock RemoveUnderScore(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
Use that function instead of GetPlayerName where you don't want to have the '_', just watch out so you don't change the sections that need names to have underscores.
Reply
#4

You can create a simple stock function, here's an example:

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

Well... i a begginer scripter , so can you tell me where i add it ?
Reply
#6

Add it in your bottom of your script. Then to use it do the following:

For example here:
pawn Код:
new string[128];
format(string, sizeof(string), "Hello, my name is %s", RemoveUnderScore(playerid));
SendClientMessageToAll(-1, string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)