[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


Messages In This Thread
CivType Autocorrect V1.0.0 - by KingHual - 27.09.2012, 08:21
Re: CivType Autocorrect V1.0.0 - by Gamer` - 27.09.2012, 09:39
Re: CivType Autocorrect V1.0.0 - by Ronaldo_raul™ - 27.09.2012, 09:52
Re: CivType Autocorrect V1.0.0 - by KingHual - 27.09.2012, 16:08
Re: CivType Autocorrect V1.0.0 - by HyDrAtIc - 27.09.2012, 16:16
Re: CivType Autocorrect V1.0.0 - by Glint - 27.09.2012, 17:07
Re: CivType Autocorrect V1.0.0 - by Hiddos - 27.09.2012, 18:43
Re: CivType Autocorrect V1.0.0 - by KingHual - 27.09.2012, 19:07
Re: CivType Autocorrect V1.0.0 - by Hiddos - 29.09.2012, 12:57
Re: CivType Autocorrect V1.0.0 - by MechaTech - 29.09.2012, 20:35

Forum Jump:


Users browsing this thread: 1 Guest(s)