Raised This Month: $ Target: $400
 0% 

Question about read_argv / read_args


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-02-2015 , 13:29   Re: Question about read_argv / read_args
Reply With Quote #9

If you want to change the command just edit the plugin. If you do not have the source code, don't use the plugin.

Edit: read_argv uses pfnCmd_Argv, which is an engine exported function. With orpheu you may be able to hook the function and alter it's value when it is called. Look at this example(note that I am not sure what you want to do, so I don't know what snippet to give you, look at the example and try to make what you need to).

PHP Code:
#include <amxmodx>
#include <orpheu>
#include <orpheu_stocks>

new OrpheuHook:HandleCmd_ArgvHook

public plugin_init()
{
    
register_clcmd("test""ClientCommand_Test")
}

public 
ClientCommand_Test(id)
{
    new 
Argument[32]
    
HandleCmd_ArgvHook OrpheuRegisterHook(OrpheuGetEngineFunction("pfnCmd_Argv""ReadArgv"), "pfnCmd_Argv")
    
read_argv(1Argumentcharsmax(Argument))
    
server_print("Got: %s"Argument)
}

public 
OrpheuHookReturn:pfnCmd_Argv(Argc)
{
    
OrpheuSetReturn("SomeRandomReturnHere")
    
OrpheuUnregisterHook(HandleCmd_ArgvHook)
    return 
OrpheuOverride

Signature:
Code:
{
    "name" : "ReadArgv",
    "library" : "engine",
    "arguments" :
    [
        {
            "type" : "int"
        }
    ],
    "return" :
    {
        "type" : "char *"
    }
}
So let's say you write test 123, and the value returned by read_argv should be 123. Well, the snippet change it to SomeRandomReturnHere and that is what you will get.

Last edited by HamletEagle; 10-02-2015 at 14:25.
HamletEagle is offline
 



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 22:15.


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