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

[TF2] Detouring CLog::Print not quite working


Post New Thread Reply   
 
Thread Tools Display Modes
psychonic

BAFFLED
Join Date: May 2008
Old 07-11-2015 , 08:57   Re: [TF2] Detouring CLog::Print not quite working
Reply With Quote #11

Quote:
Originally Posted by pcmaster View Post
I am currently hooking player_connect_client, so is player_connect doing the logging?
Yes, that is correct.
psychonic is offline
pcmaster
AlliedModders Donor
Join Date: Sep 2009
Old 07-13-2015 , 12:55   Re: [TF2] Detouring CLog::Print not quite working
Reply With Quote #12

Seems like even blocking player_connect doesn't prevent gameMe from logging.

Example code:
PHP Code:
public OnPluginStart()
{
    
HookEvent("player_connect"Event_PlayerConnectEventHookMode_Pre);
}


public 
Action:Event_PlayerConnect(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
    new 
String:szOrigSteamID[32], String:szSteamID[32];
    new 
iClient GetEventInt(hEvent"index") + 1;
    
    if(
iClient <= || iClient MaxClients) return Plugin_Continue;
    
    
GetEventString(hEvent"networkid"szOrigSteamIDsizeof(szOrigSteamID));
    
Steam3To2(szOrigSteamIDszSteamIDsizeof(szSteamID));
    
    
LogMessage("Client connected: %s"szSteamID);

    if(
FindStringInArray(g_hStealthSteamIDsszSteamID) == -1) return Plugin_Continue;
    
LogMessage("Stealth client: %s"szSteamID);
    
    return 
Plugin_Stop;

Log messages:
L 07/13/2015 - 18:51:56: [admin_stealth.smx] Client connected: STEAM_0:0xxxxxxx
L 07/13/2015 - 18:51:56: [admin_stealth.smx] Stealth client: STEAM_0:0</span>xxxxxxx

So it's definitely getting called, it just doesn't block gameMe..
__________________
Stopped hosting servers as of November 2018, no longer active around here.
pcmaster is offline
pcmaster
AlliedModders Donor
Join Date: Sep 2009
Old 07-15-2015 , 09:42   Re: [TF2] Detouring CLog::Print not quite working
Reply With Quote #13

Well, I have now got the detour working.. I was simply using the wrong methods lol.
CLog:rint is a member function, but I used static detours. Switched it to member ones and it works..

Code:
L 07/15/2015 - 15:41:08: [LH] CLog::Print called: "AmNot<2><BOT><>" connected, address "none"

L 07/15/2015 - 15:41:08: [LH] CLog::Print called: "<2><BOT><>" entered the game

L 07/15/2015 - 15:41:08: [LH] CLog::Print called: "AmNot<2><BOT><Unassigned>" joined team "Red"

L 07/15/2015 - 15:41:08: [LH] CLog::Print called: "AmNot<2><BOT><Red>" changed role to "scout"
__________________
Stopped hosting servers as of November 2018, no longer active around here.
pcmaster 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:04.


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