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

[RESOLVED] Finding Offsets


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
neo_gis
Member
Join Date: Sep 2009
Location: Rabat
Old 06-06-2010 , 19:48   [RESOLVED] Finding Offsets
Reply With Quote #1

i use this function to find offsets on ep1 , when i ported the plugin to css beta , the function now crashes the server :

PHP Code:
int FindOffset(const char *ClassName, const char *PropertyName)
{
    
ServerClass *sc server->GetAllServerClasses();
    while (
sc)
    {
        if (
FStrEq(sc->GetName(), ClassName))
        {
            
int NumProps sc->m_pTable->GetNumProps();
            for (
int i=0i<NumPropsi++)
            {
                if (
FStrEq(sc->m_pTable->GetProp(i)->GetName(), PropertyName))
                {
                    return 
sc->m_pTable->GetProp(i)->GetOffset();
                }
        
            }
            return 
0;
        }
        
sc sc->m_pNext;
    }

    return 
0;

and i found out the this call is the one crashing :
PHP Code:
(FStrEq(sc->m_pTable->GetProp(i)->GetName(), PropertyName
how shall i modify the function to work with Orange Box ?
__________________

Last edited by neo_gis; 06-09-2010 at 08:07.
neo_gis is offline
Send a message via MSN to neo_gis Send a message via Skype™ to neo_gis
Keeper
Senior Member
Join Date: Nov 2006
Old 06-06-2010 , 22:38   Re: Finding Offsets
Reply With Quote #2

Debug the code. PropertyName or sc->m_pTable->GetProp(i)->GetName() is null.
Keeper is offline
neo_gis
Member
Join Date: Sep 2009
Location: Rabat
Old 06-07-2010 , 03:20   Re: Finding Offsets
Reply With Quote #3

seems like this is null : sc->m_pTable->GetProp(i)->GetName()

i added this :
PHP Code:
if(sc->m_pTable->GetProp(i)->GetName() == NULL)
                    continue; 
but its not solving the problem . any way to get arround this ?

Thx for the help !
__________________
neo_gis is offline
Send a message via MSN to neo_gis Send a message via Skype™ to neo_gis
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 06-07-2010 , 07:40   Re: Finding Offsets
Reply With Quote #4

PHP Code:
int FindOffset(const char *ClassName, const char *PropertyName)
{
Msg("Debuggin FindOffset: a");
    
ServerClass *sc server->GetAllServerClasses();Msg("b");
    while (
sc)
    {
Msg("c");
        if (
FStrEq(sc->GetName(), ClassName))
        {
Msg("d");
            
int NumProps sc->m_pTable->GetNumProps();Msg("e");
            for (
int i=0i<NumPropsi++)
            {
Msg("f");
                if (
FStrEq(sc->m_pTable->GetProp(i)->GetName(), PropertyName))
                {
Msg("g");
                    return 
sc->m_pTable->GetProp(i)->GetOffset();
                }
        
            }
Msg("h");
            return 
0;
        }
Msg("i");
        
sc sc->m_pNext;Msg("j");
    }
Msg("\n");
    return 
0;

Lazy people out there. If you can't handle with a debugger, do it the way I do. It works fine ;)

Chris
Chrisber is offline
neo_gis
Member
Join Date: Sep 2009
Location: Rabat
Old 06-07-2010 , 08:36   Re: Finding Offsets
Reply With Quote #5

hey guys,

now i know that this is the problem :
PHP Code:
sc->m_pTable->GetProp(i)->GetName() 
all methods of the props are working except GetName -________- .

Any other way to solve this problem and get the offsets ?

Thx for the help !
__________________
neo_gis is offline
Send a message via MSN to neo_gis Send a message via Skype™ to neo_gis
API
Veteran Member
Join Date: May 2006
Old 06-08-2010 , 22:50   Re: Finding Offsets
Reply With Quote #6

Check if its all valid...:
Code:
if(!sc || !sc->m_pTable || !sc->m_pTable->GetProp(i) || !sc->m_pTable->GetProp(i)->GetName())
   continue;
__________________
API is offline
Send a message via AIM to API
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 06-09-2010 , 05:16   Re: Finding Offsets
Reply With Quote #7

Are you using the correct dt_send.h (or is it dt_recv.h) header?
The 'hl2sdk-ob-valve' reversed engineered version should work fine but the hl2sdk-ob version will not and cause problems like yours.

Mani
__________________
Installation files, documentation and help can be found at: -

www.mani-admin-plugin.com
Mani is offline
neo_gis
Member
Join Date: Sep 2009
Location: Rabat
Old 06-09-2010 , 08:06   Re: Finding Offsets
Reply With Quote #8

Quote:
Originally Posted by Mani View Post
Are you using the correct dt_send.h (or is it dt_recv.h) header?
The 'hl2sdk-ob-valve' reversed engineered version should work fine but the hl2sdk-ob version will not and cause problems like yours.

Mani
omg Mani thx a mill , changed the sdk to hl2sdk-ob-valve' and it worked . psychonic told me to but i tought i already had the right sdk .

Thx again guys !
__________________
neo_gis is offline
Send a message via MSN to neo_gis Send a message via Skype™ to neo_gis
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 03:30.


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