<soapbox>The string_t type is just a thin char[] wrapper. A real C++ string is std::string and has copyable, constructable operator semantics and reference-counted garbage collection that prevent some of this confusion. Nothing good can come of assignment operators on char[] wrappers, unless it's a global/static on the right-hand side.</soapbox>
... Look at m_szMaterialVarValue for an example of one method to deal with it: Q_strncpy( m_szMaterialVarValue.GetForModify(), temp, MATERIAL_MODIFY_STRING_SIZE ); http://developer.valvesoftware.com/wiki/Networking_Entities could probably use some info on this - feel free to add it. At 2006/04/23 11:29 PM, Benjamin Davison wrote: >-- >[ Picked text/plain from multipart/alternative ] >Thanks everybody, I did not solve the problem because I had other issues to >attend to. > >But what is SendPropString used for if you can't send a string? > >On 4/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> >wrote: >> >> Code snippets like this inevitiably leave out the problem. You probably >> don't have the string stored in a static? If the string is deallocated at >> any time, the server won't send it. Also make sure it's null-terminated. >> >> At 2006/04/22 04:15 PM, Benjamin Davison wrote: >> >-- >> >[ Picked text/plain from multipart/alternative ] >> >Now in theory I know how todo this, because I have done it with vectors >> and >> >booleans but strings are elluding me for some reason :| >> > >> >hl2mp_gamerules.h >> > >> >CNetworkVar( string_t, m_sHudText); >> > >> >hl2mp_gamerules.cpp >> > >> >#ifdef CLIENT_DLL >> >RecvPropString(RECVINFO( m_sHudText )), >> >#else >> >SendPropString(SENDINFO( m_sHudText)), >> >#endif >> > >> >Personally I think the problem is in the send and receive but I have no >> idea >> >what it could be, I use this method with vectors and booleans. >> > >> >entity_foo.cpp >> > >> >pRules->m_sHudText = AStringFoobio; >> > >> >That works because I can see it in the debugger working. >> > >> >But when I come to the client for example >> > >> >hud_foo.cpp >> > >> >And I want to put a string on the screen like so; pString = >> >pRules->m_sHudText; >> > >> >HudText is always ""; >> > >> >This method usually works because I have used other data objects. >> > >> >Any help will be greatly appreciated. >> >-- >> >- Benjamin Davison >> >-- >> > >> >_______________________________________________ >> >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 >> >> > > >-- >- Benjamin Davison >-- > >_______________________________________________ >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

