You could do some hacking, the function retrieving the value could be changed 
to something like this?

void MyFucntionThatDoesStuff ( void )
{
 if ( sv_MyConVar.GetInt() > 5 ) { sv_MyConVar = 5; }
 if ( sv_MyConVar.GetInt() < 2 ) { sv_MyConVar = 2; }

 TheFunctionINeedToCall ( sv_MyConVar.GetInt() );
}

Or perhaps if you need some more flexible reusable code something like

void ClampConVar( ConVar ConsoleVariable, int LowerBound, int UpperBound)
{ 
 if ( ConsoleVariable.GetInt() > UpperBound ) { ConsoleVariable = UpperBound; }
 if ( ConsoleVariable.GetInt() < LowerBound ) { ConsoleVariable = LowerBound; }
}

void MyFucntionThatDoesStuff ( void )
{
 ClampConVar(sv_MyConVar,2,5);

 TheFunctionINeedToCall ( sv_MyConVar.GetInt() );
}

I'm not sure if it'll work with the exact code I just wrote, but you'll 
probably be able to figure out the rest yourself. 
Perhaps some defines such as
#define sv_MyConVar_upper 2
#define sv_MyConVar_lower 1

Could be useful too? ;D

Otherwise you'll probably be forced to write your own child class of ConVar to 
do such stuff. :D

Sortie


From: "Tony "omega" Sergi" <[EMAIL PROTECTED]>
> It's been a while for me, but i don't think you can, that was one of the new
> things added to source.
> 
> 
> On Fri, Jul 18, 2008 at 4:17 AM, Tan Theodore <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> Duly noted.
>>
>> But how do I go about with your suggestion?
>> I was also considering about doing the same with 'armorvalue'.> Date: Thu,
>> 17 Jul 2008 16:14:25 -0400> From: [EMAIL PROTECTED]> To:
>> [email protected]> Subject: Re: [hlcoders] Setting
>> restriction for CVARS> > it wouldn't be so bad if you used an actual client
>> and imap or something; or> edited your replies so you get rid of the
>> previous messages.
>> _________________________________________________________________
>> Manage multiple email accounts with Windows Live Mail effortlessly.
>> http://www.get.live.com/wl/all
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list archives,
>> please visit:
>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>
>>
> 
> 
> -- 
> -Tony
> _______________________________________________
> 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