Raised This Month: $7 Target: $400
 1% 

More Flexible HUD Msg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-31-2008 , 14:09   More Flexible HUD Msg
Reply With Quote #1

Code:
/* * id * Player to send the message to. *   0 = everyone * * text[] *   Text to send. * * Float:X *   X position on screen. * * Float:Y *   Y position on screen. * * R *   Red color. * * G *   Green color. * * B *   Blue color. * * A *   Alpha. *   Default value: 255 * * Float:holdtime *   Float:fadeintime *   Time to fade in message *   Default value: 0.1 * * Float:fadeouttime *   Time to fade out message *   Default value: 0.1 * * channel *   Textchannel *   -1 = auto choose. *   Default value: -1 * * effect *   Effect of message. *   1 = Flicker with 2nd color. *   2 = Print out as 2nd color, fade into 1st color. *     effecttime decides fade time between colors. *     fadeintime decides how fast the letters should be printed out. *   Default value: 0 * * effect_R *   Red color of effect. *   Default value: 0 * * effect_G *   Green color of effect. *   Default value: 0 * * effect_B *   Blue color of effect. *   Default value: 0 * * effect_A *   Alpha of effect. *   Default value: 255 * * Float:effecttime *   Only for effect 2. *   Default value: 0.0 */ stock send_hudmessage(id,text[],Float:X,Float:Y,R,G,B,A=255,Float:holdtime=5.0,Float:fadeintime=0.1,Float:fadeouttime=0.1,channel=-1,effect=0,effect_R=0,effect_G=0,effect_B=0,effect_A=255,Float:effecttime=0.0) {         if ( id )         message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0,0,0}, id);     else         message_begin(MSG_BROADCAST, SVC_TEMPENTITY);     write_byte(TE_TEXTMESSAGE)     write_byte(channel)     write_short(coord_to_hudmsgshort(X))     write_short(coord_to_hudmsgshort(Y))     write_byte(effect)     write_byte(R)        write_byte(G)     write_byte(B)     write_byte(A)     write_byte(effect_R)     write_byte(effect_G)     write_byte(effect_B)     write_byte(effect_A)     write_short(seconds_to_hudmsgshort(fadeintime))     write_short(seconds_to_hudmsgshort(fadeouttime))     write_short(seconds_to_hudmsgshort(holdtime))     if ( effect == 2 )         write_short(seconds_to_hudmsgshort(effecttime));     write_string(text)     message_end() } /* 0.0 - 255.99609375 seconds */ stock seconds_to_hudmsgshort(Float:sec) {     new output = floatround(sec * 256);     return output < 0 ? 0 : output > 65535 ? 65535 : output; } stock coord_to_hudmsgshort(Float:coord) {     new output = floatround(coord * 8192);     return output < -32768 ? -32768 : output > 32767 ? 32767 : output; }

Last edited by [ --<-@ ] Black Rose; 05-24-2008 at 17:39.
[ --<-@ ] Black Rose is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-31-2008 , 14:13   Re: More Flexible HUD Msg
Reply With Quote #2

Nice, i was planing to test something like that one of those day.
Good job
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 03-31-2008 , 15:11   Re: More Flexible HUD Msg
Reply With Quote #3

Woot thing! Good job
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
DaKo
Junior Member
Join Date: May 2008
Location: Romania, Hunedoara
Old 07-20-2008 , 14:47   Re: More Flexible HUD Msg
Reply With Quote #4

Very nice! Good Job.

Last edited by DaKo; 07-05-2009 at 21:07.
DaKo is offline
Send a message via MSN to DaKo Send a message via Yahoo to DaKo
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 10-06-2010 , 16:18   Re: More Flexible HUD Msg
Reply With Quote #5

Any chance this could support multilanguage ?
__________________
Voi is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-06-2010 , 16:23   Re: More Flexible HUD Msg
Reply With Quote #6

Quote:
Originally Posted by Voi View Post
Any chance this could support multilanguage ?
Loop through players and format the message by ML, then pass the message to the function.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 10-13-2010 , 14:26   Re: More Flexible HUD Msg
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
Loop through players and format the message by ML, then pass the message to the function.
I'm not sure how to do what you say. Could you provide an explanation or example ? Obviously I want each message sent to one player only.
__________________
Voi is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-14-2010 , 03:24   Re: More Flexible HUD Msg
Reply With Quote #8

Code:
new szMessage[ 192 ]; formatex( szMessage, charsmax( szMessage ), "%L", LANG_PLAYER, "LANG_KEY_HERE" ); send_hudmessage( 0, szMessage, /* other arguments here */ ); // -> new szMessage[ 192 ]; new iPlayers[ 32 ], iNum; get_players( iPlayers, iNum ); new iPlayer; for( new i = 0; i < iNum; i++ ) {     iPlayer = iPlayers[ i ];         formatex( szMessage, charsmax( szMessage ), "%L", iPlayer, "LANG_KEY_HERE" );         send_hudmessage( iPlayer, szMessage, /* other arguments here */ ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
albert123
Veteran Member
Join Date: Mar 2009
Location: VietNam, Hai Phong
Old 10-22-2010 , 02:49   Re: More Flexible HUD Msg
Reply With Quote #9

Oh,really useful.
__________________
albert123 is offline
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 11-25-2010 , 03:12   Re: More Flexible HUD Msg
Reply With Quote #10

In this way, can i put as much as you want hud messages on the screen of the user?
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
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 23:57.


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