Raised This Month: $ Target: $400
 0% 

Check values in names


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 01-04-2011 , 08:46   Check values in names
Reply With Quote #1

How can I detect names, which consist only of digits (0-9) ?

Examples:
890685114333
769008765445
881220806131
Racoon is offline
Send a message via ICQ to Racoon
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-04-2011 , 09:03   Re: Check values in names
Reply With Quote #2

is_str_num
__________________
Bugsy is offline
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 01-04-2011 , 09:07   Re: Check values in names
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
thnxxx)))))
Racoon is offline
Send a message via ICQ to Racoon
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 01-04-2011 , 13:36   Re: Check values in names
Reply With Quote #4

Ok, I need to ban fake players with names, which consist of digits. They keep flooding the server via proxies, so it's not possible to ban them all. The code below doesn't work. All players are kicked instead.
PHP Code:
#include <amxmodx>

public plugin_init() 
{
    
register_plugin("Antifake""0.1""Racoon")
}

public 
client_authorized(id)
{
    new 
name[32]
    
read_argv(1,name,31)
    if(!
is_str_num(name))
    {
        
server_cmd("kick #%d ^"F*CK YOUfake Player!^""get_user_userid(id))
    }

Racoon is offline
Send a message via ICQ to Racoon
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-04-2011 , 13:58   Re: Check values in names
Reply With Quote #5

get_user_name( id , name , charsmax( name ) ) instead of read_argv

Also, remove the ! since you want to kick if all digits.
__________________

Last edited by Bugsy; 01-04-2011 at 14:02.
Bugsy is offline
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 01-04-2011 , 15:53   Re: Check values in names
Reply With Quote #6

Yeah, works perfect! Thx again
Racoon is offline
Send a message via ICQ to Racoon
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 01:57.


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