13.05.2014, 10:17
I just messed around a little bit and the result was the following function:
toupper and tolower are two defines originally posted by ******:
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.
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;
}
pawn Код:
#define toupper(%0) \
(((%0) >= 'a' && (%0) <= 'z') ? ((%0) & ~0x20) : (%0))
#define tolower(%0) \
(((%0) >= 'A' && (%0) <= 'Z') ? ((%0) | 0x20) : (%0))
I hope it helps.

