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

Getting an edict_t from a CBsaeEntity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TommyV
Member
Join Date: Nov 2005
Old 10-17-2006 , 08:32   Getting an edict_t from a CBsaeEntity
Reply With Quote #1

I'm trying to get a plugin to work after the update, but one of my functions requires an edict_t that I used to get from CBaseEntity::edict()

I'm getting a pointer to a CBaseEntity using

CBaseEntity *pEntity = META_IFACEPTR(CBaseEntity);

whilst hooking CCSPlayer::Weapon_CanUse, which still seems to work fine, it doesn't crash when calling pEntity->edict, but when I try to use it as an edict_t it crashes.

Anyone got any ideas how I can get around this? I'm guessing valve have changed something again. CBaseENtity::edict is not virtual so cant call it via offset, and I also notice it says 'should be removed!' in baseenity.h

Thanks,

Tommy
TommyV is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 10-17-2006 , 10:04   Re: Getting an edict_t from a CBsaeEntity
Reply With Quote #2

I used ->edict() until the update also, which was bad as it's an inline function.

I now user IServerGameEnts::BaseEntityToEdict. Load the interface (INTERFACEVERSION_SERVERGAMEENTS) from the serverFactory in mms.
L. Duke is offline
TommyV
Member
Join Date: Nov 2005
Old 10-17-2006 , 10:30   Re: Getting an edict_t from a CBsaeEntity
Reply With Quote #3

Thanks Duke, I was hoping there was an easy way of doing it.

How do you guys figure out this stuff?
TommyV is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 10-17-2006 , 17:36   Re: Getting an edict_t from a CBsaeEntity
Reply With Quote #4

Lots of browsing the interfaces, grepping the source files, and a big portion of asking other pluign authors.

L. Duke is offline
TommyV
Member
Join Date: Nov 2005
Old 10-18-2006 , 13:50   Re: Getting an edict_t from a CBsaeEntity
Reply With Quote #5

Well I'm really glad you share your knowledge, my plugin is now saved. Thanks
TommyV 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 09:45.


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