Raised This Month: $32 Target: $400
 8% 

Prevent clantag change prevent


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 01-28-2018 , 16:41   Prevent clantag change prevent
Reply With Quote #1

Hello, is there anything what can prevent hacks/binds like this?
Spoiler
Nexd is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 01-28-2018 , 18:34   Re: Prevent clantag change prevent
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=281610
__________________
PinHeaDi is offline
Zuby24
Member
Join Date: Apr 2017
Location: Romania/Bucharest
Old 01-29-2018 , 04:11   Re: Prevent clantag change prevent
Reply With Quote #3

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.
__________________
Zuby24 is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 01-29-2018 , 09:04   Re: Prevent clantag change prevent
Reply With Quote #4

Thankyouu
Nexd is offline
Reply


Thread Tools
Display Modes

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 03:08.


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