Raised This Month: $ Target: $400
 0% 

catching uppercase...


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Dr.G
Senior Member
Join Date: Nov 2008
Old 06-26-2009 , 16:53   catching uppercase...
Reply With Quote #1

can someone explain to me how this function catches 'big' letters

PHP Code:
public say_hook(id
{
 if ((
get_user_flags(id) & ADMIN_IMMUNITY) && (get_cvar_num("amx_caps_obeyimmunity") == 1)) 
 {
  return 
PLUGIN_CONTINUE
 
}  
 
 new 
text[256]
 new 
minlen get_cvar_num("amx_caps_minlen")
 new 
Float:minpercent float(get_cvar_num("amx_caps_minpercent"))
 
 
read_args(text,256)
 
 new 
len strlen(text) - 2
 
 
if (len minlen) {
  return 
PLUGIN_CONTINUE
 
}
 
 new 
0
 
 
for (new 1;<= len;i++) 
 {
 
  if (
text[i] > 64 && text[i] < 91
  {
   
x++
  }
 } 
 
 new 
Float:percent = (float(x) / float(len)) * 100.0
 
 
if (percent >= minpercent
 {
  
punish(id)
  return 
PLUGIN_CONTINUE
 
}
 
 
 return 
PLUGIN_CONTINUE

i got it from http://forums.alliedmods.net/showthread.php?p=109695


- cheers!
__________________
Dr.G is offline
 



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

Forum Jump


All times are GMT -4. The time now is 15:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode