AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to block "not single character word" (https://forums.alliedmods.net/showthread.php?t=131023)

0920357689 06-30-2010 09:22

how to block "not single character word"
 
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....

fysiks 06-30-2010 16:36

Re: how to block "not 1 characters word"
 
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);
    }



0920357689 06-30-2010 19:43

Re: how to block "not 1 characters word"
 
Quote:

Originally Posted by fysiks (Post 1224899)
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:cry:

fysiks 06-30-2010 20:57

Re: how to block "not 1 characters word"
 
Quote:

Originally Posted by 0920357689 (Post 1225055)
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.

0920357689 06-30-2010 21:12

Re: how to block "not 1 characters word"
 
Quote:

Originally Posted by fysiks (Post 1225108)
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

fysiks 06-30-2010 23:01

Re: how to block "not 1 characters word"
 
Quote:

Originally Posted by 0920357689 (Post 1225119)
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.

0920357689 06-30-2010 23:07

Re: how to block "not 1 characters word"
 
Quote:

Originally Posted by fysiks (Post 1225174)
I don't know what you are saying. Your example code makes no sense.


strlen(name[next single word]) > 1

if single word len over "single characters" will kick
but how to check one word
because name[len] can't get over "single characters word"

fysiks 06-30-2010 23:59

Re: how to block "not single character word"
 
Each slot in the variable "name" is a single character. If my name is "fysiks" then "name" would look like this:

Code:

name[0] = 'f'
name[1] = 'y'
name[2] = 's'
name[3] = 'i'
name[4] = 'k'
name[5] = 's'
name[6] = 0 // End of String


0920357689 07-01-2010 00:54

Re: how to block "not single character word"
 
Quote:

Originally Posted by fysiks (Post 1225198)
Each slot in the variable "name" is a single character. If my name is "fysiks" then "name" would look like this:

Code:

name[0] = 'f'
name[1] = 'y'
name[2] = 's'
name[3] = 'i'
name[4] = 'k'
name[5] = 's'
name[6] = 0 // End of String


YES
but if name is CHT CHS or JP or other language
name = "中文"

name[0] != '中'
name[1] != '中'
name[2] != '中'

this word is
three character in utf-8
two character in ascII

name [0-2] = '中'

so..how to chang next word start len to 'strlen' check

fysiks 07-01-2010 18:05

Re: how to block "not single character word"
 
I still don't quite understand what is going on. I'm not sure that the characters that you are typing are being interpreted correctly by the forum.

Give me an example name and tell me what each of those characters are in UTF-8. So, my name is "fysiks", tell me {U+0066, U+0079, U+0073, U+0069, U+006B, U+0073}


All times are GMT -4. The time now is 14:46.

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