Raised This Month: $ Target: $400
 0% 

catching uppercase...


Post New Thread Reply   
 
Thread Tools Display Modes
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
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-26-2009 , 16:55   Re: catching uppercase...
Reply With Quote #2

[I]if (text[i] > 64 && text < 91)

Ansii chars or what ever there is
__________________
xPaw is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-26-2009 , 17:05   Re: catching uppercase...
Reply With Quote #3



The ascii values for the capital letters are 65 ('A') to 90 ('Z').
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 06-26-2009 , 17:05   Re: catching uppercase...
Reply With Quote #4

oh ok i see. thank you
__________________
Dr.G is offline
Reply



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