This is insane. 90% of the information around about the SDK doesn't work
in
server plugins. Look at this page for a good example:
http://www.valve-erc.com/srcsdk/Code/hud_elements.html
void UserMessageBegin( IRecipientFilter& filter, const char
*messagename )
The page doesn't say it doesn't apply to server plugins, that is even
listed
under the 'server' part.. all well and good then, right?
Well no not really because in the server plugin project it is defined
like
this:
virtual bf_write *UserMessageBegin( IRecipientFilter *filter, int
msg_type )
= 0;
Worse, there is no default filter class for the server project and no
good
way of getting the msg_type!
I could go on and on about this.. The server plugin needs an SDK all its
own..
Last but not least, this doesn't work (I have setup servergll
correctly) -
It crashes telling me I haven't sent a usermessage, like if you JUST call
MessageEnd() without anything else:
edict_t *ed =
engine->PEntityOfEntIndex(g_EmtpyServerPlugin.GetCommandIndex()+1);
char name[128] = ""; int sizereturn = 0;
bool boolrtn = false; int type = -1;
for(int x=2; x<23; x++)
{
boolrtn = servergll->GetUserMessageInfo(x, (char*)&name, 128,
sizereturn);
if(strcmp(name, "HudMsg") == 0)
{
type = x;
break;
}
}
if(type == -1)
return;
char *buf = "Hello World\n";
FilterClass filter;
filter.AddAllPlayers(maxClient);
bf_write *pWrite;
pWrite = engine->UserMessageBegin(&filter, type);
pWrite->WriteByte( 1 & 0xFF );
pWrite->WriteFloat( 10.0 );
pWrite->WriteFloat( 50.0 );
pWrite->WriteByte( 100 );
pWrite->WriteByte( 100 );
pWrite->WriteByte( 0 );
pWrite->WriteByte( 0 );
pWrite->WriteByte( 255 );
pWrite->WriteByte( 255 );
pWrite->WriteByte( 250 );
pWrite->WriteByte( 0 );
pWrite->WriteByte( 0 );
pWrite->WriteFloat( 0.1 );
pWrite->WriteFloat( 0.1 );
pWrite->WriteFloat( 20.0 );
pWrite->WriteFloat( 3.5 );
pWrite->WriteString( "Hello World\n" );
engine->MessageEnd();
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders