Can I bring this topic up again? I
still haven't found a solution. Here's a summary:
I'd like to be able to access server
side CVAR's on the client side. The normal way to access CVAR's on the server
(such as mp_aquashotgun) would be like so
if( CVAR_GET_FLOAT( "mp_aquashotgun" ) != 0
)
{
// fire the damn gun
underwater
}
else
{
// no fire, empty
sound
}
However, SDK2.2 introduced
client side weapons. This means much of the weapon code is reused between the
client and the server so when you make a change to the server, you must also
recompile the client. The CVAR_GET_FLOAT function doesn't work on the client.
More specifically, it freezes the game when called. The sound buffer keeps
looping and the game is frozen. Ctrl+Alt+Del works fine though.
From what I've discovered, there
is a way to access server side CVAR's on the client through the function gEngfuncs.pfnGetCvarFloat. Theoretically, I could
recode the above to be like so:
#ifdef CLIENT_DLL
if( gEngfuncs.pfnGetCvarFloat( "mp_aquashotgun" ) != 0 )
#else
if( CVAR_GET_FLOAT( "mp_aquashotgun" ) != 0 )
#endif
{
// we're good to fire underwater
}
else
{
// mp_aquashotgun says we can't fire
}
Unfortunately, gEngfuncs allows
the CLIENT to access the engine functions. But since the code is reused between
server and client, it is NOT accessible through the weapons files. I've also
tried to include the correct headers to be able to access gEngfuncs, but they
conflict with other server side headers (such as util.h) which are also included
in the file. I've even tried just grabbing the
gEngfuncs structure definition and pasting it into the file with little luck as
well.
Thanks.
- Varlock |
- Re: [hlcoders] Server/Client CVAR Problems *TEXT VERSION* Varlock
- Re: [hlcoders] Server/Client CVAR Problems Reedbeta
- Re: [hlcoders] Server/Client CVAR Problems Nathan Taylor
- RE: [hlcoders] Server/Client CVAR Problems Dynerman David M