AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Command Intercept - AMX bug? (https://forums.alliedmods.net/showthread.php?t=3858)

crazyfool2100 07-17-2004 05:29

Command Intercept - AMX bug?
 
Hey,

I am trying to create a logging plugin that logs a specific set of commands that are implemented by metamod plugins.

I know that it is possible to intercept commands with the client_command function (ie kill, say). I also know that it is possible to intercept commands like +attack and +moveleft using prethink. However, what I have not seen (and yes i searched the board for quite a while) is how to intercept custom +namehere commands, such as +hook. Lets say i wanted to intercept +hook from a client, I couldnt use prethink (atleast this is my understanding) becuase it isnt a built in command. I looked at the examples for intercepting +attack and it uses the constant IN_ATTACK or something. I dont think there is a constant for +hook or any other custom +namehere commands.

Is there anyway to intercept custom +namehere commands?

Any help would be greatly appriciated

PM 07-17-2004 05:45

Intercepting custom commands is a bit tricky. If you want to intercept a command registered by an other metamod plugin, you have to make sure that amxx comes first in the plugins list. Also, if you want to register a command that was registered by an AMXX plugin, make sure your plugin comes first (or last? I don't remember) in the plugins.ini and try returning PLUGIN_HANDLED.

crazyfool2100 07-17-2004 05:59

I am trying to intercept commands from another metamod plugin ;). I read on a post that they could use client_command to incetcept commands (ie kill) but not +commands (he was trying to intercept +attack). Is this problem only for built in +commands? If so, will it be possible to intercept custom +commands with client_command?

:)

BAILOPAN 07-17-2004 06:23

Yes. The special +commands are actually button/state codes, not commands.

crazyfool2100 07-17-2004 07:08

I am trying to see everything that I can intercept, but for some reason this does not work. I have been staring at it and i cannot see what is wrong

Setup:
Svencoop 3.0
Entmod
Amx
HLDS (Steam)

Code:

#include <amxmodx>

new AUTH[] = "Client Intercept"
new PLUGIN_NAME[] = "clientintercept"
new VERSION[] = "0.1"


public plugin_init() {
 
        register_plugin(PLUGIN_NAME,VERSION,AUTH)
       
}


public client_command(id) {
  new arg1[129]
    read_argv(0, arg1, 128)
    client_print(id, print_console, "command: %s", arg1)
    return PLUGIN_CONTINUE
}


PM 07-17-2004 11:00

return PLUGIN_HANDLED
?

QwertyAccess 07-17-2004 19:31

so i assume there is no possible way to intercept something such as
alias +3jumps "+jump; wait; .... other stuff"
alias -3jumps "-jump"

PM 07-18-2004 04:21

aliases are resolved client side (I assume).
I also assume waits are processed client side too, so no, you can't completly block that command :)

crazyfool2100 07-19-2004 02:22

Hmm, i have tried all sorts of variations of this and nothing works at all. I have turnd off all of the metamod plugins so only amx is running, but it still doesnt work. Is this a bug in the current release of amx that should be looked at, becuase i cannot see what is wrong :\ I tried putting this at the top and the bottom of my plugins.ini file, nothin works. It compiles without any errors or warnings and when i look at amx_plugins, it is running.

Code:


#include <amxmodx>

new AUTH[] = "Client Intercept"
new PLUGIN_NAME[] = "clientintercept"
new VERSION[] = "0.1"


public plugin_init() {
 
        register_plugin(PLUGIN_NAME,VERSION,AUTH)
       
}


public client_command(id) {
    new arg1[129]
    read_argv(0, arg1, 128)
    client_print(id, print_chat, "client_command called")
    client_print(id, print_console, "client_command called")

    client_print(id, print_console, "command: %s", arg1)
    client_print(id, print_chat, "command: %s", arg1)
    return PLUGIN_CONTINUE
  // return PLUGIN_HANDLED // tried, no work
}

I get nothing from the server (a seperate server from my client: dedicated). Anyone see an error? Or might this be an amx problem?

Argh :\

crazyfool2100 07-19-2004 03:10

Wow, i redownloaded 0.16 and it works now. I was using someones modified 0.16 version of amxx_mm.dll becuase of some crash error it claimed to fix

=)


All times are GMT -4. The time now is 14:42.

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