AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HL1] (Not CS) Rewriting user messages (https://forums.alliedmods.net/showthread.php?t=228788)

HLM 10-27-2013 02:54

[HL1] (Not CS) Rewriting user messages
 
Is this any way possible to rewrite a message a user sends to recolor their name? I understand that colorchat is not possible in HL1, but I would like to recolor the users name to a different teams color.

is there any way of doing this? what would be the best method of trying to get this work? I have seen it done via metamod plugins, but my question is what do they have access to that we cant reach with AMXx?

if it matters, I am trying to do this in HL - TFC

any and all comments appreciated! (Except for 1 word replies! send your pessimistic spam elsewhere)

YamiKaitou 10-27-2013 02:57

Re: [HL1] (Not CS) Rewriting user messages
 
Any specific user messages?

ConnorMcLeod 10-27-2013 04:13

Re: [HL1] (Not CS) Rewriting user messages
 
If you know metamod plugins names, it can help a lot.

HLM 10-27-2013 05:16

Re: [HL1] (Not CS) Rewriting user messages
 
Quote:

Originally Posted by YamiKaitou (Post 2053360)
Any specific user messages?

SayText messages? Just general chat messages.

Quote:

Originally Posted by ConnorMcLeod (Post 2053372)
If you know metamod plugins names, it can help a lot.

AdminOP by Drunken F00l
ExtenTF by Voogru

ConnorMcLeod 10-27-2013 06:23

Re: [HL1] (Not CS) Rewriting user messages
 
The 1st one requires to install a client, can't find the 2nd one, but if it is also needs a client, this is why a simple addon can't do the same.

HLM 10-29-2013 04:39

Re: [HL1] (Not CS) Rewriting user messages
 
Quote:

Originally Posted by ConnorMcLeod (Post 2053406)
The 1st one requires to install a client, can't find the 2nd one, but if it is also needs a client, this is why a simple addon can't do the same.

I am unfamiliar with what you mean by 'install a client'

as for the 2nd one, it was not publicly released and was only mad available to a very small amount of people, if I can find my copy, I will post a link.

I have done research on how messages are sent, I can make my own msgtext and start it with "STX(Team) %NAME%: %s" or "STX%NAME%: %s" and have everything before the semi-colon colored, I havent had any luck if I modify the first in any other way, if I do change the team I am on to team 4 (which is a valid team in TFC), unfortunately if I do this, I will need to delay the text or else it will use the old team color..

here is what I have come up with so far.


PHP Code:

#include <amxmodx>
#include <engine>

#define MAX_CHAT_LEN 128//client.cpp line343

new msgChat

new g_team[33];

public 
plugin_init()
{
    
register_plugin("colorchat test""0.0.1""Master");
    
register_clcmd("say""colourchat")
    
register_clcmd("cc_test""cc_test")
    
msgChat=get_user_msgid("SayText")
}

public 
cc_test(id)
{
    new 
name[33]
    
get_user_name(idname32)
    
//client_print_color2(0, id, "%s ^1Color ^3Color", name)
    
new text[128]
    
format(textcharsmax(text), "%s: This is a test"name);
    new 
team entity_get_int(idEV_INT_team);
    
entity_set_int(idEV_INT_team4);
    
msg_say(idtext);
    
set_task(0.1"reset_team"id+818);
    
g_team[id] = team;
    
format(textcharsmax(text), "(Team) %s: This is a second test."name);
    
msg_say(idtext);
    new 
buf[10] = "Text Line"
    
format(textcharsmax(text), "%s: Text 3"buf);
    
msg_say(idtext);
    
//entity_set_int(id, EV_INT_team, team);
    /* else
    {
        client_print(id, print_chat, "%s: ERROR! team not right, trying again!");
        cc_test(id)
    } */
    //entity_set_int(id, EV_INT_team, team);
    
}

public 
reset_team(id)
{
    
id-=818
    
new team entity_set_int(idEV_INT_teamg_team[id]);
    
client_print(idprint_chat"reset team to %d"team)
}

public 
colourchat(id)
{
    new 
name[33]
    
get_user_name(idname32)
    new 
said[128]
    
read_args(saidcharsmax(said))
    
remove_quotes(said)
    new 
text[300]
    
format(textcharsmax(text), "%s: %s"namesaid);//7
    //colors only working on name part, thats fine.
    // = team color
    //
    //client_print_color(id, DontChange, "^4%s^2%s",name,said)
    //client_print_color(id, DontChange, "%s : %s", name, said)
    
msg_say(idtext);
    return 
PLUGIN_HANDLED
}

msg_say(id,txt[])
{
    
format(txtMAX_CHAT_LEN"%s^n"txt);
    
message_begin(MSG_BROADCAST,msgChat)
    
write_byte(id)
    
write_string(txt)
    
message_end()
    
//client_print(0, print_chat, "id:%d txt:%s", id, txt);


I had plans on using something like this for my global chat system (similar to kost's crossserver-adminchat) I imagine this can be achieved by creating a temporary fakeclient name (%servername%) %clientname% and assigning them to team 4 (green color) so messages would appear as follows:
(My Server) Player: Hello Users!

I am unfortunately really bad at this, is there some way I can easily do this without creating a connect message or a namechange message? if not, I am sure I can block the message from within the plugin itself, but nonetheless I know very little about fake clients. any help?


All times are GMT -4. The time now is 23:21.

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