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

Getting players weapon & offset question


Post New Thread Reply   
 
Thread Tools Display Modes
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 07-30-2010 , 11:54   Re: Getting players weapon & offset question
Reply With Quote #11

Don't work, thanks anyway.
Can anybody explain what exactly the "handle" is?

For example, there are 4 types in the datamap:
Code:
FIELD_CLASSPTR
FIELD_EHANDLE
FIELD_EDICT
FIELD_FUNCTION
CBaseEntity.m_hOwnerEntity has for example the following value:
Code:
CBaseEntity:
    m_hOwnerEntity: 0x276697748 (handle entity) [412]
What exactly is the 0x276697748? Derefence it isn't possible and it also doesn't look like a real memory address. How can I compare it with another CBaseEntity?

Chris
Chrisber is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 07-30-2010 , 12:07   Re: Getting players weapon & offset question
Reply With Quote #12

Quote:
Originally Posted by Chrisber View Post
Don't work, thanks anyway.
Can anybody explain what exactly the "handle" is?

For example, there are 4 types in the datamap:
Code:
FIELD_CLASSPTR
FIELD_EHANDLE
FIELD_EDICT
FIELD_FUNCTION
CBaseEntity.m_hOwnerEntity has for example the following value:
Code:
CBaseEntity:
    m_hOwnerEntity: 0x276697748 (handle entity) [412]
What exactly is the 0x276697748? Derefence it isn't possible and it also doesn't look like a real memory address. How can I compare it with another CBaseEntity?

Chris
try this:

Code:
CBaseCombatCharacter* GetOwner(CBaseCombatWeapon* pWeapon)
 {
 	CHandle<CBaseEntity> hOwner = *((CHandle<CBaseEntity>*)GetDataFromByteOffset(pWeapon, idxGetOwner));
	return (CBaseCombatCharacter*)GetBaseEntFromEHandle(hOwner);
 }
 
 CBaseEntity* GetBaseEntFromEHandle(const CBaseHandle& handle)
 {
 	edict_t *pEntity = engine->PEntityOfEntIndex(handle.GetEntryIndex());
	if (pEntity)
	{
		if (pEntity->GetUnknown())
			return pEntity->GetUnknown()->GetBaseEntity();
	else
		return NULL;
	}
 }
sn4k3 is offline
Send a message via MSN to sn4k3
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 07-30-2010 , 14:50   Re: Getting players weapon & offset question
Reply With Quote #13

Thanks
Works like a charm

A recommend from me: Use
Code:
return pEnts->EdictToBaseEntity(pEngine->PEntityOfEntIndex(handle.GetEntryIndex()));
pEnts is of type IServerGameEnts.

Chris
Chrisber is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 07-30-2010 , 14:58   Re: Getting players weapon & offset question
Reply With Quote #14

glad it works
sn4k3 is offline
Send a message via MSN to sn4k3
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 07-30-2010 , 19:17   Re: Getting players weapon & offset question
Reply With Quote #15

An alternative could be using CBaseCombatCharacter::GetActiveWeapon() ?

Linux Symbol is _ZNK20CBaseCombatCharacter15GetActiveWeaponEv
Signature is "8B 81 A8 07 00 00 83 F8 FF 74 ? 8B 15 ? ? ? ? 8B C8 81 E1 FF 0F 00 00"


I've not tested any of them btw.

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

www.mani-admin-plugin.com

Last edited by Mani; 07-30-2010 at 19:19.
Mani 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 15:56.


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