Name without _
#1

I "stores" Player's username in a variable (pName).

Username = Under firstname_lastname form.

How to ensure that when I use the variable pName, it appears to me, named in place of firstname_lastname?

Acts your code I do not see how to do it!
Reply
#2

pawn Код:
new idx = strfind(pName, "_");

if (idx != -1) // We found the '_' character, let's replace it with a space
    pName[idx] = ' ';
Reply
#3

Where I place this code?
Reply
#4

Put it somewhere in your script outside of the callbacks.
Код:
stock PlayerName(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;
}
When using PlayerName:
Код:
format(string, sizeof(string), "%s is my name.", PlayerName(playerid));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)