AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] block hostname (https://forums.alliedmods.net/showthread.php?t=237679)

KaPaTeJIb 03-28-2014 10:07

[HELP] block hostname
 
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.

amx_tiger 03-28-2014 13:13

Re: [HELP] block hostname
 
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;



KaPaTeJIb 03-28-2014 13:58

Re: [HELP] block hostname
 
Thank you very much, it works :)

KaPaTeJIb 03-29-2014 04:30

Re: [HELP] block hostname
 
Ops, I've found bug. I can't use cvars...They don't work.

amx_tiger 03-29-2014 04:54

Re: [HELP] block hostname
 
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).

KaPaTeJIb 03-29-2014 05:04

Re: [HELP] block hostname
 
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...

YamiKaitou 03-29-2014 06:28

Re: [HELP] block hostname
 
Then how are they changing the histname?

KaPaTeJIb 03-29-2014 08:56

Re: [HELP] block hostname
 
Please, excuse me, plugin works. I've just combine your code in my plugin...

vikvik 10-09-2014 19:34

Re: [HELP] block hostname
 
how about to block server console command hostname
if I write in the console hostname to show me this.

fysiks 10-09-2014 19:46

Re: [HELP] block hostname
 
Quote:

Originally Posted by vikvik (Post 2209174)
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?


All times are GMT -4. The time now is 06:01.

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