AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blocking Unicode Characters (https://forums.alliedmods.net/showthread.php?t=308551)

PurposeLessx 06-25-2018 05:28

Blocking Unicode Characters
 
How can I block unicode characters in server? it will be replaced to empty character.
We will not see this character in the chat.

For example:

Player : Look at here! ౾! How is it?

It will be replaced.

Player : Look at here! ! How is it?

replace_all(msg, charsmax(msg), "౾",""); (NOT WORKING)

----

So, we will just see normal characters which display in console.
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,W,X ,Z,1,2,3,4,5,6,7,8,9,0,-,? (As them)

maqi 06-25-2018 07:11

Re: Blocking Unicode Characters
 
Loop through all characters, try isalpha() then replace it

PS: Your signature wouldn't compile :D

NiHiLaNTh 06-25-2018 14:40

Re: Blocking Unicode Characters
 
Better consider using regex for things like that.

Bugsy 06-25-2018 17:49

Re: Blocking Unicode Characters
 
Quote:

Originally Posted by maqi (Post 2599184)
PS: Your signature wouldn't compile :D

:lol:
get_user_iq() should return an integer. As a workaround you can use str_to_num() on user_IQ in the if-statement.

fysiks 06-26-2018 02:19

Re: Blocking Unicode Characters
 
Quote:

Originally Posted by maqi (Post 2599184)
Loop through all characters, try isalpha() then replace it

PS: Your signature wouldn't compile :D

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).

PurposeLessx 06-28-2018 20:01

Re: Blocking Unicode Characters
 
Quote:

Originally Posted by Bugsy (Post 2599258)
:lol:
get_user_iq() should return an integer. As a workaround you can use str_to_num() on user_IQ in the if-statement.

Is it correct now? :lol:
Really I need this plugin. I am waiting.

Bugsy 06-28-2018 22:23

Re: Blocking Unicode Characters
 
Quote:

Originally Posted by PurposeLessx (Post 2599777)
Is it correct now? :lol:
Really I need this plugin. I am waiting.

Should be something like this:
PHP Code:

public client_connect(id

    if ( 
get_user_iqid ) < 80 )
    {
        
client_printid print_chat "go to school more" );
    }



Ghosted 06-29-2018 02:48

Re: Blocking Unicode Characters
 
Quote:

Originally Posted by Bugsy (Post 2599794)
Should be something like this:
PHP Code:

public client_connect(id

    if ( 
get_user_iqid ) < 80 )
    {
        
client_printid print_chat "go to school more" );
    }



Code:

public client_connect(id)
{
        if ( get_user_iq( id ) < 80 )
        {
                server_cmd("kick #%i go to school more", id);
        }
}


PurposeLessx 06-29-2018 04:06

Re: Blocking Unicode Characters
 
Is it really important what my signature :ddd
If only you would have helped my problem :d

maqi 06-29-2018 06:25

Re: Blocking Unicode Characters
 
We actually did that already, both me and fysiks. If you still need help, give more info.


All times are GMT -4. The time now is 18:02.

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