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

How to hook a LogEvent?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
souvikdas95
Senior Member
Join Date: Mar 2012
Old 03-08-2014 , 03:12   How to hook a LogEvent?
Reply With Quote #1

Just like in AmxModX we use the function register_logevent to hook certain in-game events like round_Start or round_End .... Is it possible to introduce the same through a module? If so, please give an example

Last edited by souvikdas95; 03-08-2014 at 03:13.
souvikdas95 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-08-2014 , 03:38   Re: How to hook a LogEvent?
Reply With Quote #2

Look at AMXX source code.
__________________
Arkshine is offline
DWIGHTpN
Senior Member
Join Date: Jan 2013
Location: Romania.
Old 03-08-2014 , 13:21   Re: How to hook a LogEvent?
Reply With Quote #3

Round start/end only for counter-strike -> https://forums.alliedmods.net/showpo...3&postcount=22
DWIGHTpN is offline
Beqa Gurgenidze
BANNED
Join Date: Nov 2016
Old 08-06-2017 , 12:39   Re: How to hook a LogEvent?
Reply With Quote #4

This one will be faster i think

Code:
#define ROUND_START 'S'
#define ROUND_END 'E'
Code:
void AlertMessage_Post(ALERT_TYPE atype, const char *szFmt, ...)
{
	if (atype != at_logged)
		RETURN_META(MRES_IGNORED);
	
	static char Message[25];
	static va_list	pArg;
	va_start(pArg, szFmt);
	Message[24] = '\0';
	vsprintf(Message, szFmt, pArg);
	va_end(pArg);
	
	switch (Message[23])
	{
	case ROUND_START:
		break;
	case ROUND_END:
		break;
	}

	RETURN_META(MRES_IGNORED);
}

Last edited by Beqa Gurgenidze; 08-06-2017 at 12:40.
Beqa Gurgenidze is offline
Kaido Ren
Junior Member
Join Date: Jul 2017
Old 08-07-2017 , 03:31   Re: How to hook a LogEvent?
Reply With Quote #5

q_events
Kaido Ren 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 10:05.


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