Raised This Month: $ Target: $400
 0% 

Question about read_argv / read_args


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-02-2015 , 13:45   Re: Question about read_argv / read_args
Reply With Quote #1

Look at my post again, it may help you.
HamletEagle is offline
Max3
Junior Member
Join Date: Sep 2015
Old 10-02-2015 , 15:57   Re: Question about read_argv / read_args
Reply With Quote #2

That plugin works. The string retrieved by read_argv is patched, but the argument in the string retrieved by read_args is not patched. In my case, I thought if I patch the argument (read_argv) will work, but it didn't work. So I need to patch read_Args to see if it will work. So I tried and modified your example in:

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

new OrpheuHook:HandleCmd_ArgsHook

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

public 
ClientCommand_Test(id)
{
    new 
Args[32]
    
HandleCmd_ArgsHook OrpheuRegisterHook(OrpheuGetEngineFunction("pfnCmd_Args""ReadArgs"), "pfnCmd_Args")
    
read_args(Argscharsmax(Args))
    
server_print("Got: %s"Args)
}

public 
OrpheuHookReturn:pfnCmd_Args()
{
    
OrpheuSetReturn("SomeRandomReturnHere")
    
OrpheuUnregisterHook(HandleCmd_ArgsHook)
    return 
OrpheuOverride

Signature:
PHP Code:
{
    
"name" "ReadArgs",
    
"library" "engine",
    
"return" :
    {
        
"type" "char *"
    
}

But I got one error:
PHP Code:
[ORPHEUInvalid function structure "ReadArgs" 
Any ideas?

Last edited by Max3; 10-02-2015 at 15:58.
Max3 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-03-2015 , 09:47   Re: Question about read_argv / read_args
Reply With Quote #3

What you did is correct.

From eiface.h:
Code:
const char *(*pfnCmd_Args)				( void );		// these 3 added 
const char *(*pfnCmd_Argv)				( int argc );	// so game DLL can easily
Did you rename the file from ReadArgv to ReadArgs ? It seems you forgot to do so, because I tested with your file and modified plugin and it worked correctly.
Please write orpheu config in server console and post here the output(you will find it in amxmodx/logs).

Last edited by HamletEagle; 10-03-2015 at 09:51.
HamletEagle is offline
Max3
Junior Member
Join Date: Sep 2015
Old 10-03-2015 , 11:30   Re: Question about read_argv / read_args
Reply With Quote #4

I am sorry it was my fault. I copied the file in the wrong directory. Everything works fine now, including my plugin.

Thank you very much for your help!
Max3 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 22:15.


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