PDA

View Full Version : [Question] What about HUD messages/channels ?


DanRaZor
03-19-2007, 07:24
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
try this one.

// "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:

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
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
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
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
Here is the 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
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
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
Can't we make a 'ClientScheme.res' with 'CenterPrintText' code and add it to the downloads table?

dalto
09-08-2007, 12:11
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.

SamuraiBarbi
09-08-2007, 12:45
:3 oooo, ok thanks dalto! :)

BAILOPAN
09-08-2007, 12:52
shaman: the file won't overwrite because it already exists

Black Haze
11-17-2010, 22:31
Dawn of the Dead threads:
I've been screwing around with ShowSyncHudText on CSS, and can't get it to work. Is this still the same problem? Maybe someone even knows an other method to get text on screen at specific locations? :3

psychonic
11-17-2010, 23:41
Dawn of the Dead threads:
I've been screwing around with ShowSyncHudText on CSS, and can't get it to work. Is this still the same problem? Maybe someone even knows an other method to get text on screen at specific locations? :3

Not possible in CS:S without manually editing client files.

Black Haze
11-18-2010, 10:09
Not possible in CS:S without manually editing client files.

No other possibilities to get text anywhere on screen, or even multiple overlays or something?

HLstats is really flooding the chat area, and I'd like to see the points in one place. Hinttext isn't really a possibility, since it gets used all day by gungame...

thetwistedpanda
11-18-2010, 11:02
You can always send the information to the client's console and give them periodic messages telling them to check it.