Sign in to follow this  

Can you see whats wrong?

This topic is 4834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I dont know why it doesnt work. It should take m_chat_key and add it to m_chat_msg. And create a long string which is then sent to the server. But for some reason m_chat_msg is only coming out as what ever key I pressed last. Anyone see whats wrong?
  if(m_Chat == TRUE){
	  if(m_Keyboard.GetKeyState(KEY_A) == TRUE){
			strcpy (m_Chat_Key,"A");
	  }
	  if(m_Keyboard.GetKeyState(KEY_B) == TRUE){
			strcpy (m_Chat_Key,"B");
	  }
	  if(m_Keyboard.GetKeyState(KEY_C) == TRUE){
			strcpy (m_Chat_Key,"C");
	  }
	  if(m_Keyboard.GetKeyState(KEY_D) == TRUE){
			strcpy (m_Chat_Key,"D");
	  }
	  if(m_Keyboard.GetKeyState(KEY_E) == TRUE){
			strcpy (m_Chat_Key,"E");
	  }
	  if(m_Keyboard.GetKeyState(KEY_F) == TRUE){
			strcpy (m_Chat_Key,"F");
	  }
	  if(m_Keyboard.GetKeyState(KEY_G) == TRUE){
			strcpy (m_Chat_Key,"G");
	  }
	  if(m_Keyboard.GetKeyState(KEY_H) == TRUE){
			strcpy (m_Chat_Key,"H");
	  }
	  if(m_Keyboard.GetKeyState(KEY_I) == TRUE){
			strcpy (m_Chat_Key,"I");
	  }
	  if(m_Keyboard.GetKeyState(KEY_J) == TRUE){
			strcpy (m_Chat_Key,"J");
	  }
	  if(m_Keyboard.GetKeyState(KEY_K) == TRUE){
			strcpy (m_Chat_Key,"K");
	  }
	  if(m_Keyboard.GetKeyState(KEY_L) == TRUE){
			strcpy (m_Chat_Key,"L");
	  }
	  if(m_Keyboard.GetKeyState(KEY_M) == TRUE){
			strcpy (m_Chat_Key,"M");
	  }
	  if(m_Keyboard.GetKeyState(KEY_N) == TRUE){
			strcpy (m_Chat_Key,"N");
	  }
	  if(m_Keyboard.GetKeyState(KEY_O) == TRUE){
			strcpy (m_Chat_Key,"O");
	  }
	  if(m_Keyboard.GetKeyState(KEY_P) == TRUE){
			strcpy (m_Chat_Key,"P");
	  }
	  if(m_Keyboard.GetKeyState(KEY_Q) == TRUE){
			strcpy (m_Chat_Key,"Q");
	  }
	  if(m_Keyboard.GetKeyState(KEY_R) == TRUE){
			strcpy (m_Chat_Key,"R");
	  }
	  if(m_Keyboard.GetKeyState(KEY_S) == TRUE){
			strcpy (m_Chat_Key,"S");
	  }
	  if(m_Keyboard.GetKeyState(KEY_T) == TRUE){
			strcpy (m_Chat_Key,"T");
	  }
	  if(m_Keyboard.GetKeyState(KEY_U) == TRUE){
			strcpy (m_Chat_Key,"U");
	  }
	  if(m_Keyboard.GetKeyState(KEY_V) == TRUE){
			strcpy (m_Chat_Key,"V");
	  }
	  if(m_Keyboard.GetKeyState(KEY_W) == TRUE){
			strcpy (m_Chat_Key,"W");
	  }
 	  if(m_Keyboard.GetKeyState(KEY_X) == TRUE){
			strcpy (m_Chat_Key,"X");
	  }
	  if(m_Keyboard.GetKeyState(KEY_Y) == TRUE){
			strcpy (m_Chat_Key,"Y");
	  }
	  if(m_Keyboard.GetKeyState(KEY_Z) == TRUE){
			strcpy (m_Chat_Key,"Z");
	  }
	  
	  strcat (m_Chat_Msg, m_Chat_Key);
	  strcpy (m_Chat_Key, "");

	  if(m_Keyboard.GetKeyState(KEY_ENTER) == TRUE){
			m_Chat = FALSE;
	  sChatMessage Msg;
      Msg.Header.Type     = MSG_CHAT;
      Msg.Header.Size     = sizeof(sChatMessage);
      Msg.Header.PlayerID = m_Players[0].dpnidPlayer;
      Msg.ChatMsg[128]         = m_Chat_Msg[128];
      
      // Send message to server
      SendNetworkMessage(&Msg, DPNSEND_NOLOOPBACK);
	  strcpy (m_Chat_Msg, "");
	  }
	
  }else{

	  if(m_Keyboard.GetKeyState(KEY_Y) == TRUE){
	  m_Chat = TRUE;
	  strcpy (m_Chat_Msg, "");
	  Count = 0;


Share this post


Link to post
Share on other sites

This topic is 4834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this