AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [L4D] MessageText UserMessage (https://forums.alliedmods.net/showthread.php?t=102683)

Whosat 09-05-2009 03:52

[L4D] MessageText UserMessage
 
Was finding a way to hook those Game Instructor Hints stuff you see on your screen in L4D when you first look at an ammopile, hold a health pack or having gotten pounced. Like "<Mouse Clicking Icon> Use Pain Pills" at the bottom section of your screen, etc.

Experimented with the usermessages and found MessageText, but it was not I was looking for. But it looked interesting, like an on-screen in-game console thing.

[IMG]http://img406.**************/img406/4577/l4dhospital01apartment0c.th.jpg[/IMG]

Here's the snippet for sending these messages. Every MessageText you send will print a new line at the bottom of that panel, much like a console if you ask me.

PHP Code:

MessageText(clientrgbString:message[]) {
    new 
Handle:TextHandle StartMessageOne("MessageText"client);
    
BfWriteByte(TextHandler);        // R
    
BfWriteByte(TextHandleg);        // G
    
BfWriteByte(TextHandleb);        // B
    
BfWriteString(TextHandlemessage);
    
EndMessage();


Yes, colour can be changed by r/g/b values.

Some stuff you need to know:
31 character message limit
Text size is (very, very) small. (In that screenshot I put a CenterText to have a fontsize comparison - its even smaller!)
Make the panel close by ClientCommand-ing the client to do hide_message_panel
The messagepanel appears behind menus, hinttexts, chattexts. (i.e. its underlapped)

You might need this on whichever client you execute the panel to.
PHP Code:

    ClientCommand(client"bind - hide_message_panel"); 

Because by default hide_message_panel isn't bound on a client, and it seems like when you bind it it only lasts for that server connect. Once you quit the server, the bind gets removed.

The console command I used for that demo:
PHP Code:

public Action:TestText(clientargs) {
    if(
GetCmdArgs() < 1) {
        
ReplyToCommand(client"Usage: TestText <message>");
        return 
Plugin_Handled;
    }
    
    
decl String:arg1[32];
    
GetCmdArg(1arg132);
    
MessageText(client2551010arg1);
    
    return 
Plugin_Handled;


Don't know if it'll be of use to anyone but I'll just put it up here anyway. :)

P.S. anyone knows the usermessage/event that fires when the game instructor hints show? :X

olj 09-05-2009 05:33

Re: [L4D] MessageText UserMessage
 
99999 CARMA TO YOU. And yeah, there are events for some hints. Browse l4d events.

P.S. Didnt exactly get - how should we close this message ? And if we wont close - can user kill this message window somehow? Can we just do
PHP Code:

ClientCommand(client"hide_message_panel"

?

Whosat 09-05-2009 05:35

Re: [L4D] MessageText UserMessage
 
lol.
Hmm there's only game_message that seems likely the one. Can't find the right one :(

olj 09-05-2009 05:41

Re: [L4D] MessageText UserMessage
 
explain_pills, explain_**** etc, maybe this?

Whosat 09-05-2009 05:49

Re: [L4D] MessageText UserMessage
 
Hmm maybe. But speaking of which, does anyone know how to dump the events? Maybe a function like sm_dump_netprops?

CrimsonGT 09-05-2009 06:19

Re: [L4D] MessageText UserMessage
 
If you mean usermessages, you can do "meta game" to get a list. You will have to find them in the SDK or a disassembler to figure out the params though.

AtomicStryker 09-05-2009 08:04

Re: [L4D] MessageText UserMessage
 
Isn't that the Subtitles Box? Have you tried what it does to Subs?

Whosat 09-05-2009 08:12

Re: [L4D] MessageText UserMessage
 
Quote:

Originally Posted by CrimsonGT (Post 923558)
If you mean usermessages, you can do "meta game" to get a list. You will have to find them in the SDK or a disassembler to figure out the params though.

Yeah I've done that. That's how I found MessageText. Figured out the params on my own lol.
SayText, SayText2, KeyHintText aren't the ones :/

Quote:

Originally Posted by AtomicStryker (Post 923618)
Isn't that the Subtitles Box? Have you tried what it does to Subs?

It is? What subtitles? Closed Captions, you mean?
I haven't tried that one :shock:

Thraka 09-16-2009 13:27

Re: [L4D] MessageText UserMessage
 
Sucks the text is so small. On my display, I cannot read center text because it's too small.

AtomicStryker 09-18-2009 16:37

Re: [L4D] MessageText UserMessage
 
Also, i hate to say it, but most L4D players are mindless automatrons. I can swap their teams and hardy ever will someone type "wtf" or even react. (Other than ragequitting)

olj 09-18-2009 20:30

Re: [L4D] MessageText UserMessage
 
Usually it goes like that for me - 1 team of good and above average players VS team of noobs, robots, and some midskilled ones.


All times are GMT -4. The time now is 18:10.

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