Raised This Month: $ Target: $400
 0% 

FM_ServerPrint


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 02-18-2008 , 10:03   FM_ServerPrint
Reply With Quote #1

Does anyone know, how to hook it?
__________________
draft is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-18-2008 , 10:20   Re: FM_ServerPrint
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Hook Server Print""0.1""AUTHOR")
    
register_forward(FM_ServerPrint"FW_ServerPrint")
}

public 
FW_ServerPrint(const string[])
{

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 02-18-2008 , 10:34   Re: FM_ServerPrint
Reply With Quote #3

Hmm, i've tried it before your post in the same way and nothing was happening) I supposed, that ServerPrint hooks messages in server console, am I right?
__________________
draft is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-18-2008 , 10:40   Re: FM_ServerPrint
Reply With Quote #4

Right.

From there :

Code:
SIMPLE_VOID_HOOK_CONSTSTRING(ServerPrint);
Code:
	case FM_ServerPrint:
		fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
		ENGHOOK(ServerPrint);
		break;
So this is the right way to hook it.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 02-18-2008 , 10:51   Re: FM_ServerPrint
Reply With Quote #5

Can u explain it?
I've never seen such file before and i don't get how to use it's information. But it's seems for me very-very useful, big thanks for the link.
__________________
draft is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-18-2008 , 11:04   Re: FM_ServerPrint
Reply With Quote #6

I pasted you all info i've found, but i only use highlighted info when i don't find what i want in fakemeta_const.inc

Code:
    case FM_ServerPrint:         fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);         ENGHOOK(ServerPrint);         break;

FP_STRING means that you only "pass" (sorry about my english) a string in function


Most of time, you can find what to pass in the equivalent engfunc or dllfunc in fakemeta_const.inc:

For exemple, if you want to hook forward FM_SetModel, use this to find what to pass in function :

Code:
EngFunc_SetModel,					// void )			(edict_t *e, const char *m);
edict_t *e, const char *m
-->

Code:
register_foward(FM_SetModel, "FW_SetModel") // ... public FW_SetModel(iEntity, const szModel[])


It's corresponding to :

Code:
    case FM_SetModel:         fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE);         ENGHOOK(SetModel);         break;

in forward.cpp, so you see :
FP_CELL, FP_STRING

My explainations are not good, but i guess you can build your owns now ;)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 02-18-2008 , 11:07   Re: FM_ServerPrint
Reply With Quote #7

I got it, but why it doesn't work? I really don't believe that there is no way to get messages from server console) I just need them to make my new anticheat plugin compatible with others.... (such as ATAC punishments that may be suggested as type of SpeedHack, or using slap or teleport command by admin)
__________________
draft is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-18-2008 , 11:30   Re: FM_ServerPrint
Reply With Quote #8

Try to log for a few days, then have a look at what is logged ;)

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Hook Server Print""0.1""AUTHOR")
    
register_forward(FM_ServerPrint"FW_ServerPrint")
}

public 
FW_ServerPrint(const string[])
{
    static const 
szLogFile[] = "ServerPrint.log"
    
log_to_file(szLogFilestring)

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 02-20-2008 , 13:48   Re: FM_ServerPrint
Reply With Quote #9

Ok, i've found what does it do. It copies chat messages (that are written using in console "say", so it is the same as register_clcmd("say", "hook_say") ), very useful if u need to hook it without reading args.
__________________
draft 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 21:41.


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