Raised This Month: $ Target: $400
 0% 

[HELP] block hostname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KaPaTeJIb
Member
Join Date: Oct 2012
Location: Tbilisi
Old 03-28-2014 , 10:07   [HELP] block hostname
Reply With Quote #1

Hi everyone ! I need help with block hostname. For example, if hostname will contain "myword", server will block this command (block command amx_cvar hostname "myword"). Thanks.
KaPaTeJIb is offline
Send a message via Skype™ to KaPaTeJIb
amx_tiger
Junior Member
Join Date: Aug 2012
Old 03-28-2014 , 13:13   Re: [HELP] block hostname
Reply With Quote #2

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

#define MY_STRING "myword"

public plugin_init()
{
    
register_plugin"CVAR Hostname Blocker""1.0""");
    
register_concmd("amx_cvar""CvarFunc"ADMIN_CVAR"<cvar> [value]")
}

public 
CvarFunc(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;

    new 
arg[32];
    
    
read_argv(1arg31);
    
    if (
equali(arg"hostname"))
    {
        new 
arg2[32];
        
read_argv(2arg231);

        if (
containi(arg2MY_STRING) != -1)
        {
            
console_print(id"[AMXX] Command blocked.");
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;

Compile the plugin and put it in plugins.ini above admincmd.amxx .

Here is an alternative: amx_cvar "hostname" "value" "password":

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

#define MY_STRING "mypassword"

public plugin_init()
{
    
register_plugin"CVAR Hostname Blocker""1.0""");
    
register_concmd("amx_cvar""CvarFunc"ADMIN_CVAR"<cvar> [value]")
}

public 
CvarFunc(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;

    new 
arg[32];
    
    
read_argv(1arg31);
    
    if (
equali(arg"hostname"))
    {
        new 
arg2[32];
        
read_argv(3arg231);

        if (!
equal(arg2MY_STRING))
        {
            
console_print(id"[AMXX] Command blocked.");
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;

amx_tiger is offline
KaPaTeJIb
Member
Join Date: Oct 2012
Location: Tbilisi
Old 03-28-2014 , 13:58   Re: [HELP] block hostname
Reply With Quote #3

Thank you very much, it works
KaPaTeJIb is offline
Send a message via Skype™ to KaPaTeJIb
KaPaTeJIb
Member
Join Date: Oct 2012
Location: Tbilisi
Old 03-29-2014 , 04:30   Re: [HELP] block hostname
Reply With Quote #4

Ops, I've found bug. I can't use cvars...They don't work.
KaPaTeJIb is offline
Send a message via Skype™ to KaPaTeJIb
amx_tiger
Junior Member
Join Date: Aug 2012
Old 03-29-2014 , 04:54   Re: [HELP] block hostname
Reply With Quote #5

The plugin work fine. The only cvar the plugin can block is "hostname", in any other ways the plugin allow to send the command forward to the rest of the plugins (like admincmd.amxx).
amx_tiger is offline
KaPaTeJIb
Member
Join Date: Oct 2012
Location: Tbilisi
Old 03-29-2014 , 05:04   Re: [HELP] block hostname
Reply With Quote #6

Quote:
block_hostname.amxx

; Admin Base - Always one has to be activated
admin.amxx ; admin base (required for any admin-related)
;admin_sql.amxx ; admin base - SQL version (comment admin.amxx)


; Basic

admincmd.amxx ; basic admin console commands
adminhelp.amxx ; help command for admin console commands
adminslots.amxx ; slot reservation
multilingual.amxx ; Multi-Lingual management


; Menus

menufront.amxx ; front-end for admin menus
cmdmenu.amxx ; command menu (speech, settings)
plmenu.amxx ; players menu (kick, ban, client cmds.)
;telemenu.amxx ; teleport menu (Fun Module required!)
mapsmenu.amxx ; maps menu (vote, changelevel)
pluginmenu.amxx ; Menus for commands/cvars organized by plugin


; Chat / Messages

adminchat.amxx ; console chat commands
antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages
adminvote.amxx ; vote commands


; Map related

nextmap.amxx ; displays next map in mapcycle
mapchooser.amxx ; allows to vote for next map
timeleft.amxx ; displays time left on map


; Configuration

pausecfg.amxx ; allows to pause and unpause some plugins
statscfg.amxx ; allows to manage stats plugins via menu and commands


; Counter-Strike

;restmenu.amxx ; restrict weapons menu
statsx.amxx ; stats on death or round end (CSX Module required!)
;miscstats.amxx ; bunch of events announcement for Counter-Strike
;stats_logging.amxx ; weapons stats logging (CSX Module required!)


; Enable to use AMX Mod plugins

;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
I did as you say, but it doesn't work...

Last edited by KaPaTeJIb; 03-29-2014 at 05:29.
KaPaTeJIb is offline
Send a message via Skype™ to KaPaTeJIb
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-29-2014 , 06:28   Re: [HELP] block hostname
Reply With Quote #7

Then how are they changing the histname?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
KaPaTeJIb
Member
Join Date: Oct 2012
Location: Tbilisi
Old 03-29-2014 , 08:56   Re: [HELP] block hostname
Reply With Quote #8

Please, excuse me, plugin works. I've just combine your code in my plugin...
KaPaTeJIb is offline
Send a message via Skype™ to KaPaTeJIb
vikvik
Junior Member
Join Date: Apr 2014
Old 10-09-2014 , 19:34   Re: [HELP] block hostname
Reply With Quote #9

how about to block server console command hostname
if I write in the console hostname to show me this.
vikvik is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-09-2014 , 19:46   Re: [HELP] block hostname
Reply With Quote #10

Quote:
Originally Posted by vikvik View Post
how about to block server console command hostname
if I write in the console hostname to show me this.
If it's possible to block, how do plan on setting the hostname in the first place?
__________________

Last edited by fysiks; 10-09-2014 at 19:46.
fysiks 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 06:01.


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