Monthly Target: $400 Donations: $298
 74% 

ConsoleHook - A hook for when PrintToConsole is called


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 11-24-2012 , 19:05   ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #1

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
Attached Files
File Type: inc consolehook.inc (1.2 KB, 114 views)
File Type: dll consolehook.ext.dll (78.5 KB, 36 views)
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING

Last edited by minimoney1; 12-15-2012 at 14:57.
minimoney1 is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 11-24-2012 , 19:14   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #2

cool
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Nano2e
SourceMod Donor
Join Date: Apr 2012
Location: Australia
Old 11-25-2012 , 16:43   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #3

this looks like what iv been looking for though ill have too wait for the unix version ><
__________________
Veni Vidi Vici
Nano2e is offline
Mitchell
~lick~
Join Date: Mar 2010
Location: SDKHook_PostThinkPost
Old 11-25-2012 , 19:16   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #4

i'm kinda confused i mean i looks helpful but in what ways will this be used?
__________________
Quote:
Originally Posted by whosurdaddy972 View Post
stfu mitchell
Mitchell is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 11-25-2012 , 19:20   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
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.
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING
minimoney1 is offline
Mitchell
~lick~
Join Date: Mar 2010
Location: SDKHook_PostThinkPost
Old 11-25-2012 , 19:24   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #6

Quote:
Originally Posted by minimoney1 View Post
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.
__________________
Quote:
Originally Posted by whosurdaddy972 View Post
stfu mitchell

Last edited by Mitchell; 11-25-2012 at 19:25.
Mitchell is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 11-25-2012 , 19:33   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #7

Quote:
Originally Posted by Mitchell View Post
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).
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING

Last edited by minimoney1; 11-25-2012 at 19:37.
minimoney1 is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 12-03-2012 , 19:40   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #8

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.
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING

Last edited by minimoney1; 12-04-2012 at 06:04.
minimoney1 is offline
Dr!fter
SourceMod Developer
Join Date: Mar 2007
Old 12-06-2012 , 20:36   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #9

You can do this with dhooks

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.
__________________
Like my work? Donate!

Last edited by Dr!fter; 12-09-2012 at 09:22.
Dr!fter is offline
Nano2e
SourceMod Donor
Join Date: Apr 2012
Location: Australia
Old 12-08-2012 , 20:06   Re: ConsoleHook - A hook for when PrintToConsole is called
Reply With Quote #10

is there a way to do this for tf2?
__________________
Veni Vidi Vici
Nano2e 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 03:16.


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