Raised This Month: $ Target: $400
 0% 

how to block "not single character word"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
0920357689
Senior Member
Join Date: Apr 2008
Old 06-30-2010 , 09:22   how to block "not single character word"
Reply With Quote #1

PHP Code:
new name_disconnect[70
format(name_disconnect69"abcdefghijklmnopqrstuvwxyz1234567890!@#$% ^"&*()-_=+[{]}\|,<.>/?;:'`~");
 
new name[32],name_len;
  get_user_name(id, name, 31);
  name_len = strlen(name);
  for(new name_lenstart = 0;name_lenstart < name_len;name_lenstart++)
  {
   if(contain(name_disconnect,name[name_lenstart]) == -1)
   {
    new userid = get_user_userid(id);
    server_cmd( "kick #%d",userid);
   }
  } 
% in utf-8 is 3 characters
% is 1 characters


this core have bug
i can't find where bug....

Last edited by 0920357689; 06-30-2010 at 21:17.
0920357689 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-30-2010 , 16:36   Re: how to block "not 1 characters word"
Reply With Quote #2

I'm not sure if this will work but it is similar to what you are doing:

PHP Code:
new name[32], name_len;
get_user_name(idname31);
name_len strlen(name);
for(new 
name_lenstart 0;name_lenstart name_len;name_lenstart++)
{
    if(
name[name_lenstart] > 255)
    {
        new 
userid get_user_userid(id);
        
server_cmd"kick #%d",userid);
    }

__________________
fysiks is offline
0920357689
Senior Member
Join Date: Apr 2008
Old 06-30-2010 , 19:43   Re: how to block "not 1 characters word"
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
I'm not sure if this will work but it is similar to what you are doing:

PHP Code:
new name[32], name_len;
get_user_name(idname31);
name_len strlen(name);
for(new 
name_lenstart 0;name_lenstart name_len;name_lenstart++)
{
    if(
name[name_lenstart] > 255)
    {
        new 
userid get_user_userid(id);
        
server_cmd"kick #%d",userid);
    }

my core is check player name on 0-31 characters
sure no have 3characters word in name


my english very bad sorry
0920357689 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-30-2010 , 20:57   Re: how to block "not 1 characters word"
Reply With Quote #4

Quote:
Originally Posted by 0920357689 View Post
my english very bad
Yes, you are horrible at English.

That character that you posted (at least the one that I see) is decribed by Unicode as:

U+FF05 Fullwidth percent sign

And is only a single character.
__________________
fysiks is offline
0920357689
Senior Member
Join Date: Apr 2008
Old 06-30-2010 , 21:12   Re: how to block "not 1 characters word"
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
Yes, you are horrible at English.

That character that you posted (at least the one that I see) is decribed by Unicode as:

U+FF05 Fullwidth percent sign

And is only a single character.

PHP Code:
strlen(name[next single word]) > 
will kick....but how to find single word
i want use "for" to do this
0920357689 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-30-2010 , 23:01   Re: how to block "not 1 characters word"
Reply With Quote #6

Quote:
Originally Posted by 0920357689 View Post
PHP Code:
strlen(name[next single word]) > 
will kick....but how to find single word
i want use "for" to do this
I don't know what you are saying. Your example code makes no sense.
__________________
fysiks is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 07-01-2010 , 20:41   Re: how to block "not single character word"
Reply With Quote #7

I 'm not sure if it work ! maybe I have got your think !
just test the following code, un-test:

Code:
public CheckFunction( id ) {
    static name_check[ 192 ];
    format( name_check, charsmax( name_check ), "your special character" );
 
    static user_name[ 32 ];
    get_user_name( id, user_name, charsmax( user_name ) );
 
    for ( new i = 0; i < sizeof name_check; i++ ) {
         if ( contain( user_name, name_check[ i ] ) != -1 ) {
             server_cmd( "kick #%d", get_user_userid( id ) );
         }
    }
}
__________________
QQ:116268742

Last edited by K.K.Lv; 07-01-2010 at 20:45.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
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 14:46.


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