[FilterScript] Anti-Capital Letters - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Anti-Capital Letters (
/showthread.php?tid=509295)
Anti-Capital Letters -
forgottenkings - 26.04.2014
Anti Capital Letter System.
This function will disable capital letters..
PHP код:
#include <a_samp>
public OnPlayerText(playerid, text[]) return DeCaps(text);
forward DeCaps(str[]);
public DeCaps(str[])
{
for(new i = 0; i < strlen(str); i++) if(65 <= str[i] <= 90) str[i] += 32;
return 1;
}
Re: Anti-Capital Letters -
forgottenkings - 26.04.2014
tnx
Re: Anti-Capital Letters -
TDM - 26.04.2014
Its super easy ... Not bad
Re: Anti-Capital Letters -
Mark_Samp - 26.04.2014
Pretty Useful
Good
Re: Anti-Capital Letters -
forgottenkings - 27.04.2014
thank you!!
Re: Anti-Capital Letters -
wups - 27.04.2014
Change
pawn Код:
for(new i = 0; i < strlen(str); i++)
to
pawn Код:
for(new i=0,j=strlen(str); i<j; i++)
With this code you have strlen(str)-1 less function calls.
Re: Anti-Capital Letters -
Jimmy0wns - 27.04.2014
Cheers!
Re: Anti-Capital Letters -
Vince - 27.04.2014
This is more a snippet rather than an actual filterscript. Besides, it will also filter out any legit capital letters. Suggest you keep track of the count and only invoke the function if the capital/lowercase ratio exceeds, say, 30%.
Re: Anti-Capital Letters -
Jimmy0wns - 27.04.2014
Quote:
Originally Posted by Vince
This is more a snippet rather than an actual filterscript. Besides, it will also filter out any legit capital letters. Suggest you keep track of the count and only invoke the function if the capital/lowercase ratio exceeds, say, 30%.
|
It's not really a filterscript indeed, but if you have a server that includes a /caps(off) command, it can be really usefull!
Re: Anti-Capital Letters -
forgottenkings - 28.04.2014
okay :P