SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/08/2010, 02:24 PM   #1
Rolyy
Huge Clucker
 
Join Date: Jul 2010
Location: Behind my computer?
Posts: 209
Reputation: 0
Default First character - lower to Upper

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
__________________
Simple Player.
Advanced Beginner Scripter
Rolyy is offline   Reply With Quote
Old 10/08/2010, 02:29 PM   #2
ipsBruno
Godfather
 
ipsBruno's Avatar
 
Join Date: Apr 2010
Location: Brazil, Caxias RS
Posts: 6,087
Reputation: 545
Default Re: First character - lower to Upper

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
pawn Code:
UpperToLower(text);
ipsBruno is offline   Reply With Quote
Old 10/08/2010, 02:31 PM   #3
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 3,307
Reputation: 2184
Default Re: First character - lower to Upper

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
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline   Reply With Quote
Old 10/08/2010, 02:46 PM   #4
Rolyy
Huge Clucker
 
Join Date: Jul 2010
Location: Behind my computer?
Posts: 209
Reputation: 0
Default Re: First character - lower to Upper

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;
	}
__________________
Simple Player.
Advanced Beginner Scripter
Rolyy is offline   Reply With Quote
Old 10/08/2010, 04:05 PM   #5
ivex
Little Clucker
 
Join Date: Jan 2010
Posts: 39
Reputation: 0
Default Re: First character - lower to Upper

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
ivex is offline   Reply With Quote
Old 10/08/2010, 05:07 PM   #6
Rolyy
Huge Clucker
 
Join Date: Jul 2010
Location: Behind my computer?
Posts: 209
Reputation: 0
Default Re: First character - lower to Upper

Nope still fails =\
__________________
Simple Player.
Advanced Beginner Scripter
Rolyy is offline   Reply With Quote
Old 10/08/2010, 07:10 PM   #7
SlashPT
High-roller
 
SlashPT's Avatar
 
Join Date: Sep 2009
Location: Hell
Posts: 1,973
Reputation: 116
Default Re: First character - lower to Upper

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
__________________

Zh3r0Jansish

Last edited by SlashPT; 10/08/2010 at 07:20 PM.
SlashPT is offline   Reply With Quote
Old 10/08/2010, 07:51 PM   #8
JaTochNietDan
High-roller
 
JaTochNietDan's Avatar
 
Join Date: Apr 2007
Location: Republic of Ireland
Posts: 2,502
Reputation: 363
Default Re: First character - lower to Upper

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.
JaTochNietDan is offline   Reply With Quote
Old 10/08/2010, 09:56 PM   #9
SlashPT
High-roller
 
SlashPT's Avatar
 
Join Date: Sep 2009
Location: Hell
Posts: 1,973
Reputation: 116
Default Re: First character - lower to Upper

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
__________________

Zh3r0Jansish
SlashPT is offline   Reply With Quote
Old 15/07/2012, 06:49 PM   #10
Bubelbub
Little Clucker
 
Join Date: Dec 2010
Posts: 29
Reputation: 0
Default AW: First character - lower to Upper

*DELETED* (where is delete function? -.-)
Bubelbub is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
lower server ping? jamesbond007 Server Support 17 20/07/2010 06:00 PM
lower wanted level Smokey619 Help Archive 16 17/07/2010 10:00 PM
Wanted Lower ()ZzY Help Archive 3 05/11/2009 04:00 PM
How to get lower ping? Ezio_Da_Firenze Client Support 2 20/10/2009 05:10 PM
Lower Wanted Level Kodman262 Help Archive 19 10/08/2009 09:06 AM


All times are GMT. The time now is 03:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.