Thread: PCvars
View Single Post
Author Message
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna know...
Old 09-20-2008 , 16:37   PCvars
Reply With Quote #1

Stupid question:
I saw scripts that set the variable's value to the cvar's value at plugin_init(), without setting it using the register_cvar.
I.E:
PHP Code:
new pcvar1pcvar2pcvar3pcvar4;
public 
plugin_init(){

     
register_cvar("OMG_IM_A_CVAR""1337");
     
register_cvar("dor123_is_such_a_newbie""0");
     
register_cvar("haha_cvars_funny_word""12");
     
register_cvar("woot_cvars_everywhere""50");

     
pcvar1 get_cvar_num("OMG_IM_A_CVAR");
     
pcvar2 get_cvar_num("dor123_is_such_a_newbie");
     
pcvar3 get_cvar_num("haha_cvars_funny_word");
     
pcvar4 get_cvar_num("woot_cvars_everywhere");

     
// instead of:

     
pcvar1 register_cvar("OMG_IM_A_CVAR""1337");
     
// etc...

What I wondered was if it only registers the variable's value at the plugin initial, will it be changed when the cvar itself changed? For example: cvar "hello_world" is set to "1". Admin changes it to "2". will pcvar (pcvar = get_cvar_num("hello_world")) be changed to 2 as well at the rest of the plugin? Or will it stay the original cvar's value because it's at plugin_init?
Hope you understand what I mean...
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline