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

Block ip in chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author
MegoltElek
Junior Member
Join Date: Dec 2020
Plugin ID:
7405
Plugin Version:
1.0
Plugin Category:
All
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Block ip address in chat that said by a player
    Old 12-04-2020 , 19:45   Block ip in chat
    Reply With Quote #1

    The plugin block every message that have some kind of ip address in it.
    Admins can say ip address in chat.
    This plugin can literally block every form of ip address, like:
    • 255.255.255.255
    • 255.255.255.255:99999
    • 255 . 255 . 255 . 255
    • 255 255 255 255
    • 255*255*255*255
    • 255-255_255/255
    • 255::255::255::255
    • 255 asd 255 asd 255 asd 255
    • 255(dot)255(dot)255(dot)255
    • 255☻255☻255☻255
    • etc....
    Attached Files
    File Type: sp Get Plugin or Get Source (blockip.sp - 450 views - 904 Bytes)
    File Type: smx blockip.smx (4.2 KB, 154 views)

    Last edited by MegoltElek; 12-04-2020 at 19:46. Reason: missing description
    MegoltElek is offline
    StrikeR14
    AlliedModders Donor
    Join Date: Apr 2016
    Location: Behind my PC
    Old 12-05-2020 , 10:39   Re: Block ip in chat
    Reply With Quote #2

    Thanks for this, can you add a whitelist IPs cfg option so they won't be triggered?
    __________________
    Currently taking TF2/CSGO paid private requests!

    My Plugins | My Discord Account
    StrikeR14 is offline
    MegoltElek
    Junior Member
    Join Date: Dec 2020
    Old 12-05-2020 , 10:46   Re: Block ip in chat
    Reply With Quote #3

    Quote:
    Originally Posted by StrikeR14 View Post
    Thanks for this, can you add a whitelist IPs cfg option so they won't be triggered?
    I will update it when i have time for it.
    Maybe this weekend or the next week.
    MegoltElek is offline
    K1lleR_gamea
    Junior Member
    Join Date: Mar 2019
    Location: Israel
    Old 12-05-2020 , 10:51   Re: Block ip in chat
    Reply With Quote #4

    PHP Code:
    #pragma semicolon 1

    #define DEBUG

    #define PLUGIN_AUTHOR "MegoltElek"
    #define PLUGIN_VERSION "1.0"
    #define PLUGIN_DESCRIPTION "Block ip in chat"

    Handle g_rIP;

    char g_szWhitelist[][] = {
        
    "IP"
    };

    #include <sourcemod>
    #include <regex>

    public Plugin myinfo = {
        
    name "[ANY] Block ip in chat",
        
    author PLUGIN_AUTHOR,
        
    description PLUGIN_DESCRIPTION,
        
    version PLUGIN_VERSION,
        
    url "https://steamcommunity.com/id/megoltelekhun/"
    };

    public 
    void OnPluginStart(){
        
    g_rIP CompileRegex("\\d+\\D+\\d+\\D+\\d+\\D+\\d+");
        
        
    AddCommandListener(Cmd_Say"say");
        
    AddCommandListener(Cmd_Say"say_team");
        
        
    LoadTranslations("common.phrases");
    }

    public 
    Action Cmd_Say(int client, const char[] szCommandint args){
        if (
    IsValidClient(client)){
            
    char szText[512];
            
    GetCmdArgString(szTextsizeof(szText));
            
            if (
    MatchRegex(g_rIPszText) > && !IsWhitelisted(szText)){
                
    StripQuotes(szText);
                return 
    Plugin_Handled;
            }
        }
        return 
    Plugin_Changed;
    }

    stock bool IsWhitelisted(const char[] szIP){
        for (
    int i 0sizeof(g_szWhitelist); i++){
            if (
    StrEqual(szIPg_szWhitelist[i])){
                return 
    true;
            }
        }
        return 
    false;
    }

    stock bool IsValidClient(int client){
        if (
    client >= && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client) && !IsClientSourceTV(client) && !IsClientReplay(client)){
            return 
    true;
        }
        return 
    false;

    I enabled whitelisting of IP's

    Last edited by K1lleR_gamea; 12-05-2020 at 10:51.
    K1lleR_gamea 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 05:36.


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