This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[Question] What about HUD messages/channels ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DanRaZor
Senior Member
Join Date: Apr 2004
Location: Paris ( France )
Old 03-19-2007 , 07:24   [Question] What about HUD messages/channels ?
Reply With Quote #1

All is in title ...

I tried doing some sort of connect/disconnect player plugin ( Welcome Message )
but i didn't see how i can put a message on HUD ... i only manage to send a chat message from server ...

Is there an equivalent function for HUD message in SourceMod ?

I know source don't display message in HUD channels like HL but i just wanna use some equal function ...

Also, i didn't understand the function ... StartMessage ... EndMessage.

Is it something like the old WRITE_MSG under HL ???
__________________
My name is Dan, just Dan ...
DanRaZor is offline
Send a message via MSN to DanRaZor
jopmako
Senior Member
Join Date: Jul 2006
Location: QQ:331537639
Old 03-19-2007 , 10:34   Re: [Question] What about HUD messages/channels ?
Reply With Quote #2

try this one.
Code:
// "HudMsg" message
stock SendMsg_HudMsg(client, channel, 
                    Float:x, Float:y, 
                    aRclr, aGclr, aBclr, aTclr, 
                    bRclr, bGclr, bBclr, bTclr, 
                    effect, 
                    Float:fadein, Float:fadeout, 
                    Float:holdtime, Float:fxtime, 
                    const String:szMsg[])
{
  new Handle:hBf;
  if (!client)
     hBf = StartMessageAll("HudMsg");
  else hBf = StartMessageOne("HudMsg", client);
  if (hBf != INVALID_HANDLE)
  {
     BfWriteByte(hBf, channel); //channel
     BfWriteFloat(hBf, x); // x ( -1 = center )
     BfWriteFloat(hBf, y); // y ( -1 = center )
     // second color
     BfWriteByte(hBf, aRclr); //r1
     BfWriteByte(hBf, aGclr); //g1
     BfWriteByte(hBf, aBclr); //b1
     BfWriteByte(hBf, aTclr); //a1 // transparent?
     // init color
     BfWriteByte(hBf, bRclr); //r2
     BfWriteByte(hBf, bGclr); //g2
     BfWriteByte(hBf, bBclr); //b2
     BfWriteByte(hBf, bTclr); //a2
     BfWriteByte(hBf, effect); //effect (0 is fade in/fade out; 1 is flickery credits; 2 is write out)
     BfWriteFloat(hBf, fadein); //fadeinTime (message fade in time - per character in effect 2)
     BfWriteFloat(hBf, fadeout); //fadeoutTime
     BfWriteFloat(hBf, holdtime); //holdtime
     BfWriteFloat(hBf, fxtime); //fxtime (effect type(2) used)
     BfWriteString(hBf, szMsg); //Message
     EndMessage();
  }
}

if you using for CSS note this:
Code:
L. DukeNov 16 2006, 07:48 PM
HudMsg allows text to be printed anywhere on the screen with a specified color. This needs to be added to the fonts section of ClientScheme.res:
 
CenterPrintText
{
   "1"
   {
      "name" "Trebuchet MS"
      "tall" "14"
      "weight" "600"
      "range" "0x0000 0x007F" // Basic Latin
      "antialias" "1"
      "additive" "1"
   }
}
 
This is missing in CSS and DODS. I'm not sure about the MP SDK. 
__________________
QQ31537639

Last edited by jopmako; 03-19-2007 at 10:37.
jopmako is offline
Send a message via MSN to jopmako
BAILOPAN
Join Date: Jan 2004
Old 03-19-2007 , 12:31   Re: [Question] What about HUD messages/channels ?
Reply With Quote #3

jopmako is correct. There are HUD messages and StartMessage/EndMessage is the equivalent.

However, Valve refuses to allow hud messages to work. They took a crucial font definition out of a client file. Unless players add the definition back in, the messages will not display.
__________________
egg
BAILOPAN is offline
DanRaZor
Senior Member
Join Date: Apr 2004
Location: Paris ( France )
Old 03-19-2007 , 12:49   Re: [Question] What about HUD messages/channels ?
Reply With Quote #4

Wow, great ^^, but i would like to have a simple access to an HUD message like the old amx_showhudmessage ...

I used StartMessage/EndMessage and it sends me an error ...

I will retry it and paste the error here.

Thanks.
__________________
My name is Dan, just Dan ...
DanRaZor is offline
Send a message via MSN to DanRaZor
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 03-19-2007 , 13:16   Re: [Question] What about HUD messages/channels ?
Reply With Quote #5

he only option since Valve removed the font definition is for center say text, so you'll probably want to use that to test.

The message to start would be "TextMsg", then write byte 4, write your message as string, end message.

EDIT: You could also do "HintText"

Eventually, these will probably be added as functions in SourceMod.

Last edited by L. Duke; 03-19-2007 at 13:19.
L. Duke is offline
DanRaZor
Senior Member
Join Date: Apr 2004
Location: Paris ( France )
Old 03-19-2007 , 13:51   Re: [Question] What about HUD messages/channels ?
Reply With Quote #6

Here is the code :

Code:
	...
	decl String:message[256]	
	Format(message, 256, "Connection * %s *", name);
	StartMessageAll(message);
	EndMessage();
	...
And the error i get ... from a bot entering the server ( Counter Strike Source ) ... ( See below attached file )

I need to put something between StartMessageAll(message); and EndMessage(); ^^

I totally misunderstood the StartMessageAll ...

I have to write the all message ... but i've never done that ...

I"ll try the code from jopmako ... and test the HudMsg under Source ...

Thanks.
Attached Thumbnails
Click image for larger version

Name:	Error.jpg
Views:	845
Size:	13.0 KB
ID:	14784  
__________________
My name is Dan, just Dan ...
DanRaZor is offline
Send a message via MSN to DanRaZor
BAILOPAN
Join Date: Jan 2004
Old 03-19-2007 , 14:41   Re: [Question] What about HUD messages/channels ?
Reply With Quote #7

We're not going to do a "simple function" for HudMessages until Valve supports them, unfortunately, since they don't work unless every client modifies a specific file.

I don't know how familiar you are with AMX Mod X, but please read jopmako's example again. That's not how you do messages at all. A message is started with a "message name" or "index," which is specific to the game mod. You stuff data in the message via the BfWrite* functions.

Because of a bug in the Source engine, using an invalid message name or index will crash Source, so you have to be careful.
__________________
egg
BAILOPAN is offline
SamuraiBarbi
Senior Member
Join Date: Aug 2006
Location: United States
Old 09-08-2007 , 09:52   Re: [Question] What about HUD messages/channels ?
Reply With Quote #8

That's just HUD messages right? That means we can do HUD Hints with Sourcemod right? You know, in Counterstrike Source a HUD Hint is that little dark box that appears toward the bottom middle of your screen if you look at a team mate or an enemy saying something like 'You've spotted an enemy' or 'You've spotted a team mate'. How do we create a HUD Hint in Sourcemod?
SamuraiBarbi is offline
Send a message via AIM to SamuraiBarbi Send a message via MSN to SamuraiBarbi Send a message via Yahoo to SamuraiBarbi
Shaman
Senior Member
Join Date: Dec 2006
Location: Istanbul, Turkey
Old 09-08-2007 , 12:02   Re: [Question] What about HUD messages/channels ?
Reply With Quote #9

Can't we make a 'ClientScheme.res' with 'CenterPrintText' code and add it to the downloads table?
__________________
Shaman is offline
Send a message via ICQ to Shaman Send a message via AIM to Shaman Send a message via MSN to Shaman Send a message via Yahoo to Shaman
dalto
Veteran Member
Join Date: Jul 2007
Old 09-08-2007 , 12:11   Re: [Question] What about HUD messages/channels ?
Reply With Quote #10

Quote:
Originally Posted by SamuraiBarbi View Post
That's just HUD messages right? That means we can do HUD Hints with Sourcemod right? You know, in Counterstrike Source a HUD Hint is that little dark box that appears toward the bottom middle of your screen if you look at a team mate or an enemy saying something like 'You've spotted an enemy' or 'You've spotted a team mate'. How do we create a HUD Hint in Sourcemod?
Yes, you can use hud hints. There is a native called PrintHintText to help with this.
dalto is offline
Reply



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 14:42.


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