Raised This Month: $ Target: $400
 0% 

Server log - connected message rewrite


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
portocala
Member
Join Date: Jun 2010
Old 04-10-2011 , 09:30   Server log - connected message rewrite
Reply With Quote #1

Hello,

How can I rewrite the following message in the server logs ?
Code:
Player<4><STEAM_0:0:12345><>" connected, address "127.0.0.1:27005"
I tried with plugin_log() and FM_AlertMessage, but this kind of message isn't returned.

Thank you!
portocala is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-10-2011 , 10:25   Re: Server log - connected message rewrite
Reply With Quote #2

You can't, you have to remake them.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-10-2011 , 10:28   Re: Server log - connected message rewrite
Reply With Quote #3

You probably can using Orpheu.

But you want to do what exactly ?
__________________

Last edited by Arkshine; 04-10-2011 at 10:49.
Arkshine is offline
portocala
Member
Join Date: Jun 2010
Old 04-10-2011 , 10:47   Re: Server log - connected message rewrite
Reply With Quote #4

I want to change the whole message by blocking the old one and rewrite (with log_message() maybe) a new one.

Ex:
"Playe1r<4><STEAM_0:0:123><>" connected, address "127.0.0.1:27005"
to
Player2<4><STEAM_0:0:456><>" connected, address "127.0.0.1:27005"

The way can be different, I just want to edit that message.

Thank you for replies!
portocala is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-10-2011 , 10:51   Re: Server log - connected message rewrite
Reply With Quote #5

Well you could try to hook SV_ConnectClient(), then hooking Log_Printf(), checking it's your string, sending a new one, and superceding the original call.
__________________
Arkshine is offline
portocala
Member
Join Date: Jun 2010
Old 04-10-2011 , 11:09   Re: Server log - connected message rewrite
Reply With Quote #6

Code:
#include <amxmodx>
#include <orpheu>

public plugin_init()
{
    OrpheuRegisterHook(OrpheuGetFunction("Log_Printf"), "OnLog_Printf");
}

public OrpheuHookReturn:OnSLog_Printf()
{
    new args[192]; read_args(args, 191);
    log_amx("NEW: %s", args);
}
Result: [ORPHEU] Function "Log_Printf" not found
portocala is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-10-2011 , 11:33   Re: Server log - connected message rewrite
Reply With Quote #7

You have created the file Log_Printf, right ? You can't just hook randomly function, you need to provide a file and signature.
__________________
Arkshine is offline
portocala
Member
Join Date: Jun 2010
Old 04-10-2011 , 13:59   Re: Server log - connected message rewrite
Reply With Quote #8

No, I haven't created it.

The function (Log_Print) returns the log message that I need ? In this case, I don't need SV_ConnectClient(), because I can identify the message by contain(string, "connected, address") != -1

I will try to understand from tutorials how to do that file and signature, even it is strange by now. Thank you!
portocala is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-10-2011 , 14:15   Re: Server log - connected message rewrite
Reply With Quote #9

I've said to hook SV_ConnectClient() to filter the messages. Log_Print is used probably often, when in this function there is only 2 Log_Print(), including the wanted string. So you would check 2 strings max, which would be more efficient.
__________________
Arkshine 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 20:10.


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