27.09.2012, 08:21
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:
*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.
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.
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);
*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;
}
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.