Raised This Month: $ Target: $400
 0% 

Blocking Unicode Characters


Post New Thread Reply   
 
Thread Tools Display Modes
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 06:39   Re: Blocking Unicode Characters
Reply With Quote #11

Quote:
Originally Posted by maqi View Post
We actually did that already, both me and fysiks. If you still need help, give more info.
The problem is that steam players & nonsteam players can use lots of characters in nickname.
I want to replace them to space character. The nickname just will have characters CS supports.
Like; "abcdefghijklmnopqrstuwxv01234-#. etc
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-29-2018 , 06:51   Re: Blocking Unicode Characters
Reply With Quote #12

We already told you everything you want to know, either on this thread or the other 3 regarding the same question
__________________
stuff
maqi is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 07:14   Re: Blocking Unicode Characters
Reply With Quote #13

Quote:
Originally Posted by maqi View Post
Loop through all characters, try isalpha() then replace it
Quote:
Originally Posted by fysiks View Post
There are characters that are not Unicode and are not alpha characters. Probably just need to check if they are ASCII (i.e. less than or equal to 128).

I guess you mean these posts. I do not understand perfectly what do you mean. I will check all characters and check if are alpha and ASCII
(I do not know what does mean ASCII and how to check it)

Does it work?

PHP Code:

new const characters[] = {
    
"a","b","c","d","e","f","g","h" ///....etc
}

public 
client_connect(id)
{
    new 
name[32];
    
get_user_name(idnamecharsmax(name));

    for(new 
i=032i++)
    {
        if(!
name[i] || !isalpha(name[i]))
        {
            continue;
        }

        for(new 
w=0w<sizeof charactersw++)
        {
            if(
equali(name[i], characters[w]))
            {
                continue;
            }
            
name[i] = '';
        }
    }
    
client_cmd(id"name ^"%s^""name);

new name[32];
get_user_name(id, name, charsmax(name));

for(new i=0; i<32; i++)
{
if(!name[i] || !isalpha(name[i]))
{
continue;
}

if(name[i] < 48 || name[i] > 90)
{
name[i] = ' ';
}
}
set_user_info(id, "name", name);
client_cmd(id, "name ^"%s^"", name);
}
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }


Last edited by PurposeLessx; 06-29-2018 at 07:15.
PurposeLessx is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-29-2018 , 07:22   Re: Blocking Unicode Characters
Reply With Quote #14

Try....
__________________
stuff
maqi is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 07:28   Re: Blocking Unicode Characters
Reply With Quote #15

Isn't there any basic and optimized method to check the characters of name?
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-29-2018 , 07:30   Re: Blocking Unicode Characters
Reply With Quote #16

Try this, don't post in Scripting Help if you have no idea how to script.
PHP Code:
#include < amxmodx >

public plugin_init( )
{
    
register_plugin"Block Symbols""1.0""DoNii" );
}

public 
client_putinserverid )
{
    
CheckSymbolsid );
}

public 
client_infochangedid )
{
    
CheckSymbolsid );
}

public 
CheckSymbolsid )
{
    new 
szName32 ];
    
get_user_nameidszNamecharsmaxszName ) );
    
    for( new 
isizeof szNamei++ )
    {
        if( 
szName] >= 128 )
        
replace_allszNamecharsmaxszName ), szName], "*" );
    }
    
set_user_infoid"name"szName );

__________________

Last edited by edon1337; 06-29-2018 at 07:32.
edon1337 is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 07:41   Re: Blocking Unicode Characters
Reply With Quote #17

Quote:
Originally Posted by edon1337 View Post
Try this, don't post in Scripting Help if you have no idea how to script.
I have idead to script but If I knew, I wouldn't have asked you, don't worry.

+ This plugin blocked these characters ? "- [ ] _ #" ?
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-29-2018 , 07:59   Re: Blocking Unicode Characters
Reply With Quote #18

Look up ascii characters on google to see which characters are included between 0 and 127. You can then allow certain ones that you deem ok.

sizeof can be replaced with charsmax() in the abive code since the last char is always 0.
__________________
Bugsy is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 08:27   Re: Blocking Unicode Characters
Reply With Quote #19

Okay I will check ascii characters out as you are saying. But I don't understand what do you mean in the last text. What I should replace with charsmax?
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 08:49   Re: Blocking Unicode Characters
Reply With Quote #20

Is there any mistake here?

PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_plugin("Nick""1.0""PurposeLess");
}

public 
client_connect(id)
{
    
nickss(id);
}

public 
client_infochanged(id)
{
    
nickss(id);
}

public 
nickss(id)
{
    new 
name[32];
    
get_user_name(idnamecharsmax(name));

    for(new 
i=0i<charsmax(name), i++)
    {
        if(!(
32 <= name[i] <= 126))
        {
            
replace(namecharsmax(name), name[i], "");
        }
    }

    if(
strlen(name) < 5)
    {
        
format(namecharsmax(name), "unnamed");
    }

    
set_user_info(id"name"name);

__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }


Last edited by PurposeLessx; 06-29-2018 at 09:19.
PurposeLessx 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 14:47.


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