Player Name hellp
#6

I just messed around a little bit and the result was the following function:
pawn Код:
stock ChangePlayerName(playerid)
{
    new name[MAX_PLAYER_NAME], i;
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);

    while (name[i] != EOS)
    {
        if (i == 0 || name[i - 1] == '_')
            name[i] = toupper(name[i]);
        else if (name[i] != '_')
            name[i] = tolower(name[i]);    
        i++;
    }
    printf("%s", name);
    return 1;
}
toupper and tolower are two defines originally posted by ******:
pawn Код:
#define toupper(%0) \
    (((%0) >= 'a' && (%0) <= 'z') ? ((%0) & ~0x20) : (%0))

#define tolower(%0) \
    (((%0) >= 'A' && (%0) <= 'Z') ? ((%0) | 0x20) : (%0))
I don't check for the name being a roleplay name and such without numbers or symbols. But I guess you already do that beforehand. Also I don't guarantee for anything but it worked for me when I tested it.

I hope it helps.
Reply


Messages In This Thread
Player Name hellp - by MasonSFW - 13.05.2014, 07:30
Re: Player Name hellp - by rockhopper - 13.05.2014, 08:01
Re: Player Name hellp - by rockhopper - 13.05.2014, 08:03
Re: Player Name hellp - by MasonSFW - 13.05.2014, 09:00
Re: Player Name hellp - by rockhopper - 13.05.2014, 09:24
Re: Player Name hellp - by Madd92 - 13.05.2014, 10:17
Re: Player Name hellp - by MasonSFW - 14.09.2014, 12:57
Re: Player Name hellp - by blewert - 14.09.2014, 13:45
Re: Player Name hellp - by MasonSFW - 14.09.2014, 13:54

Forum Jump:


Users browsing this thread: 1 Guest(s)