PCvars?
Iv been hearing a lot about 'pcvars'. What exactly is it? Is it better then just normal CVARS?
|
Re: PCvars?
they work a lot faster than normal get_cvar_* functions because they use pointers (I'm guessing, I know a little bit of C++ and I think I see why using pointers would help here, anyway...). You have to register them to a global variable (unless your only using it once). Heres some example code...
Code:
//i like to make it the same name as the actual cvar} |
Re: PCvars?
So, pretty much in any case, it's always best to use them?
|
Re: PCvars?
Yeah, unless you want to support versions of AMX Mod X that don't support pcvars :wink:
|
Re: PCvars?
a pcvar is basicly amxmodx's verrsion of a pointer . hooking a varaible directly to cvars . the only time you need to use them is if you use a get_cvar_num("whatever") more then once. if you only use the cvars once in a script theres no need to make a varaible to handle it . becasue everytime a varaible is declared , memory is alocated to handle the variable. so if you use the same cvar more then once , you can use a "pointer" to get and find the varaibles easyier . :up:
|
Re: PCvars?
Quote:
Code:
Even if this was all the code. I would still use pcvar in this situation. It also depends on the situation to. Even though the cvar is only use once in this situation. I would do this even though it only use once in this plugin. Code:
I would not use pcvar here if your not going to use it more than once. Since this is only start of the plugin. Other than that I would only use normal set/get_cvar_* in plugin_init or plugin_cfg. |
Re: PCvars?
teame06, he obviously meant that if you are going to save the cvar in a variable, thus reading it only once, it is not neccessary to use a pcvar.
|
Re: PCvars?
Quote:
Quote:
|
Re: PCvars?
Quote:
|
Re: PCvars?
zenith doesnt care he just likes to argue. wether hes wrong or not :wink:
team06 on the other hand is good at explaining things , and ill believe team06 in this case . |
| All times are GMT -4. The time now is 06:57. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.