First character - lower to Upper -
Rolyy - 10.08.2010
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
Re: First character - lower to Upper -
ipsBruno - 10.08.2010
In Final GameMode
pawn Code:
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
Re: First character - lower to Upper -
Hiddos - 10.08.2010
pawn Code:
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
Re: First character - lower to Upper -
Rolyy - 10.08.2010
Ugh sorry I didn't mention this, But its for a command..
Code:
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;
}
Re: First character - lower to Upper -
ivex - 10.08.2010
lool jus put under OnPlayerText
Code:
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
Re: First character - lower to Upper -
Rolyy - 10.08.2010
Nope still fails =\
Re: First character - lower to Upper -
SlashPT - 10.08.2010
im sure this one that ****** said it working... epic ****** win... XD
just need to put ****** code and onplayertext
pawn Code:
text[0] = toupper(text[0]);
already tested... and works
EDIT: ****** please check your pm's
Re: First character - lower to Upper -
JaTochNietDan - 10.08.2010
If you want to implement it in the specific command that you posted, it would look like this.
pawn Code:
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.
Re: First character - lower to Upper -
SlashPT - 10.08.2010
yep... anyways thanks
@offtopic and JaTochNietDan please visit this
https://sampforum.blast.hk/showthread.php?tid=166896 no one tryng to help me... in a plugin
AW: First character - lower to Upper -
Bubelbub - 15.07.2012
*DELETED* (where is delete function? -.-)