Raised This Month: $ Target: $400
 0% 

[ OKAPI ] Get offset value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-19-2014 , 11:52   [ OKAPI ] Get offset value
Reply With Quote #1

In orpheu we can do this:
Code:
OrpheuMemoryGetAtAddress( g_pGameRules, "offset" )

But how do to the same in okapi ?
__________________

Last edited by HamletEagle; 10-19-2014 at 11:52.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-19-2014 , 11:55   Re: [ OKAPI ] Get offset value
Reply With Quote #2

Like I told before, Okapi is essentially the same as Orpheu with similar API but with slight difference (since it doesn't rely on config file).

okapi_get_ptr_*
okapi_set_ptr_*
__________________
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-19-2014 , 12:03   Re: [ OKAPI ] Get offset value
Reply With Quote #3

I've tried this and it crash when a player join the server:
Code:
const m_bTargetBombedWin = 124 const m_bTargetBombedLin = 116 if( okapi_get_ptr_int( is_linux_server( ) ? m_bTargetBombedLin : m_bTargetBombedWin ) )
__________________

Last edited by HamletEagle; 10-19-2014 at 12:06.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-19-2014 , 12:36   Re: [ OKAPI ] Get offset value
Reply With Quote #4

Maybe you should read the native description?

It takes a memory address. Since such members are from CGameRules class, you need basically: address CGameRules + member offset.

CGameRules address can be retrieved from InstallGameRules return value.
__________________
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-19-2014 , 12:53   Re: [ OKAPI ] Get offset value
Reply With Quote #5

Thx, now it's working.
__________________

Last edited by HamletEagle; 10-19-2014 at 12:57.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-19-2014 , 13:00   Re: [ OKAPI ] Get offset value
Reply With Quote #6

First, you should use the real member name.
Second, you have to care about the member type.
If boolean you're not going to use "_int" but "_byte".
Generally 'm_bSomething" ; b stands for "boolean".
__________________
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-19-2014 , 13:05   Re: [ OKAPI ] Get offset value
Reply With Quote #7

I know that b stands from bool, and m_bBombTarget is the real member name, isn't it ? But I get what you mean, I think I will just check if it's linux server in init and fill m_bBombTarget with right value.
__________________

Last edited by HamletEagle; 10-19-2014 at 13:10.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-19-2014 , 14:44   Re: [ OKAPI ] Get offset value
Reply With Quote #8

If you know, why did you use okapi_get_ptr_int ? You should use okapi_get_ptr_byte.
__________________
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 12:14.


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