Two situation can cause that error:
1) Calling MESSAGE_BEGIN while another message is being written.
2) Forgetting to call MESSAGE_END and the end of a message you send.

It appears you are calling callback functions during MESSAGE_BEGIN,
MESSAGE_END, WRITE_BYTE (and many others). If any of these callback
functions call a MESSAGE_BEGIN you will get that error (since you would
be calling MESSAGE_BEGIN a second time before the first message ended).

There is no native queuing  mechanism in the SDK, since this is only an
issue for plugins trying to intercept events. It is pretty easy to write
your own queuing mechanism. You can create an abstract class that can be
a int, float, vector, or string. Then use std::vector to hold the
instances of the abstract class. (If you plan to port to Linux you can
run into library dependency issues using the std library.)

Derek Brooks wrote:
I'm writing a metamod plugin for CS 1.6 using the latest (I think) sdks
for metamod and hl and I keep getting these fatal errors
FATAL ERROR (shutting down): New message started when msg '23' has not
been sent yet
FATAL ERROR (shutting down): New message started when msg '77' has not
been sent yet
FATAL ERROR (shutting down): New message started when msg '86' has not
been sent yet
FATAL ERROR (shutting down): New message started when msg '139' has not
been sent yet
... among others.

My plugin looks for some of these messages but also sends some of these
messages. I'm guessing that
I'm getting these messages because my mod is trying to write messages
while other messages are being
written?  Is there a method for queuing these messages in the sdk?  Its
driving me insane and I can't find
any documentation explaining these errors anywhere on google.

This is an example of how I'm writing messages:
  MESSAGE_BEGIN(MSG_ONE, GET_USER_MSG_ID(PLID,"TextMsg",NULL), NULL,
entity);
      WRITE_BYTE(HUD_PRINTTALK);
      WRITE_STRING(tmp);
  MESSAGE_END();

These are my functions for catching:
void MessageBegin(int msg_dest, int msg_type, const float *pOrigin,
edict_t *ed) {
  mPlayer = ed ? cmn->seekPlayer(ed) : NULL;
    // this is probably a bot
  if( mPlayer == NULL && ed != NULL )    {
      cmn->addPlayer(ed, STRING(ed->v.netname), "1.2.3.4");
      mPlayer = cmn->seekPlayer(ed);
  }

  mState = 0;

//    if( msg_type != 65 && msg_type != 99 )
//        LOG_CONSOLE(PLID, "GOT MSG '%d' %s ", msg_type,
GET_USER_MSG_NAME(PLID, msg_type, NULL) );

  if( msg_type == GET_USER_MSG_ID(PLID, "Damage", NULL) )
      function=Damage;
  else if( msg_type == GET_USER_MSG_ID(PLID, "CurWeapon", NULL) )
      function=CurWeapon;
  else if( msg_type == GET_USER_MSG_ID(PLID, "DeathMsg", NULL) )
      function = DeathMsg;
  else if( msg_type == GET_USER_MSG_ID(PLID, "TeamInfo", NULL) )
      function = TeamInfo;
//    else if( msg_type == GET_USER_MSG_ID(PLID, "TextMsg", NULL) )
//        function = TextMsg;
  else
      function=modMsgs[msg_type].function;

  endfunction=modMsgsEnd[msg_type].function;

  RETURN_META(MRES_IGNORED);
}

void MessageEnd(void) {
  if (endfunction) (*endfunction)(NULL);
  RETURN_META(MRES_IGNORED);
}

void WriteByte(int iValue) {
  if (function)    (*function)((void *)&iValue);
  RETURN_META(MRES_IGNORED);
}

void WriteChar(int iValue) {
  if (function)    (*function)((void *)&iValue);
  RETURN_META(MRES_IGNORED);
}

void WriteShort(int iValue) {
  if (function)    (*function)((void *)&iValue);
  RETURN_META(MRES_IGNORED);
}

void WriteLong(int iValue) {
  if (function)    (*function)((void *)&iValue);
  RETURN_META(MRES_IGNORED);
}

void WriteAngle(float flValue) {
  if (function) (*function)((void *)&flValue);
  RETURN_META(MRES_IGNORED);
}

void WriteCoord(float flValue) {
  if (function)    (*function)((void *)&flValue);
  RETURN_META(MRES_IGNORED);
}

void WriteString(const char *sz) {
  if (function)    (*function)((void *)sz);
  RETURN_META(MRES_IGNORED);
}

void WriteEntity(int iValue) {
  if (function)    (*function)((void *)&iValue);
  RETURN_META(MRES_IGNORED);
}

Any help is greatly appreciated
thank you for reading this,
Derek Brooks



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to