Raised This Month: $ Target: $400
 0% 

better way to declare CVARs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-14-2011 , 15:17   Re: better way to declare CVARs
Reply With Quote #1

Something like this:

PHP Code:
new g_pCvar
new g_iCvarValue

// plugin_init()
    
g_pCvar register_cvar("mycvar""1")

// plugin_cfg() // You can use any recurring function here like new round or round end or whatever
    
g_iCvarValue get_pcvar_num(g_pCvar)

// client_prethink()
    
if( g_iCvarValue == )
    
// ...  Use it how ever you need here. 
__________________
fysiks is offline
gamer99
Senior Member
Join Date: Jul 2011
Old 07-14-2011 , 15:43   Re: better way to declare CVARs
Reply With Quote #2

superb idea fysiks and bibu ... love u man
gamer99 is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-14-2011 , 15:14   Re: better way to declare CVARs
Reply With Quote #3

Just cache the cvars on new round and then you don't need to use "get_pcvar_num" anymore.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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