Simple. On the client, just use gEngfuncs.pfnGetCvarFloat("mp_aquashotgun"). This is, in fact, exactly what the CVAR_GET_FLOAT macro does on the server, so you could do something like this:
#ifdef CLIENT_DLL #define CVAR_GET_FLOAT(s) (gEngfuncs.pfnGetCvarFloat(s)) #endif and then use your existing code. --- Varlock <[EMAIL PROTECTED]> wrote: > I've got a bit of a problem. I'd like to add a new CVAR to Half-Life > called "mp_aquashotgun". If it's 0, you can't fire the shotgun under water > (like normal). If it's anything else (ie. 1), then you CAN shoot the shotgun > underwater. So, I define my CVAR in game.cpp like so: > > cvar_t mp_aquashotgun = { "mp_aquashotgun", "0", FCVAR_SERVER }; > > Then I register it later on in the file: > > CVAR_REGISTER( &mp_aquashotgun ); > > Now I need to actually use it somewhere, so I open up shotgun.cpp and in > the PrimaryAttack function, I add an additional check to the waterlevel > statement: > > if (m_pPlayer->pev->waterlevel == 3 && CVAR_GET_FLOAT( "mp_aquashotgun") == > 0) > > Well, the problem is that the *client* can't access "mp_aquashotgun" so > if I leave this code as it is, the game will freeze as soon as you try to > fire the shotgun under water. I messed around with it for awhile and rewrote > the code to use #ifdef CLIENT_DLL and such, but the best I could do was > actually have it fire under water but none of the effects would play. Of > course... client side weapons. I think that's what's causing the problem. > So the question is, how can I access my CVAR on the client? > > - Varlock > __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders