better way to declare CVARs
Hi ,
Suppose I have a CVAR g_dTest = register_cvar("test","1") Now g_dTest I have declared globaly . Suppose I need to use the value of the cvar within one function with is being called every 1 sec. So i wrote new iTest = get_pcvar_num(g_dTest) inside the function . But with this get_pcvar_num is being called also every time . Can we do like 1)declaring iTest globally and then calling one function which will set the value of iTest globally ? Is there any disadvantage in this ?or what is the better way of declaring one cvar ? |
Re: better way to declare CVARs
You could cache the value :
- Into a global var, like each new round or something. The cons is your var won't be updated in real-time. - Using my awesome module Cvar Utilities, you can hook a value change of a cvar and caching the value into a global var. It will updated in real-time. |
Re: better way to declare CVARs
I don't know of any cvar that needs to be real-time updated. 99% of cvars could be cached on init and nobody would know the difference.
|
Re: better way to declare CVARs
You're wrong but it's ok.
|
Re: better way to declare CVARs
Quote:
|
Re: better way to declare CVARs
No problem. You're welcome. I'm glad you're aware to not know all.
|
Re: better way to declare CVARs
Quote:
Quote:
|
Re: better way to declare CVARs
init is not working ... i am checking is a client prethink ... And declaring the cvar as global ....
I don wanna any extra module .... better I will check every time in prethink |
Re: better way to declare CVARs
Quote:
Quote:
|
Re: better way to declare CVARs
sry for the one second confudion .. the should be one frame ..:D ..
I was trying to avoid that calling every frame ...:) |
| All times are GMT -4. The time now is 01:07. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.