Raised This Month: $ Target: $400
 0% 

ConVar.BoolValue possible bug ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xerox8521
Senior Member
Join Date: Sep 2011
Old 08-21-2015 , 20:42   ConVar.BoolValue possible bug ?
Reply With Quote #1

So I have this Convar which defaults to 0. However once it has been set to true it doesn't change back to false. Using GetConVarBool and SetConVarBool it works fine using latest stable 1.7.2 SM compiler.
Could someone confirm this bug or maybe tell me if i understood something wrong here ?
PHP Code:
sv_random_variable_name CreateConVar("sv_random_variable_name","0","",FCVAR_NONE,true,0.0,true,1.0); 
To simplyfy toggling it for admins i made a small cmd

PHP Code:
public Action Command_Trail(int clientint args)
{
    
PrintToChatAll("%d",sv_random_variable_name.BoolValue);
    if(
sv_random_variable_name.BoolValue == true)
    {
        
sv_random_variable_name.BoolValue false;
    }
    else
    {
        
sv_random_variable_name.BoolValue true;
    }    
    return 
Plugin_Handled;

xerox8521 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-21-2015 , 21:01   Re: ConVar.BoolValue possible bug ?
Reply With Quote #2

BoolValue might be read-only and you may need to alter it via some function. Look it up.
__________________
hleV is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 08-21-2015 , 21:02   Re: ConVar.BoolValue possible bug ?
Reply With Quote #3

no it has a setter

// Retrieves or sets a boolean value for the convar.
property bool BoolValue {
public native get();
public native set(bool b);
}
xerox8521 is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 08-21-2015 , 21:45   Re: ConVar.BoolValue possible bug ?
Reply With Quote #4

yeah, seems bugged
Miu is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 08-21-2015 , 22:17   Re: ConVar.BoolValue possible bug ?
Reply With Quote #5

PHP Code:
public Action Command_Trail(int clientint args)
{
    
PrintToChatAll("%d",sv_random_variable_name.BoolValue);
    if(
sv_random_variable_name.BoolValue)
    {
        
sv_random_variable_name.SetBool(false);
    }
    else
    {
        
sv_random_variable_name.SetBool(true);
    }    
    return 
Plugin_Handled;

Tylerst is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-22-2015 , 01:16   Re: ConVar.BoolValue possible bug ?
Reply With Quote #6

I may be seeing odd behavior in int convars using .IntValue... need to try some things to test some things.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 08-22-2015 , 07:11   Re: ConVar.BoolValue possible bug ?
Reply With Quote #7

Ya, I remember getting a bug report about convars not being set properly through ConVar's properties(it was for VSH repo I have)
__________________
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-22-2015 , 14:11   Re: ConVar.BoolValue possible bug ?
Reply With Quote #8

Quote:
Originally Posted by WildCard65 View Post
Ya, I remember getting a bug report about convars not being set properly through ConVar's properties(it was for VSH repo I have)
Well, in my case I need to go check if it's something messing with the precedence order.

However, given that it works correctly the first time it's used and not subsequent times....

...oh right, did I mention that this is happening in a core plugin? Specifically, MapChooser when you extend a map. And apparently only for the maxrounds cvar.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 08-22-2015 at 14:11.
Powerlord is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 08-22-2015 , 22:12   Re: ConVar.BoolValue possible bug ?
Reply With Quote #9

Yea I have problems with using .IntValue too and am forced to use Get/SetConVarInt. I have a similar problem with adt_array's .Set (or .Get?) function

Last edited by blaacky; 08-22-2015 at 22:13.
blaacky is offline
psychonic

BAFFLED
Join Date: May 2008
Old 08-22-2015 , 22:35   Re: ConVar.BoolValue possible bug ?
Reply With Quote #10

If you believe there to be an issue, please file a bug @ https://bugs.alliedmods.net (forum email and password to log in) with a minimal test case that can reproduce the issue.

Last edited by psychonic; 08-22-2015 at 22:36.
psychonic 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 19:53.


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