AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ OKAPI ] Get offset value (https://forums.alliedmods.net/showthread.php?t=250166)

HamletEagle 10-19-2014 11:52

[ OKAPI ] Get offset value
 
In orpheu we can do this:
Code:
OrpheuMemoryGetAtAddress( g_pGameRules, "offset" )

But how do to the same in okapi ?

Arkshine 10-19-2014 11:55

Re: [ OKAPI ] Get offset value
 
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_*

HamletEagle 10-19-2014 12:03

Re: [ OKAPI ] Get offset value
 
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 ) )

Arkshine 10-19-2014 12:36

Re: [ OKAPI ] Get offset value
 
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.

HamletEagle 10-19-2014 12:53

Re: [ OKAPI ] Get offset value
 
Thx, now it's working.

Arkshine 10-19-2014 13:00

Re: [ OKAPI ] Get offset value
 
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".

HamletEagle 10-19-2014 13:05

Re: [ OKAPI ] Get offset value
 
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.

Arkshine 10-19-2014 14:44

Re: [ OKAPI ] Get offset value
 
If you know, why did you use okapi_get_ptr_int ? You should use okapi_get_ptr_byte.


All times are GMT -4. The time now is 17:35.

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