View Full Version : First character - lower to Upper

10/08/2010, 02:24 PM
I want to make the first character of the first word to upper.
Something like a CAPS LOCK but then only for the first character of the first word.

3 Example:
I write this down: follow me
Message appears as: Follow me

I write this down: hacks OFF or ban!
Message appears as: Hacks OFF or ban!

I write this down: aaaaaaaaaaaaaaaa bbbbbb ccccccccccc
Message appears as: Aaaaaaaaaaaaaaaa bbbbbb ccccccccccc

10/08/2010, 02:29 PM
In Final GameMode

forward UpperToLower(text[]);
public UpperToLower(text[])
for(new Char ; Char < strlen(text) ; Char++)
if(text[Char] > 64 && text[Char] < 91)
text[Char] += 32;
return 1;

Is OnPlayerText


10/08/2010, 02:31 PM
public OnPlayerText(playerid, text[])
if(text[0] >= 97 && text[0] <= 122) text[0]-=32;
return SendPlayerMessageToAll(playerid, text);

Edit to Drakon: For some weird reason lowerchase starts at 97, and upperchar at 65 :p

10/08/2010, 02:46 PM
Ugh sorry I didn't mention this, But its for a command..

if(text[0] == '&' && PlayerInfo[playerid][Level] >= 1) {
new string[128];
format(string,sizeof(string),"Admin: %s%s",string,text[1]); SendClientMessageToAll(green,string);
return 0;

10/08/2010, 04:05 PM
lool jus put under OnPlayerText

text[0] = toupper(text[0]);

That will make the first char of the text / string to upper so if you do let say :

Ivex say: dsadasdad nnnddd

it will be

Ivex say: Dsadasdad nnnddd

etc ... else if you do for other chats than you put insteed of "text" you put string or result or what ever you got :)

10/08/2010, 05:07 PM
Nope still fails =\

10/08/2010, 07:10 PM
im sure this one that ****** said it working... epic ****** win... XD

just need to put ****** code and onplayertext

text[0] = toupper(text[0]);

already tested... and works

EDIT: ****** please check your pm's

10/08/2010, 07:51 PM
If you want to implement it in the specific command that you posted, it would look like this.

if(text[0] == '&' && PlayerInfo[playerid][Level] >= 1)
new string[128];
text[1] = toupper(text[1]);
format(string,sizeof(string),"Admin: %s",text[1]); SendClientMessageToAll(green,string);
return 0;

The other code didn't work because text[0] is not used at all in the string in your command.

10/08/2010, 09:56 PM
yep... anyways thanks ;)

@offtopic and JaTochNietDan please visit this http://forum.sa-mp.com/showthread.php?t=166896 no one tryng to help me... in a plugin

15/07/2012, 06:49 PM
*DELETED* (where is delete function? -.-)