AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   ConsoleHook - A hook for when PrintToConsole is called (https://forums.alliedmods.net/showthread.php?t=201659)

minimoney1 11-24-2012 19:05

ConsoleHook - A hook for when PrintToConsole is called
 
2 Attachment(s)
Hello everyone.
Rant:
About 2 months ago, I made a bug (bug #5495) requesting a forward for when PrintToConsole is called, for PrintToConsole does not make a UserMsg; it calls IVEngineServer::ClientPrintf. They (psychonic + dvander) did not like the idea of modifying console messages, so they basically denied it and suggested me to make an extension instead.


So here it is!

Note: I have not compiled for Linux yet as I don't have a Linux machine, but I would love for someone who has a Linux machine to do so.

The include file lets SP developers know how to use it.

Credit goes to Impact123 for compiling this for Linux!
Impact123 has created a build system for this.


Source: https://bitbucket.org/minimoney1/consolehook

Note: The attached Linux binary will not work with Source 2009 games.


DRIFTER HAS BEEN NICE ENOUGH TO PROVIDE US WITH A METHOD THAT USES DHOOKS TO DO THIS. THE ONLY DOWNSIDE IS IT REQUIRES A GAMEDATA THAT MAY HAVE TO BE UPDATED FOR GAME UPDATES. LOOK HERE


DOWNLOAD LINUX

berni 11-24-2012 19:14

Re: ConsoleHook - A hook for when PrintToConsole is called
 
cool :)

Nano2e 11-25-2012 16:43

Re: ConsoleHook - A hook for when PrintToConsole is called
 
this looks like what iv been looking for though ill have too wait for the unix version ><

Mitchell 11-25-2012 19:16

Re: ConsoleHook - A hook for when PrintToConsole is called
 
i'm kinda confused i mean i looks helpful but in what ways will this be used?

minimoney1 11-25-2012 19:20

Re: ConsoleHook - A hook for when PrintToConsole is called
 
Quote:

Originally Posted by Mitchell (Post 1843768)
i'm kinda confused i mean i looks helpful but in what ways will this be used?

Oh I just saw this, but look at your own plugin....
And how useful it is is up to the developers that use it.

Mitchell 11-25-2012 19:24

Re: ConsoleHook - A hook for when PrintToConsole is called
 
Quote:

Originally Posted by minimoney1 (Post 1843773)
Oh I just saw this, but look at your own plugin....
And how useful it is is up to the developers that use it.

so like a developer could change a text that is printed to console?
What im wondering is if this is just used on PrintToConsole, or if you can stop "Player killed Player2." messages in console.

minimoney1 11-25-2012 19:33

Re: ConsoleHook - A hook for when PrintToConsole is called
 
Quote:

Originally Posted by Mitchell (Post 1843775)
so like a developer could change a text that is printed to console?
What im wondering is if this is just used on PrintToConsole, or if you can stop "Player killed Player2." messages in console.

It uses SourceHook to hook IVEngineServer::ClientPrintf, so anything sending a message through that will be hooked, and if it's not hooked, you can simply hook the "TextMsg" usermessage and check if the first byte is HUD_PRINTCONSOLE (which is 2), and you have hooked both of the methods that text could be passed on to a client's console (serverside).

minimoney1 12-03-2012 19:40

Re: ConsoleHook - A hook for when PrintToConsole is called
 
Impact has been nice enough to provide us with a Linux binary that will work on non Source 2009 games (so it will work on CS:S but not TF2), I will upload this binary very soon (possibly tomorrow) and will look into compiling this for Source 2009 games.
Done.

Dr!fter 12-06-2012 20:36

Re: ConsoleHook - A hook for when PrintToConsole is called
 
You can do this with dhooks :3

clientprintf-hook.games.txt


clientprintf-hook.sp


Requires DHooks and latest SM 1.5 snapshot.

Of course the drawback to using DHooks is you need gamedata and code to grab the engine pointer. But felt this would be helpful example. The example only supports csgo and css but only tested on css.

Nano2e 12-08-2012 20:06

Re: ConsoleHook - A hook for when PrintToConsole is called
 
is there a way to do this for tf2?


All times are GMT -4. The time now is 19:00.

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