Raised This Month: $ Target: $400
 0% 

[L4D] MessageText UserMessage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Whosat
Senior Member
Join Date: Nov 2007
Location: Singapore
Old 09-05-2009 , 03:52   [L4D] MessageText UserMessage
Reply With Quote #1

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
__________________

Last edited by Whosat; 09-05-2009 at 03:55.
Whosat is offline
 



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 17:19.


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