Raised This Month: $32 Target: $400
 8% 

Hook Event_Killed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CoolPeter
Member
Join Date: Nov 2005
Old 11-30-2005 , 01:13   Hook Event_Killed
Reply With Quote #1

i want to hook the Event_Killed function, but i can't get it to work

here is my code:
Code:
HDEFVFUNC(Event_Killed, void, (CBaseEntity* pCBPlayer, const CTakeDamageInfo &info));

...

void VFUNC New_Event_Killed(CBaseEntity* pCBPlayer, const CTakeDamageInfo &info)
{
}

...

void CServerPlugin::ClientActive( edict_t *pEntity )
{
	CBasePlayer *pCBPlayer = (CBasePlayer*)CBaseEntity::Instance(pEntity);

	if(pCBPlayer)
	{
		if (!Q_strcmp(pCBPlayer->GetClassname(), "player"))
		{
			HOOKVFUNC(pCBPlayer, 0, pCBPlayer->Event_Killed, New_Event_Killed);
		}
	}
}
i use the Virtual function table hook mechanism from http://forums.alliedmods.net/showthr...?t=37161#15248

it get these errors (translated):
Code:
error C2039: 'Event_KilledRaw_Org': Is not an element of 'CBasePlayer'
error C2039: 'Event_KilledGate': Is not an element of 'CBasePlayer'
error C2228: The left part of '.Build' have to be a class/struct/union
can someone help me?
sry 4 all my stupid questions, but i want to lern it
CoolPeter is offline
Reply


Thread Tools
Display Modes

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 02:21.


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