AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Source Servers (SRCDS) (https://forums.alliedmods.net/forumdisplay.php?f=130)
-   -   Prevent clantag change prevent (https://forums.alliedmods.net/showthread.php?t=304838)

Nexd 01-28-2018 16:41

Prevent clantag change prevent
 
Hello, is there anything what can prevent hacks/binds like this?
Spoiler

PinHeaDi 01-28-2018 18:34

Re: Prevent clantag change prevent
 
https://forums.alliedmods.net/showthread.php?t=281610

Zuby24 01-29-2018 04:11

Re: Prevent clantag change prevent
 
Use this:

Code:

#include <regex>
Regex regex;

public OnPluginStart()
{
    new String:error[256];

    if( (regex = CompileRegex("^.*<(\\d+)><", _, error, sizeof(error))) == INVALID_HANDLE)
    {
        SetFailState("Regex pattern fail %s", error);
    }

    AddGameLogHook(gameloghook);
}

public Action gameloghook(const char[] message)
{
    //"Bacardi<2><STEAM_1:1:xxxxx><TERRORIST>" triggered "clantag" (value "SM")

    static userids[MAXPLAYERS+1];
    static counter[MAXPLAYERS+1];
    static timestamp[MAXPLAYERS+1];

    if(StrContains(message, "triggered \"clantag\"") > 0)
    {
        new substrings = MatchRegex(regex, message);

        if(substrings > 1)
        {
            new String:buffer[30];
            GetRegexSubString(regex, 1, buffer, sizeof(buffer));
            new userid = StringToInt(buffer);
            new client = GetClientOfUserId(userid);

            if(client != 0 && IsClientInGame(client))
            {
                if(userids[client] == userid)
                {
                    if(timestamp[client] >= GetTime())
                    {
                        counter[client]++;

                        if(counter[client] >= 5)
                        {
                            KickClient(client, "Spamming clantag");
                        }
                    }
                    else
                    {
                        counter[client] = 0;
                    }
                    timestamp[client] = GetTime()+3;
                }
                else
                {
                    userids[client] = userid;
                    counter[client] = 0;
                }
            }
        }
    }
    return Plugin_Continue;
}

It works flawesly.

Nexd 01-29-2018 09:04

Re: Prevent clantag change prevent
 
Thankyouu


All times are GMT -4. The time now is 20:19.

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