Raised This Month: $ Target: $400
 0% 

Blocking Unicode Characters


Post New Thread Reply   
 
Thread Tools Display Modes
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-29-2018 , 08:51   Re: Blocking Unicode Characters
Reply With Quote #21

i<name
__________________
stuff
maqi is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 08:54   Re: Blocking Unicode Characters
Reply With Quote #22

What I should write instead? If I write 32 or 33, is it going to be mistake?
Or sizeof 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 08:56.
PurposeLessx is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-29-2018 , 08:56   Re: Blocking Unicode Characters
Reply With Quote #23

Whatever you write is gonna be better then the code above, Bugsy already told you, do you even read the replies people gave you ?
__________________
stuff
maqi is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-29-2018 , 09:10   Re: Blocking Unicode Characters
Reply With Quote #24

Quote:
Originally Posted by PurposeLessx View Post
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?
I already said that I didn't understand how to do.

I did this plugin but when I change name, my name is going to be unnamed and never changes

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(!(
name[i] <= 126))
        {
            
replace_all(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
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-29-2018 , 09:57   Re: Blocking Unicode Characters
Reply With Quote #25

Quote:
Originally Posted by PurposeLessx View Post
I already said that I didn't understand how to do.

I did this plugin but when I change name, my name is going to be unnamed and never changes

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(!(
name[i] <= 126))
        {
            
replace_all(namecharsmax(name), name[i], "");
        }
    }

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

    
set_user_info(id"name"name);

huh? u check specified character: if(!(name[i] <= 126)) and replace whole string: replace_all(name, charsmax(name), name[i], "");, just edit specified character: name[i] = ' ';
(Note: this is performance improvement & dont think if this will fix ur issue)
(Note 2: you use replace_all and replace specified characters to empty characters ("") (If u want to change them to space then it must be " "))
(Note 3: issue may be that the when u replace character with empty character as i said, its reformatting and character places in 'name' string are changing)
(Note 4: u use two-operation statement if when it can be just one: if((!(name[i] <= 126)) => if (name[i] > 126))
(Note 5: Note 4 is not enough, there's special characters before 127, and you must add second statement: if (name[i] < 32 || name[i] > 126) (Cause one or two from those special characters are used to type in chat with blue/red/white/green color).
__________________

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


Probably Left AM

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

It works but how to delete character instead of replacing with ' '?

Plugin does
name KırmızıGül
changed name to "K r m z G l"

I want
name KırmızıGül
changed name to "KrmzGl"
__________________
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
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-29-2018 , 10:11   Re: Blocking Unicode Characters
Reply With Quote #27

Quote:
Originally Posted by PurposeLessx View Post
It works but how to delete character instead of replacing with ' '?

Plugin does
name KırmızıGül
changed name to "K r m z G l"

I want
name KırmızıGül
changed name to "KrmzGl"
u can use replace_all and remove whitespace but this will remove user own spaces
__________________

[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 , 10:16   Re: Blocking Unicode Characters
Reply With Quote #28

Quote:
Originally Posted by Ghosted View Post
u can use replace_all and remove whitespace but this will remove user own spaces
Does not it work if I use name[i] = 0 instead of using name[i] = ' ';
It will make character null instead of space
__________________
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 10:17.
PurposeLessx is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-29-2018 , 10:32   Re: Blocking Unicode Characters
Reply With Quote #29

Quote:
Originally Posted by PurposeLessx View Post
Does not it work if I use name[i] = 0 instead of using name[i] = ' ';
It will make character null instead of space
yea, i said that to u

use replace_all after for loop
__________________

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


Probably Left AM

Last edited by Ghosted; 06-29-2018 at 10:33.
Ghosted is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-30-2018 , 11:40   Re: Blocking Unicode Characters
Reply With Quote #30

Quote:
Originally Posted by PurposeLessx View Post
The problem is that steam players & nonsteam players can use lots of characters in nickname.
Removing non-Steam players will probably solve half your problem.
__________________
fysiks 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:38.


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