AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [Question] What about HUD messages/channels ? (https://forums.alliedmods.net/showthread.php?t=52777)

DanRaZor 03-19-2007 07:24

[Question] What about HUD messages/channels ?
 
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 ???

jopmako 03-19-2007 10:34

Re: [Question] What about HUD messages/channels ?
 
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.


BAILOPAN 03-19-2007 12:31

Re: [Question] What about HUD messages/channels ?
 
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.

DanRaZor 03-19-2007 12:49

Re: [Question] What about HUD messages/channels ?
 
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.

L. Duke 03-19-2007 13:16

Re: [Question] What about HUD messages/channels ?
 
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.

DanRaZor 03-19-2007 13:51

Re: [Question] What about HUD messages/channels ?
 
1 Attachment(s)
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.

BAILOPAN 03-19-2007 14:41

Re: [Question] What about HUD messages/channels ?
 
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.

SamuraiBarbi 09-08-2007 09:52

Re: [Question] What about HUD messages/channels ?
 
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?

Shaman 09-08-2007 12:02

Re: [Question] What about HUD messages/channels ?
 
Can't we make a 'ClientScheme.res' with 'CenterPrintText' code and add it to the downloads table?

dalto 09-08-2007 12:11

Re: [Question] What about HUD messages/channels ?
 
Quote:

Originally Posted by SamuraiBarbi (Post 528839)
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.


All times are GMT -4. The time now is 11:14.

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