Raised This Month: $ Target: $400
 0% 

hooking game start or messages


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Beqa Gurgenidze
BANNED
Join Date: Nov 2016
Old 08-25-2017 , 01:55   Re: hooking game start or messages
Reply With Quote #1

Quote:
Originally Posted by killerZM View Post
ty

@edit
what if need to get message arguments ?
then you need to hook WriteByte, WriteCoord etc.. + MessageEnd forwards.

then you need to create bool array where you will which message arguments are you getting from forward WriteXXXX.

Code:
bool MessageHooked[256];
Lets hook health message & get argument (1 Byte Argument) (https://wiki.alliedmods.net/Half-life_1_game_events)

Code:
#define MESSAGE_HEALTH 70

void OnMessageBegin(int Dest, int Type, const float *pOrigin, edict_t *pPlayer)
{
	switch (Type)
	{
	case MESSAGE_HEALTH:
	{
		MessageHooked[MESSAGE_HEALTH] = true;
		RETURN_META(MRES_IGNORED);
	}
	}

	RETURN_META(MRES_IGNORED);
}

void OnWriteByte(int Value)
{
	if (MessageHooked[MESSAGE_HEALTH])
	{
		// First Value = health
		// Wanna Change IT?
		// then do like this
		WRITE_BYTE(Value * 2);
		RETURN_META(MRES_SUPERCEDE);
	}

	RETURN_META(MRES_IGNORED);
}

void OnMessageEnd(void)
{
	MessageHooked[MESSAGE_HEALTH] = false;
	RETURN_META(MRES_IGNORED);
}
didnt checked this code, but must work.
ofc you must hook those forwards with g_pengfuncsTable;

Last edited by Beqa Gurgenidze; 08-25-2017 at 01:56.
Beqa Gurgenidze 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 01:09.


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