[Include] CivType Autocorrect V1.0.0
#1

CivType Autocorrect V1.0

What is this about?
We've all noticed how annoying it is when people type stuff like "oMg hElp PlzZzZzz,.,.,.i neEd Heelppp!1111". Well, this include can prevent it. It formats a string into "correct" format.

Features in V1.0:

- Adds a capital "I" when the word I is used.
- Adds a capital letter at the start of a string.
- Adds a space after punctuation such as ". , ! or ?" if there's none already.
- Capitalizes the first letter after ". ! or ?".
- Removes the unnecessary upper case letters in words.
- Returns the characters changed as an integer.
- Adds a comma before some words.

Syntax:

pawn Code:
CivConvert(source[], dest[], int size);
*source - A char array, representing the string that should be restyled
*dest - A char array, representing the string that the restyled string should be packed into
*size - An integer, representing the count of characters that will be packed into the destination string


-Returns: int destSize - The size of the string after it's been restyled.

Example:
I have also made a script that replaces all the messages that people send ingame as an example.
pawn Code:
public OnPlayerText(playerid, text[])
{
    new txt[128+MAX_PLAYER_NAME+20], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, 24);
    CivConvert(text, txt, strlen(text));
    format(txt, sizeof(txt), "%s(%i):{ffffff} %s", pname, playerid, txt);
    SendClientMessageToAll(0xFFFFFFFF, txt);
    return 0;
}
This code will autocorrect what people send ingame and will ignore the original message, sending only the corrected one.

Media:

[ame]http://www.youtube.com/watch?v=LNwDJ-FKzfY[/ame]

Downloads:

Pastebin: http://pastebin.com/guwpsYvv
SolidFiles: http://www.solidfiles.com/d/eab6052ff3/

Mirrors are welcome.

How to use:

Simply put the file "civtype.inc" in your "ServerFolder/pawno/include" folder, and use the line "#include <civtype>" in your scripts.
Reply
#2

Nice.
Reply
#3

Pretty amazing. Good job.
Reply
#4

Thanks
Reply
#5

Quote:
Originally Posted by king_hual
View Post
We've all noticed how annoying it is when people type stuff like "oMg hElp PlzZzZzz,.,.,.i neEd Heelppp!1111". Well, this include can prevent it.
You said "prevent",This won't prevent it if somebody said like an example:"OmG PlEzS HeLp!" It will just correct it and make it "Omg plezs help!" this is just a grammar corrector nothing else,you should correct and update your thread.


OT:Pretty nice job! I'm going to use this
Reply
#6

Quote:
Originally Posted by James_Nick
View Post
You said "prevent",This won't prevent it if somebody said like an example:"OmG PlEzS HeLp!" It will just correct it and make it "Omg plezs help!" this is just a grammar corrector nothing else,you should correct and update your thread.


OT:Pretty nice job! I'm going to use this
Maybe the person who wrote it isn't good in English why should it Completely prevent him ? he said it will prevent him from WrItInG LiKe tHiS bEcAuSe iT iS aNnOying.

OT Nice job errrm let me think not nice perfect.

Here eat a virtual cookie
Reply
#7

Quote:
Originally Posted by James_Nick
View Post
You said "prevent",This won't prevent it if somebody said like an example:"OmG PlEzS HeLp!" It will just correct it and make it "Omg plezs help!" this is just a grammar corrector nothing else,you should correct and update your thread.
This probably is one of the most intelligent posts ever on this forum, +reps.

OT: pretty nice, though looking at your source code you do realize you can just use the characters in 'c' things instead of using it's direct ASCII value?
pawn Code:
new i = 65;
// OR
new i = 'A'; (A -> 65 in ASCII)
Reply
#8

Quote:
Originally Posted by Hiddos
View Post
This probably is one of the most intelligent posts ever on this forum, +reps.

OT: pretty nice, though looking at your source code you do realize you can just use the characters in 'c' things instead of using it's direct ASCII value?
pawn Code:
new i = 65;
// OR
new i = 'A'; (A -> 65 in ASCII)
Well since I've got an ASCII table, does it really matter?
Reply
#9

Quote:
Originally Posted by king_hual
View Post
Well since I've got an ASCII table, does it really matter?
Nope but IMO it's easier to overlook if you plan on editing this ^^
Reply
#10

Nice I am going to use this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)