AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Need Help Plugin Adversting Rename (https://forums.alliedmods.net/showthread.php?t=325212)

Godofwar 06-12-2020 10:19

Need Help Plugin Adversting Rename
 
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?

mahbodsr 06-12-2020 18:23

Re: Need Help Plugin Adversting Rename
 
what are you trying to do ( what do u want actually? )

Relaxing 06-13-2020 00:37

Re: Need Help Plugin Adversting Rename
 
Use this Regex patter, it detects wether the message contains more than 7 numbers or not. (\d.*){7}


All times are GMT -4. The time now is 16:32.

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