#ifdef CLIENT_DLL #include header #endif -omega Blackened Interactive http://www.nofadz.com/blackened IRC: irc.gamesnet.net channel: #blackened-interactive Assistant Coder, Underhive (http://www.underhive.com)
----- Original Message ----- From: "Varlock" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, December 22, 2001 1:25 AM Subject: Re: [hlcoders] Server/Client CVAR Problems > Unfortunately, I can't use gEngfuncs in shotgun.cpp or crossbow.cpp > because it isn't defined. If I try to include the correct header (hud.h or > cl_dll.h), then I get a whole bunch of errors. Any ideas on how I would be > able to use gEngfuncs here? > > - Varlock > > ----- Original Message ----- > From: "Reedbeta" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, December 21, 2001 8:40 PM > Subject: Re: [hlcoders] Server/Client CVAR Problems > > > > 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 > > > > _______________________________________________ > 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