Raised This Month: $32 Target: $400
 8% 

Get cvar value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 06-09-2015 , 16:23   Get cvar value
Reply With Quote #1

How can i get cvar value?
an example, for sv_gravity ?
uurbyrkdr is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 06-09-2015 , 16:26   Re: Get cvar value
Reply With Quote #2

GetConVarInt(FindConVar("sv_gravity")) XDXD
Miu is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 06-09-2015 , 16:29   Re: Get cvar value
Reply With Quote #3

PHP Code:
new Handle:g_hCvarGravity FindConVar("sv_gravity");

new 
iGravity;
if (
g_hCvarGravity != INVALID_HANDLE)
{
  
iGravity GetConVarInt(g_hCvarGravity);

There's also GetConVarBool, GetConVarFloat and GetConVarString - which one you want depends on what format you want the ConVar in.
__________________

Last edited by 11530; 06-09-2015 at 16:36.
11530 is offline
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 06-09-2015 , 17:01   Re: Get cvar value
Reply With Quote #4

thank you guys!
uurbyrkdr is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-09-2015 , 20:15   Re: Get cvar value
Reply With Quote #5

Your going to want to cache the Handle that FindConVar returns as it's a relatively expensive operation.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 16:45.


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