Couldn't you just use some pre-processor ('#if') statements to get it to run
on both the client and server?


-Übermensch


----- Original Message -----
From: "Varlock" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 15, 2002 2:05 AM
Subject: [hlcoders] Server CVAR's on Client


>     This is the last time I'll ask this question on the list. I promise.
:)
> I'm going to try to explain in depth so maybe someone will have a sudden
> idea that might work.
>
> Overview -
>
>     I want to be able to access server CVAR's on the client. By server, I
> mean a CVAR that can only be set on the server (such as sv_gravity or in
> this case a new one I've made: mp_aquashotgun). I really don't care HOW I
> get to access it on the client, just as long as I can do it.
>
> Scenario 1 -
>
>     In this best case scenario, I can somehow tell Half-Life to propagate
> the CVAR to the client by its own internal networking. For example, when I
> define the CVAR I could let Half-Life know it should be like
> FCVAR_SENDTOCLIENT or some such thing. In this case, I could somehow
access
> the CVAR with a CVARGetFloat kind of function on both the server and the
> client.
>     Because the CVAR I am dealing with must be used by a weapon, it has to
> be accessible in a weapon file shared between the server and the client.
My
> main problem here is the CVAR_GET_FLOAT function used on the server is not
> accesible by the client. The equivalent client-side function
> (gEngfuncs.pfnGetCvarFloat) can't be used in a weapons file because the
> weapons file is shared between the server and the client. If I try to use
it
> hear, gEngfuncs is undefined. If I include the correct headers, they
> conflict with other already included headers (ie. util.h). If I try to add
> just the definition of gEngfuncs, the whole file just becomes one big
> unreadable mess where nothing works.
>
> Scenario 2 -
>
>     Somehow I could detect when the CVAR changes. When it does, I send a
> custom message (through MESSAGE_BEGIN, etc) to the client to update a
> variable there. I can now access this variable on the client. Question:
how
> do I access this variable? Can I just declare it as extern or something?
I'm
> really not sure how this whole 'shared' thing works.
>
> Conclusion -
>
>     Those are the only two options I can think of. The whole problem stems
> from the client-side weapons and the shared weapons files. Before, when
the
> weapons were server-side only, there was no problem. But if I don't
> propagate the CVAR to the client (mp_aquashotgun), it might show the
> animation for firing under water when really the server won't allow it or
> vice versa.
>     Anyone! Valve! There MUST be a way to somehow go about doing this. I'm
> missing it, but I hope you can point it out! It's been a problem for me
for
> over a month now, and I still haven't found a solution. I will be very
> thankful to the kind soul who can solve this problem.
>
> - Trevor "Varlock" Hogan
>
> _______________________________________________
> 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