AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Setting Cvars (https://forums.alliedmods.net/showthread.php?t=101203)

BigMac 08-21-2009 18:58

Setting Cvars
 
How would i make Cvars for this??


<hamsandwich>


set_task(get_cvar_float("BCM_timelockrtt" ), "unlockVoteConfig");
new type = get_cvar_num("BCM_automaticloading");
new roundLimit = get_cvar_num("BCM_loadingrounds");

crazyeffect 08-21-2009 19:02

Re: Setting Cvars
 
if(get_pcvar_num(type)) {
}

if(get_pcvar_num(roundlimit)) {
}

fysiks 08-21-2009 19:44

Re: Setting Cvars
 
PHP Code:

register_cvar("my_cvar_here""default value"


Quote:

Originally Posted by crazyeffect (Post 908445)
if(get_pcvar_num(type)) {
}

if(get_pcvar_num(roundlimit)) {
}

They aren't pcvars.

Bugsy 08-21-2009 19:52

Re: Setting Cvars
 
Just be sure to use the correct type:

PHP Code:

//register cvars, setting cvar pointers to variables for use later
new g_pInterval register_cvar"BCM_timelockrtt" "1.5" );
new 
g_pType register_cvar"BCM_automaticloading" "1" );

//access timelockrtt value (float\decimal)
get_pcvar_floatg_pInterval );

//access automaticloading value (integer)
get_pcvar_numg_pType );

//Likewise, use the respective set_pcvar_* to change the value
set_pcvar_floatg_pInterval 1.5 );
set_pcvar_numg_pType ); 


BigMac 08-21-2009 20:46

Re: Setting Cvars
 
Thanks for the help +karma


All times are GMT -4. The time now is 15:15.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.