Raised This Month: $51 Target: $400
 12% 

Blocking Unicode Characters


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-25-2018 , 05:28   Blocking Unicode Characters
Reply With Quote #1

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)
__________________
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-25-2018 at 05:30.
PurposeLessx is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-25-2018 , 07:11   Re: Blocking Unicode Characters
Reply With Quote #2

Loop through all characters, try isalpha() then replace it

PS: Your signature wouldn't compile
__________________
stuff
maqi is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 06-25-2018 , 14:40   Re: Blocking Unicode Characters
Reply With Quote #3

Better consider using regex for things like that.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-25-2018 , 17:49   Re: Blocking Unicode Characters
Reply With Quote #4

Quote:
Originally Posted by maqi View Post
PS: Your signature wouldn't compile

get_user_iq() should return an integer. As a workaround you can use str_to_num() on user_IQ in the if-statement.
__________________
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-26-2018 , 02:19   Re: Blocking Unicode Characters
Reply With Quote #5

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

PS: Your signature wouldn't compile
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).
__________________

Last edited by fysiks; 06-26-2018 at 02:20.
fysiks is online now
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-28-2018 , 20:01   Re: Blocking Unicode Characters
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post

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?
Really I need this plugin. I am waiting.
__________________
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-28-2018 , 22:23   Re: Blocking Unicode Characters
Reply With Quote #7

Quote:
Originally Posted by PurposeLessx View Post
Is it correct now?
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" );
    }

__________________
Bugsy is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-29-2018 , 02:48   Re: Blocking Unicode Characters
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
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);
	}
}
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 04:06   Re: Blocking Unicode Characters
Reply With Quote #9

Is it really important what my signature :ddd
If only you would have helped my problem :d
__________________
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:25   Re: Blocking Unicode Characters
Reply With Quote #10

We actually did that already, both me and fysiks. If you still need help, give more info.
__________________
stuff
maqi 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 00:04.


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