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

Modifiction in block hash plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ssproxima
Senior Member
Join Date: Jan 2015
Old 10-10-2016 , 23:13   Modifiction in block hash plugin
Reply With Quote #1

I want a little modification in this following code, the plugin works perfect but what I want is suppose a player after connecting to the server changes the name to one of the # or % exploit the plugin should remove the symbol in his name and also if he tries to use command say/say_team the player should be kicked from server with a message "Server Crasher Exploit Detected"

Source
Code:
#include <amxmodx>

new const gBlockcmd[][]= 
{
      "%",
      "#",
      "#1Cstike"
}

public client_putinserver(id)
{
    if (is_user_connected(id))
    {
        new szName[32];
        get_user_name(id, szName, 31);
        for(new i = 0; i < sizeof(gBlockcmd); i++) {
            if(containi(szName, gBlockcmd[i]) != -1) {
                server_cmd("kick #%d ^"Cheat Detected^"", get_user_userid(id));
                return 1;
            }
        }
        
    }
    return 0;
}

Last edited by ssproxima; 10-13-2016 at 05:30. Reason: info update
ssproxima is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 10-11-2016 , 11:29   Re: Modifiction in block hash plugin
Reply With Quote #2

use this to get rid of #cstrike_lablel and %s
https://forums.alliedmods.net/showpo...7&postcount=28
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
ssproxima
Senior Member
Join Date: Jan 2015
Old 10-11-2016 , 15:51   Re: Modifiction in block hash plugin
Reply With Quote #3

Quote:
Originally Posted by indraraj striker View Post
use this to get rid of #cstrike_lablel and %s
https://forums.alliedmods.net/showpo...7&postcount=28
I had used it but when we use HLStatsx:CE plugin the server still crashes.
ssproxima is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-11-2016 , 19:48   Re: Modifiction in block hash plugin
Reply With Quote #4

So if the players name has those characters, you want them replaced with blank spaces or what?

If the player says any of those values in chat, you want them kicked?
__________________
Bugsy is offline
ssproxima
Senior Member
Join Date: Jan 2015
Old 10-11-2016 , 23:50   Re: Modifiction in block hash plugin
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
So if the players name has those characters, you want them replaced with blank spaces or what?

If the player says any of those values in chat, you want them kicked?
Absolutely you got it right....
Not only in chat but also using console say/say_team command

Last edited by ssproxima; 10-11-2016 at 23:51.
ssproxima is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-12-2016 , 22:18   Re: Modifiction in block hash plugin
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <fakemeta>

new const Version[] = "0.3";

enum BlockAction
{
    
baKick,
    
baReplace
}

new const 
gBlockcmd[][]= 
{
    
"#1Cstike",
    
"d #Spec_Help_Text #Spec_Duck",
    
"%",
    
"#"
};

new const 
gReplaceWith[] = "X";

public 
plugin_init()
{
    
register_plugin"Exploit Detector" "bugsy" Version );
    
    
register_forwardFM_ClientUserInfoChanged "ClientUserInfoChanged" );
    
    
register_clcmd"say" "CheckSay" );
    
register_clcmd"say_team" "CheckSay" );
}

public 
client_disconnectid )
{
    
remove_taskid );
}

public 
ClientUserInfoChanged(id)
{
    static const 
name[] = "name";
    new 
szOldName32 ] , szNewName32 ];
    
    
pevid pev_netname szOldName charsmaxszOldName ) );
    
    if ( 
szOldName] )
    {
        
get_user_infoid name szNewName charsmaxszNewName ) );
        
        if ( !
equalszOldName szNewName ) )
        {
            if ( 
CheckForBlockCmdid szNewName charsmaxszNewName ) , baReplace false ) )
                return 
FMRES_HANDLED;
        }
    }
    else if ( 
get_user_infoid name szNewName charsmaxszNewName ) ) )
    {
        if ( 
CheckForBlockCmdid szNewName charsmaxszNewName ) , baKick true ) )
            return 
FMRES_HANDLED;
    }
    
    return 
FMRES_IGNORED;
}

public 
CheckSayid )
{
    static 
szMsg128 ];
    
    
read_argsszMsg charsmaxszMsg ) );
    
CheckForBlockCmdid szMsg charsmaxszMsg ) , baKick false);
}

public 
CheckForBlockCmdid szMsg[] , iMaxChars BlockAction:baAction bool:bDelayKick )
{
    new 
bool:bFound;
    
    for( new 
sizeofgBlockcmd ) ; i++ ) 
    {
        if ( 
containiszMsg gBlockcmd] ) != -
        {
            switch ( 
baAction )
            {
                case 
baKick:
                {
                    if ( 
bDelayKick == true )
                    {
                        
set_task3.0 "KickPlayer" id  );
                    }
                    else
                    {
                        
KickPlayerid );
                    }
                    break;
                }
                case 
baReplace:
                {
                    
replace_allszMsg iMaxChars gBlockcmd] , gReplaceWith );
                    
bFound true;
                }
            }
        }
    }
    
    if ( 
bFound )
        
set_user_infoid "name" szMsg );
        
    return 
bFound;
}

public 
KickPlayerid )
{
    
server_cmd"kick #%d ^"Cheat Detected^"" get_user_useridid ) );

__________________

Last edited by Bugsy; 10-16-2016 at 14:59.
Bugsy is offline
ssproxima
Senior Member
Join Date: Jan 2015
Old 10-13-2016 , 05:44   Re: Modifiction in block hash plugin
Reply With Quote #7

Thank you very much it is working fine now but the only thing that is missing is why is it not kicking the player having #,% etc. in name while connecting instead of changing the characters to "X". Could you please make it possible and I think this plugin should be included in amxmodx basic package as this exploit is common and every one faces it.

Last edited by ssproxima; 10-13-2016 at 05:45.
ssproxima is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-13-2016 , 10:16   Re: Modifiction in block hash plugin
Reply With Quote #8

Code is updated, try now.
__________________
Bugsy is offline
ssproxima
Senior Member
Join Date: Jan 2015
Old 10-13-2016 , 12:32   Re: Modifiction in block hash plugin
Reply With Quote #9

nop its not working and now it is also not replacing characters with X but say command kick works fine
ssproxima is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-13-2016 , 12:35   Re: Modifiction in block hash plugin
Reply With Quote #10

Ok, I will fix when I get home.
__________________
Bugsy 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 03:28.


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