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

[INC] Director Hud Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-03-2011 , 16:47   [INC] Director Hud Message
Reply With Quote #1

Director Hud Message
- last updated : 14 feb 2011

Ever wanted to display message like the hints messages in CS or on HLTV?
It should work on all mods. It uses basically the same params as set_hudmessage. (except for channel)
As side-note, the size is bigger than normal hud message and it can't be changed.

[IMG]http://img830.**************/img830/5036/hudt.th.png[/IMG]


│ Credits
MPNumB : original idea.
xPaw : original idea.
Exolent[jNr] : put the code in a .inc.

│ Limitations
Max message length : 128 characters.
You can show only 8 messages at once.

│ Developer Notes
The tip were in hud_spectator.cpp (line 526) in the HLSDK (client).

│ Functions
The following functions mimic the style of set_hudmessage() and show_hudmessage().

Code:
set_dhudmessage( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false )
show_dhudmessage( index, const message[], any:... )
Attached Files
File Type: sma Get Plugin or Get Source (dhud_message_test.sma - 19625 views - 356 Bytes)
File Type: inc dhudmessage.inc (3.4 KB, 36422 views)
__________________

Last edited by Arkshine; 05-01-2013 at 05:37. Reason: Added a word about dhud size.
Arkshine is offline
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 02-03-2011 , 16:52   Re: [STOCK] Director Hud Message
Reply With Quote #2

You'r crazy. Awesome! Always wanted it, but never got as close to succeed as you.
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.
MPNumB is offline
Send a message via Skype™ to MPNumB
JocAnis
Veteran Member
Join Date: Jun 2010
Old 02-03-2011 , 17:31   Re: [STOCK] Director Hud Message
Reply With Quote #3

oh i wanted yesterday to ask how to get 'hudmessage' like on HLTV, and here is the answer. Really nice Arkshine.

1. question:
Are changing color bugged? First was your color '0 ~50 0' and i changed to blue, and now i m trying to change the color to ~orange but its still previously color (blue)...

code:
PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_clcmd"say /test""ClientCommand_Test" );
}

public 
ClientCommand_Testclient )
{
    
sendHudMessage
    

        .
index       client
        .
message     "Welcome to our server,^nWE ARE TESTINGQWEQWRQ",//no matter
        
.red         255,
        .
green       120,
        .
blue        0,
        .
x           0.05,
        .
y           0.2,
        .
effect      2,
        .
fxTime      17.0,
        .
holdTime    15.0,
        .
fadeInTime  0.1,
        .
fadeOutTime 3.0
    
);
}

sendHudMessage( const index, const message[], const red=255, const green=120, const blue=0
        const 
Float:x, const Float:y, const effect, const Float:fxTime
        const 
Float:holdTime, const Float:fadeInTime, const Float:fadeOutTime)//also and here i changed
{
    
#define pack_color(%0,%1,%2) ( %0 + ( %1 << 8 ) + ( %2 << 16 ) )
    #define write_float(%0)      ( write_byte( ( _:%0 & 0xFF ) ),       \
    
write_byte( ( _:%>>  ) & 0xFF ), \
    
write_byte( ( _:%>> 16 ) & 0xFF ), \
    
write_byte( ( _:%>> 24 ) & 0xFF ) )
    
    
message_beginMSG_ONESVC_DIRECTOR, .player index );
    {
        
write_bytestrlenmessage ) + 31 ); // size of write_*
        
write_byteDRC_CMD_MESSAGE );
        
write_byteeffect );
        
write_longpack_colorredgreenblue ) );
        
write_float);
        
write_float);
        
write_floatfadeInTime  );
        
write_floatfadeOutTime  );
        
write_floatholdTime );
        
write_floatfxTime );
        
write_stringmessage );
    }
    
message_end();

2. question:
Is there any way to put client's current name in that message?

Thank you.
JocAnis is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-03-2011 , 17:48   Re: [STOCK] Director Hud Message
Reply With Quote #4

1/ Tell me what you have done exactly, RGB value, I mean. So far I've tested color is fine. 255 120 0 work fine for me.

2/ Format the string before with the name. Don't ask more here, that's not the place.
__________________
Arkshine is offline
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 02-03-2011 , 17:53   Re: [STOCK] Director Hud Message
Reply With Quote #5

This is actually pretty nice, good job.
__________________
"There is no knowledge, that is not power"
fezh is offline
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 02-03-2011 , 17:54   Re: [STOCK] Director Hud Message
Reply With Quote #6

1. Yes, red and blue are switched between. =P
fix for it is to change:
Code:
#define pack_color(%0,%1,%2) ( %0 + ( %1 << 8 ) + ( %2 << 16 ) )
to:
Code:
#define pack_color(%0,%1,%2) ( %2 + ( %1 << 8 ) + ( %0 << 16 ) )
2. Format a message before you call this function.
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.

Last edited by MPNumB; 02-03-2011 at 17:56.
MPNumB is offline
Send a message via Skype™ to MPNumB
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-03-2011 , 17:58   Re: [STOCK] Director Hud Message
Reply With Quote #7

Ok I was pretty sure I was done such typo.

Fixed. ;)

EDIT: Forgot to update the sma too.
__________________

Last edited by Arkshine; 02-03-2011 at 18:15.
Arkshine is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 02-03-2011 , 18:29   Re: [STOCK] Director Hud Message
Reply With Quote #8

Very good work! Always dreamed about it.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-03-2011 , 18:45   Re: [STOCK] Director Hud Message
Reply With Quote #9

Wow. This is so much better than regular HUD messages:
  • doesn't seem to have a limit of 4 channels;
  • bigger;
  • no random disappearing.
Please tell me there's a way to remove an already displayed DHUD (that's how it'll be called from now on) message.

EDIT: Tested in ESF, the messages there are displayed as normal HUD messages but with DHUD features, like more than 4 channels, etc.
__________________

Last edited by hleV; 02-03-2011 at 19:24.
hleV is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-03-2011 , 18:59   Re: [STOCK] Director Hud Message
Reply With Quote #10

Great job.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply


Thread Tools
Display Modes

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


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