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

Need Help Plugin Adversting Rename


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 06-12-2020 , 10:19   Need Help Plugin Adversting Rename
Reply With Quote #1

IP1 and IP2 removed about Adversting for Servers. the Whitelist have an full server IP but when i try to use this IP then i get kicked ...

BUILD 2228 SERVER (0 CRC)
Server # 32
Kicked :"Too many numbers in name


Please help...

Code:
"IP1",
"IP2"

PHP Code:
 #include <amxmodx>

#define MAX_NUMBERS 5

new const WHITELIST[][] =
{
    
"IP1",
    
"IP2"
}

public 
plugin_init()
{
    
register_plugin("Max Number in Name&Chat""1.1""OciXCrom")
    
register_clcmd("say""OnSay")
    
register_clcmd("say_team""OnSay")
}

public 
OnSay(id)
{
    static 
szArgs[192]
    
read_args(szArgscharsmax(szArgs))
    return 
has_advertisement(szArgs) ? PLUGIN_HANDLED PLUGIN_CONTINUE
}

public 
client_putinserver(id)
{
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))

    for(new 
isizeof(WHITELIST); i++)
    {
        if(
equali(szNameWHITELIST[i]))
        {
            return
        }
    }

    if(
has_advertisement(szName))
        
server_cmd("kick #%i ^"Too many numbers in name.^""get_user_userid(id))
}

bool:has_advertisement(const szString[])
{
    static 
iCounti
    iCount 
0

    
for(0strlen(szString); i++)
    {
        if(
isdigit(szString[i]))
            
iCount++
    }

    return 
iCount >= MAX_NUMBERS


Anyone can help?
Godofwar is offline
mahbodsr
Member
Join Date: Jun 2016
Old 06-12-2020 , 18:23   Re: Need Help Plugin Adversting Rename
Reply With Quote #2

what are you trying to do ( what do u want actually? )
mahbodsr is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-13-2020 , 00:37   Re: Need Help Plugin Adversting Rename
Reply With Quote #3

Use this Regex patter, it detects wether the message contains more than 7 numbers or not. (\d.*){7}
__________________
Relaxing 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 01:14.


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