Re: [hlcoders] Updated Half-Life 1 client cvar query interface
Hi, Can someone give me an example of code for this please? As far as I can understand, I just need to write something like this to make it send a request: (*g_engfuncs.pfnQueryClientCvarValue2)(pEntity, "cl_cmdrate", 1); Then, at the other end, something like this: void CvarValue2(const edict_t *pEdict, int requestID, const char *cvarName, const char *value) { UTIL_LogPrintf("CvarValue: %s: %s (%d)\n", cvarName, value, requestID); RETURN_META(MRES_IGNORED); } This having been setup as follows: NEW_DLL_FUNCTIONS gNewDLLFunctionTable; C_DLLEXPORT int GetNewDLLFunctions( NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion ) { gNewDLLFunctionTable.pfnCvarValue2 = CvarValue2; memcpy( pNewFunctionTable, &gNewDLLFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) ); return(TRUE); } Thanks in advance, Matt. Alfred Reynolds wrote: We have updated the client CVAR query interface in Half-Life 1 with two new functions that will help you better track queries and responses. The enginefuncs_t structure has had this function added to the end: void (*pfnQueryClientCvarValue2)( const edict_t *player, const char *cvarName, int requestID ); It will query a cvar value from a player and return to you the supplied requestID on success (or failure). The response is sent to a pfnCvarValue2 callback in the NEW_DLL_FUNCTIONS structure, its full definition is: typedef struct { // Called right before the object's memory is freed. // Calls its destructor. void(*pfnOnFreeEntPrivateData)(edict_t *pEnt); void(*pfnGameShutdown)(void); int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther ); void(*pfnCvarValue)( const edict_t *pEnt, const char *value ); void(*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value ); } NEW_DLL_FUNCTIONS; When the pfnQueryClientCvarValue2() completes it will call pfnCvarValue2() with the request ID you supplied earlier, the name of the cvar you requested and the value of that cvar. On failure (i.e that user is not connected or the cvar does not exist) the value of the returned cvar will be "Bad CVAR request". If you specify an invalid player edict you will get "Bad Player" as the value response. - Alfred ___ 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
Re: [hlcoders] Updated Half-Life 1 client cvar query interface
Hi, Can someone give me an example of code for this please? As far as I can understand, I just need to write something like this to make it send a request: (*g_engfuncs.pfnQueryClientCvarValue2)(pEntity, "cl_cmdrate", 1); Then, at the other end, something like this: void CvarValue2(const edict_t *pEdict, int requestID, const char *cvarName, const char *value) { UTIL_LogPrintf("CvarValue: %s: %s (%d)\n", cvarName, value, requestID); RETURN_META(MRES_IGNORED); } This having been setup as follows: NEW_DLL_FUNCTIONS gNewDLLFunctionTable; C_DLLEXPORT int GetNewDLLFunctions( NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion ) { gNewDLLFunctionTable.pfnCvarValue2 = CvarValue2; memcpy( pNewFunctionTable, &gNewDLLFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) ); return(TRUE); } Thanks in advance, Matt. Alfred Reynolds wrote: We have updated the client CVAR query interface in Half-Life 1 with two new functions that will help you better track queries and responses. The enginefuncs_t structure has had this function added to the end: void (*pfnQueryClientCvarValue2)( const edict_t *player, const char *cvarName, int requestID ); It will query a cvar value from a player and return to you the supplied requestID on success (or failure). The response is sent to a pfnCvarValue2 callback in the NEW_DLL_FUNCTIONS structure, its full definition is: typedef struct { // Called right before the object's memory is freed. // Calls its destructor. void(*pfnOnFreeEntPrivateData)(edict_t *pEnt); void(*pfnGameShutdown)(void); int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther ); void(*pfnCvarValue)( const edict_t *pEnt, const char *value ); void(*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value ); } NEW_DLL_FUNCTIONS; When the pfnQueryClientCvarValue2() completes it will call pfnCvarValue2() with the request ID you supplied earlier, the name of the cvar you requested and the value of that cvar. On failure (i.e that user is not connected or the cvar does not exist) the value of the returned cvar will be "Bad CVAR request". If you specify an invalid player edict you will get "Bad Player" as the value response. - Alfred ___ 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
RE: [hlcoders] Updated Half-Life 1 client cvar query interface
Then you can't tell the difference. Thing is, that value won't be useful to tweak any cvars :) - Alfred [EMAIL PROTECTED] wrote: > This looks much improved, thanks a lot, Alfred! > > Just one minor question: what happens if a client has a cvar set to > "Bad > CVAR request" :) > > ~dvander > >> We have updated the client CVAR query interface in Half-Life 1 with >> two new functions that will help you better track queries and >> responses. >> >> The enginefuncs_t structure has had this function added to the end: >> void (*pfnQueryClientCvarValue2)( const edict_t *player, const >> char *cvarName, int requestID ); >> >> It will query a cvar value from a player and return to you the >> supplied requestID on success (or failure). >> >> The response is sent to a pfnCvarValue2 callback in the >> NEW_DLL_FUNCTIONS structure, its full definition is: >> typedef struct >> { >> // Called right before the object's memory is freed.// Calls its >> destructor. void (*pfnOnFreeEntPrivateData)(edict_t >> *pEnt); >> void(*pfnGameShutdown)(void); >> int (*pfnShouldCollide)( edict_t >> *pentTouched, edict_t *pentOther ); >> void(*pfnCvarValue)( const edict_t *pEnt, >> const char *value ); >> void(*pfnCvarValue2)( const edict_t *pEnt, >> int requestID, const char *cvarName, const char *value ); } >> NEW_DLL_FUNCTIONS; >> >> When the pfnQueryClientCvarValue2() completes it will call >> pfnCvarValue2() with the request ID you supplied earlier, the name of >> the cvar you requested and the value of that cvar. On failure (i.e >> that user is not connected or the cvar does not exist) the value of >> the returned cvar will be "Bad CVAR request". If you specify an >> invalid player edict you will get "Bad Player" as the value response. >> >> - Alfred >> >> ___ >> 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 ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Updated Half-Life 1 client cvar query interface
This looks much improved, thanks a lot, Alfred! Just one minor question: what happens if a client has a cvar set to "Bad CVAR request" :) ~dvander > We have updated the client CVAR query interface in Half-Life 1 with two > new functions that will help you better track queries and responses. > > The enginefuncs_t structure has had this function added to the end: > void (*pfnQueryClientCvarValue2)( const edict_t *player, const > char *cvarName, int requestID ); > > It will query a cvar value from a player and return to you the supplied > requestID on success (or failure). > > The response is sent to a pfnCvarValue2 callback in the > NEW_DLL_FUNCTIONS structure, its full definition is: > typedef struct > { > // Called right before the object's memory is freed. > // Calls its destructor. > void(*pfnOnFreeEntPrivateData)(edict_t > *pEnt); > void(*pfnGameShutdown)(void); > int (*pfnShouldCollide)( edict_t > *pentTouched, edict_t *pentOther ); > void(*pfnCvarValue)( const edict_t *pEnt, > const char *value ); > void(*pfnCvarValue2)( const edict_t *pEnt, > int requestID, const char *cvarName, const char *value ); > } NEW_DLL_FUNCTIONS; > > When the pfnQueryClientCvarValue2() completes it will call > pfnCvarValue2() with the request ID you supplied earlier, the name of > the cvar you requested and the value of that cvar. On failure (i.e that > user is not connected or the cvar does not exist) the value of the > returned cvar will be "Bad CVAR request". If you specify an invalid > player edict you will get "Bad Player" as the value response. > > - Alfred > > ___ > 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