Raised This Month: $12 Target: $400
 3% 

Module: Okapi


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-01-2015 , 11:32   Re: Module: Okapi
Reply With Quote #91

You probably mean okapi_build_method. Last question, how the m_pVIP offset can be used ?(652 win, 644 linux). I have tried all the natives and no one seem to be able to get the player index from it.
__________________

Last edited by HamletEagle; 08-01-2015 at 11:32.
HamletEagle is offline
Old 08-01-2015, 11:50
Arkshine
This message has been deleted by Arkshine.
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2015 , 12:11   Re: Module: Okapi
Reply With Quote #92

Since we don't have natives in AMXX to retrieve value from an object, you have to use I guess okapi_get_ptr_cbase.
__________________
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-01-2015 , 12:13   Re: Module: Okapi
Reply With Quote #93

Yes, I tested all natives in okapi related to offsets, some return random values, and some crash(okapi_get_ptr_cbase crash too). In orpheu retrieving the value works fine.

Edit: Tested again, now it is working with okapi_get_ptr_cbase, with the same code. I don't get why.
__________________

Last edited by HamletEagle; 08-01-2015 at 12:26.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2015 , 12:24   Re: Module: Okapi
Reply With Quote #94

Show your code.
__________________
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-01-2015 , 12:29   Re: Module: Okapi
Reply With Quote #95

I don't do anything else, just retrieve the offset.

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

new g_pGameRules
new m_pVIP

public plugin_precache()
{
    new const 
InstallGameRulesSignature[] = {0x68,0xDEF,0xDEF,0xDEF,0xDEF,0xFF,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x83,0xDEF,0xDEF,0xFF,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0xA1,0xDEF,0xDEF,0xDEF,0xDEF,0xD9,0xDEF,0xDEF,0xD8,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0xDF}
    new const 
InstallGameRulesSymbol   [] = "_Z16InstallGameRulesv"

    
new okapi_func:HandleInstallGameRules okapi_build_function(OkapiGetFunctionHandle(InstallGameRulesSignaturesizeof InstallGameRulesSignatureInstallGameRulesSymbol), arg_int)
    
okapi_add_hook(HandleInstallGameRules"OnInstallGameRules", .post 1
}

public 
OnInstallGameRules()
{
    
g_pGameRules okapi_get_orig_return()
}

public 
plugin_init()
{
    
register_clcmd("test""test")
    
m_pVIP is_linux_server() ? 644 652
}

public 
test(id)
{
    
server_print("Test: %i"okapi_get_ptr_cbase(g_pGameRules m_pVIP))
}

OkapiGetFunctionHandle(const FunctionSignature[] = ""SignatureLen, const FunctionSymbol[])
{
    new 
OkapiFunc;

    if
    (
    (
OkapiFunc okapi_mod_get_symbol_ptr(FunctionSymbol)) || 
    (
OkapiFunc okapi_mod_find_sig(FunctionSignatureSignatureLen))
    )
    {
        return 
OkapiFunc
    
}
    
    return 
0

Some minutes ago it produced a crash, not it works fine. No ideea why.
__________________
HamletEagle is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 08-02-2015 , 22:06   Re: Module: Okapi
Reply With Quote #96

*waiting for Okapi release*

__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-04-2015 , 12:08   Re: Module: Okapi
Reply With Quote #97

Here again to report a bug. This happen when hooking virtual functions in linux(in windows it works). Steps are simple, hook a virtual function and enjoy the crash(segmentation fault). If it doesn't crash from first time, change map one time.

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

public plugin_precache()
{
    new const 
InstallGameRulesSignature[] = {0x68,0xDEF,0xDEF,0xDEF,0xDEF,0xFF,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x83,0xDEF,0xDEF,0xFF,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0xA1,0xDEF,0xDEF,0xDEF,0xDEF,0xD9,0xDEF,0xDEF,0xD8,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0xDF}
    new const 
InstallGameRulesSymbol[] = "_Z16InstallGameRulesv"

    
new okapi_func:InstallGameRules okapi_build_function(OkapiGetFunctionAddress(InstallGameRulesSignaturesizeof InstallGameRulesSignatureInstallGameRulesSymbol), arg_int)
    
okapi_add_hook(InstallGameRules"OnInstallGameRules", .post 1)
}  

public 
OnInstallGameRules()
{
    new 
Object okapi_get_orig_return()
    new 
CheckWinConditionsFuncOffset 65
    
new okapi_func:CheckWinConditions okapi_build_vfunc_ptr(ObjectCheckWinConditionsFuncOffsetarg_void)    
}  

OkapiGetFunctionAddress(const FunctionSignature[] = ""SignatureLen, const FunctionSymbol[])
{
    new 
OkapiAddress

    
if
    (
        (
OkapiAddress okapi_mod_get_symbol_ptr(FunctionSymbol)) || 
        (
OkapiAddress okapi_mod_find_sig(FunctionSignatureSignatureLen))
    )
    {
        return 
OkapiAddress
    
}
    
    return 
PLUGIN_CONTINUE

I'm sure that function offset is correct, succesfully hooked it with orpheu.
__________________

Last edited by HamletEagle; 08-04-2015 at 12:12.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-04-2015 , 12:26   Re: Module: Okapi
Reply With Quote #98

Why 'again' ? Previously that was your fault of misusing API or/and testing improperly, not an Okapi bug.

Unless i say bullshit, it's +2 for linux.
__________________

Last edited by Arkshine; 08-04-2015 at 12:28.
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-04-2015 , 12:39   Re: Module: Okapi
Reply With Quote #99

Not again for the bug, I'm here again asking something

It crash when getting a virtual function(tried more than one, it's not necessary about CheckWinConditions). Tried with +2(I remember it is 65, but eh), still crash.

Code:
assert_20150804093827_1.dmp[3631]: Uploading dump (out-of-process)
/tmp/dumps/assert_20150804093827_1.dmp
Segmentation fault (core dumped)
__________________

Last edited by HamletEagle; 08-04-2015 at 12:50.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-04-2015 , 13:21   Re: Module: Okapi
Reply With Quote #100

Tried, no issue. Even after several restart. Hook is well called.
Sounds like again something you did not tested properly.
Using latest dev version + official okapi version.
__________________
Arkshine 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 23:57.


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