Raised This Month: $ Target: $400
 0% 

Center White Hud Text


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 05-13-2005 , 10:25   Center White Hud Text
Reply With Quote #1

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)
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
Rex Mundi
Junior Member
Join Date: Dec 2004
Old 05-13-2005 , 16:06  
Reply With Quote #2

it's 5 for CS:S and 4 for HL2M (and I presume other mods)


Code:
				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
Rex Mundi is offline
Mattie
Veteran Member
Join Date: Jan 2005
Old 05-13-2005 , 18:19  
Reply With Quote #3

Quote:
Originally Posted by Rex Mundi
it's 5 for CS:S and 4 for HL2M (and I presume other mods)


Code:
				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
Mattie is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 05-13-2005 , 19:17  
Reply With Quote #4

Quote:
Originally Posted by Mattie
Quote:
Originally Posted by Rex Mundi
it's 5 for CS:S and 4 for HL2M (and I presume other mods)


Code:
				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...
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 06-07-2005 , 17:21  
Reply With Quote #5

How would you apply color to a simple SayText?

Edit: I thought this is how it works, but maybe not.

Code:
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);
}
__________________
sslice is offline
Mattie
Veteran Member
Join Date: Jan 2005
Old 06-07-2005 , 18:36  
Reply With Quote #6

Quote:
Originally Posted by sslice
How would you apply color to a simple SayText?

Edit: I thought this is how it works, but maybe not.

Code:
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.
Mattie is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 06-15-2005 , 18:26  
Reply With Quote #7

are you able to display custom center text? or only predefined messages?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Mattie
Veteran Member
Join Date: Jan 2005
Old 06-15-2005 , 18:29  
Reply With Quote #8

Quote:
Originally Posted by Geesu
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
Mattie is offline
Fix
Member
Join Date: Jun 2005
Old 06-26-2005 , 05:45  
Reply With Quote #9

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:

Code:
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!
Fix is offline
Send a message via ICQ to Fix Send a message via MSN to Fix
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 06-27-2005 , 09:37  
Reply With Quote #10

I think you can access maxplayers by a global that Alfred added, look at serverplugin_empty.
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
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 10:27.


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