View Full Version : Center White Hud Text
BeetleFart
05-13-2005, 10:25
How can I get the center white hud text to show with custom messages..
ive tried usermessagebegin with
3 HudText
4 SayText
5 TextMsg
6 HudMsg
8 GameTitle
14 CloseCaption
21 HintText
and
26 GameMessage
all to no avail...
(and the menu like panels in bottom middle that says you have the bomb etc)
Rex Mundi
05-13-2005, 16:06
it's 5 for CS:S and 4 for HL2:DM (and I presume other mods)
Q_snprintf( msg, sizeof(msg), "%s \n", engine->Cmd_Args() );
mrf.AddAllPlayers( g_YourPlugin.myNumPlayers );
pWrite = engine->UserMessageBegin(&mrf,5); // 4 for HL2
pWrite->WriteByte( 4 ); // Centered TextMsg
pWrite->WriteString(msg); // Message
engine->MessageEnd();
As far as I know the panelled messages are called with an Index and you cannot send custom content to them
hope this helps
it's 5 for CS:S and 4 for HL2:DM (and I presume other mods)
Q_snprintf( msg, sizeof(msg), "%s \n", engine->Cmd_Args() );
mrf.AddAllPlayers( g_YourPlugin.myNumPlayers );
pWrite = engine->UserMessageBegin(&mrf,5); // 4 for HL2
pWrite->WriteByte( 4 ); // Centered TextMsg
pWrite->WriteString(msg); // Message
engine->MessageEnd();
As far as I know the panelled messages are called with an Index and you cannot send custom content to them
hope this helps
I'm at work right now, but I believe there's a #define in the shared_defs.h in the SDK that I use (HUDCENTERTEXT?) instead of "4" for the first byte of the message. (Just in case Valve changes it.)
-Mattie
BeetleFart
05-13-2005, 19:17
it's 5 for CS:S and 4 for HL2:DM (and I presume other mods)
Q_snprintf( msg, sizeof(msg), "%s \n", engine->Cmd_Args() );
mrf.AddAllPlayers( g_YourPlugin.myNumPlayers );
pWrite = engine->UserMessageBegin(&mrf,5); // 4 for HL2
pWrite->WriteByte( 4 ); // Centered TextMsg
pWrite->WriteString(msg); // Message
engine->MessageEnd();
As far as I know the panelled messages are called with an Index and you cannot send custom content to them
hope this helps
I'm at work right now, but I believe there's a #define in the shared_defs.h in the SDK that I use (HUDCENTERTEXT?) instead of "4" for the first byte of the message. (Just in case Valve changes it.)
-Mattie
thanks Mattie!!!!!
Ive tried...but wasnt sending the pWrite->WriteByte( 4 ); // Centered
and was getting no where...
How would you apply color to a simple SayText?
Edit: I thought this is how it works, but maybe not.
void SayText(const char *szMsg, int pIndex, int colorindex)
{
char *message;
message = (char*) malloc(strlen(szMsg)+4);
sprintf(message, "%s \n", szMsg);
bf_write *msg;
MRecipientFilter mrf;
mrf.AddRecipient(pIndex);
msg = engine->UserMessageBegin((IRecipientFilter *)&mrf, 4);
msg->WriteByte(colorindex);
msg->WriteString(message);
msg->WriteByte(true);
engine->MessageEnd();
free(message);
}
How would you apply color to a simple SayText?
Edit: I thought this is how it works, but maybe not.
void SayText(const char *szMsg, int pIndex, int colorindex)
{
char *message;
message = (char*) malloc(strlen(szMsg)+4);
sprintf(message, "%s \n", szMsg);
bf_write *msg;
MRecipientFilter mrf;
mrf.AddRecipient(pIndex);
msg = engine->UserMessageBegin((IRecipientFilter *)&mrf, 4);
msg->WriteByte(colorindex);
msg->WriteString(message);
msg->WriteByte(true);
engine->MessageEnd();
free(message);
}
You might want a different thread for this, since this one is primarily about center text (rather than colored text).
Edit: Oh, you did. You might want to post your update there.
are you able to display custom center text? or only predefined messages?
are you able to display custom center text? or only predefined messages?
Center white fluffy text can be any message. 'hint box' text (lower center) can only be predefined messages (as far as I've found). I'd be curious if anyone else had any better experience.
-Mattie
for me only mrf.AddAllPlayers( maxplayers ); works!
with mrf.AddAllPlayers( g_EmtpyServerPlugin.myNumPlayers ); comes j:\Source Mod\src\utils\modX\modX.cpp(473): error C2039: ' myNumPlayers ': Is no element of ' CEmptyServerPlugin '
maxplayers is defined here:
void CEmptyServerPlugin::ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
{
maxplayers = clientMax;
}
i think this isnt a good method, but with an other method i dont get it working!
I think you can access maxplayers by a global that Alfred added, look at serverplugin_empty.
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.