Hello,

I tried setting the flag before my original email. You are probably
referring to FCVAR_REPLICATED. Did not work though. Try declaring the
same cvar on client and server, and see what happens. The console
prints something similiar to "sv_foo not allowed in server.dll". All
the cvar flags are quite nicely documented in the SDK docs on VERC.

However, I did figure out a solution. What I was trying to do was
declare a pointer to particular cvars using the cvar interface's
FindCvar function: cvar->FindCvar( "sv_foo" );

The trouble was that I was declaring my pointers globally where the
cvars normal declaration goes. So, I simply moved these variables into
the class declaration where I intended to use them. Works just fine.

I am a little worried about what might happen if for some reason the
cvar were not to be found. My pointer might get a null value and you
should know where that might lead.. So I may make a little wrapper
class to search for the cvar I want, but make certain I am getting a
safe value back in case something goes wrong.

Hope that helps someone who might be doing something similiar!

Greetings,
-Markus


On Tue, 25 Jan 2005 11:28:49 +1000, Luke Graham <[EMAIL PROTECTED]> wrote:
> I dont understand the last 3/4's of your post but theres a flag you
> can pass when you create a CVAR to make it shared between client and
> server. Sorry, dont remember its name right now. Just make the CVAR
> once in a file thats compiled into both, and give it that flag.
>
>
> On Sun, 23 Jan 2005 03:27:49 -0700, Markus Martin <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am trying to share the same console variables between the client and
> > server in a file that is compiled into both dlls. What I do in my
> > shared file is create a pointer to the cvars like so:
> > ConVar *melee_dmg = cvar->FindVar( "melee_dmg" );
> >
> > And this works fine for both client and server. Now, the actual cvar
> > is defined in the normal way in a seperate file, but it is only
> > compiled into the server. Compiling a cvar into both dlls causes one
> > to override the other, and thus the cvar(s) do not work.
> >
> > This seems like perfectly sound code as all goes well until actually
> > loading the dlls hot off the compiler. For some reason when I load my
> > mod, the Half-Life2 dlls are loaded instead. I am thinking the engine
> > decides something is wrong with my dlls, but I find this rather
> > irritating, as I would prefer a crash that I could perhaps debug.. All
> > this happens without any error output whatsoever.
> >
> > I assume that on the client, FindVar() can find the cvars. Perhaps
> > this is not the case. It is not really essential that the client knows
> > the value of the cvar, except maybe for flow control later on down the
> > road.. However, I am trying to avoid #ifdef hell as much as possible
> > as this is a shared file.
> >
> > Greetings,
> > -Markus
> >
> > _______________________________________________
> > 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

Reply via email to